Friday, 27 March 2015

Determine Current Page Name with ASP.NET


This tutorial will demonstrate how you can easily determine the name of the current page you are on dynamically using ASP.NET ,C#.

protected void Page_Load(object sender, EventArgs e)
{
    //get the current page name
    string pageName = Path.GetFileNameWithoutExtension(Request.Path);
    //display current page name
    Response.Write(pageName);
}

No comments:

Post a Comment