Solved

Get current page name from master page

Posted on 2008-10-27
2
2,674 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
2 Comments
 
LVL 6

Accepted Solution

by:
pwrBall earned 250 total points
Comment Utility
Try this:

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

Assisted Solution

by:sm394
sm394 earned 250 total points
Comment Utility

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now