Solved

Get current page name from master page

Posted on 2008-10-27
2
2,678 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Following an example - Why do I need to click Save button twice? 3 28
MailAddress in vb 4 29
Open a link in vb.net 2 15
Amazon S3 Images with .Net 3 14
IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 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