?
Solved

Get current page name from master page

Posted on 2008-10-27
2
Medium Priority
?
2,682 Views
Last Modified: 2013-12-17
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
Comment
Question by:sushik15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
pwrBall earned 1000 total points
ID: 22817860
Try this:

System.IO.Path.GetFileName(HttpContext.Current.Request.FilePath)
0
 
LVL 13

Assisted Solution

by:sm394
sm394 earned 1000 total points
ID: 22817911

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question