Friday, November 18, 2011

How do I get the application path in an ASP.NET application


Retrieve the application path

string appPath = HttpContext.Current.Request.ApplicationPath;

Convert virtual application path to a physical path

string physicalPath = HttpContext.Current.Request.MapPath(appPath);

                                                   OR

System.Web.HttpContext.Current.Server.MapPath("~/")

No comments:

Post a Comment