codiiv codiiv - 2 years ago 88
C# Question

.NET MVC get path of a folder. Any Folder I need

I am new on .NET and created a project XYZ. In one of the controllers, I created QR codes and save them in XYZ/Content/Uploads as long as I hard code the path.

Something like

img.Save("C:\\Users\\myusername\\Documents\\Visual Studio 2015\\Projects\\XYZ\\XYZ\\Content\\Uploads\\"+newname+ ".jpg", ImageFormat.Jpeg);

When I deploy the project on Azure, obviously this doesn't work. I want to get physical path of the Content folder and so far the suggested
is simply not working.

Can someone tell me why on earth something so trivial has to seem so hard to come across, and point me in the right direction :)

Answer Source

Application as root.

var folderRootPath = HttpContext.Server.MapPath("~/Content/Upload/");




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download