Friday, October 26, 2012

How to get page name from URL in c#


this.GetType().Name.Split('_')[0]
Or
this.GetType().Name
or
public string GetCurrentPageName() 
{ 
    string sPath = Request.Url.AbsolutePath;
    System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath); 
    string sRet = oInfo.Name; 
    return sRet; 
}

No comments:

Post a Comment