All posts tagged url

Get URL of ASP.Net Page

Some time we need to get the current page location . Today i will show how to do that.

This function can be used to retrieve the current page’s name, i.e default.aspx, hello.aspx or whatever.

 
public string GetCurrentPagename()
{

      string sPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath);    
string sRet = oInfo.Name;  
return  sRet ;
}

If you want to need other things to retrive from url like bellow image then just call that.