Hi, I want to find the current .aspx page name. Suppose I have a page display.aspx page which I extend from some other custom page which extends itself from Page web control. Basically every aspx page extends custom page which in turn extends Page web control.
So in custom page , I want to find the current page from where the request is coming. I know I can use Request.Url which will give me full URL http://localhost:80/webapps/display.aspx. But I just need to take display.aspx. Is there any readymade shortcut to
achieve this or I need to parse this url , for getting the page name. If so, how can I do that. thanks vinod
The Path class uses System.IO, which you'll have to include at the top of your codebehind. There's also the Segments attribute of the Uri Class (which is the type returned by Request.Url) which returns a string array. So you could also do something like:
string[] urlSegments = Request.Url.Segments;
And I'm pretty sure the filename is in the last segment.
vinod_kmr
Member
105 Points
21 Posts
How to find current aspx page name
Sep 10, 2003 05:32 PM|LINK
benahimvp
Member
440 Points
88 Posts
Re: How to find current aspx page name
Sep 10, 2003 06:35 PM|LINK