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("~/")

Comments

Popular posts from this blog

Run OpenAI Codex Inside Claude Code via MCP

I Built an AI Reviewer That Refuses to Tell Me If My Idea Will Work