Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2684
  • Last Modified:

Get current page name from master page

In my master page I have a dropdown menu.  When the user changes the selected item in the dropdown menu I need it to change a Session variable then reload the page the user is currently at.  I'd like to do a simple Response.Redirect, but I'm not sure how to find the name of the page the user is at from the Master Page.  

Is there an easy way to do this?

Thanks
0
sushik15
Asked:
sushik15
2 Solutions
 
pwrBallCommented:
Try this:

System.IO.Path.GetFileName(HttpContext.Current.Request.FilePath)
0
 
sm394Commented:

public static string GetPageName()
        {
            string path = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
            System.IO.FileInfo fi = new System.IO.FileInfo(path);
            return fi.Name;
        }
//---------------------

Response.Redirect(GetPageName());
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now