Solved

Get current page name from master page

Posted on 2008-10-27
2
2,680 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 250 total points
ID: 22817860
Try this:

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

Assisted Solution

by:sm394
sm394 earned 250 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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