I’ve got a problem finding application start folder in MVC3 on server.
I’ve got some files on server and I neet to get to them while rendering View
Right now my core looks like this
DirectoryInfo dir = new DirectoryInfo(@"C:\EndlessPathtoMyApp\Layouts\");
But I need it to be more dynamic so it will work no metter where app folder is
Any help (I’m using razor MVC3 if it helps)?
EOG
Use
Server.MapPath("~/Layouts");The ~ is the root of your application. This works across all ASP.NET and MVC versions.