Get Application Path

Rajni.Shekhar
Posted by Rajni.Shekhar under ASP.NET category on | Points: 40 | Views : 1562
public string GetApplicationPath()
{
string applicationPath = "";

if (this.Page.Request.Url != null)
applicationPath = this.Page.Request.Url.AbsoluteUri.Substring(
0, this.Request.Url.AbsoluteUri.ToLower().IndexOf(
this.Request.ApplicationPath.ToLower(),
this.Request.Url.AbsoluteUri.ToLower().IndexOf(
this.Page.Request.Url.Authority.ToLower()) +
this.Page.Request.Url.Authority.Length) +
this.Request.ApplicationPath.Length);
return applicationPath;
}

Comments or Responses

Login to post response