Home > Asp.net > Get Current Page Name In Asp.net, C# codebehind

Get Current Page Name In Asp.net, C# codebehind


Below method will give current page name in C#, asp.net Code behind:

/// <summary>
/// Pankaj lalwani
/// GetCurrentPageName
/// </summary>
/// <returns>Current Page name</returns>
public static string GetCurrentPageName()
{
string sPath = HttpContext.Current.Request.Url.AbsolutePath;
string[] strarry = sPath.Split(‘/’);
int lengh = strarry.Length;
string sRet = strarry[lengh - 1];
return sRet;
}

About these ads
  1. kishore M
    June 1, 2012 at 11:56 am

    Thanks…….. Nice information

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: