Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get aspx File Name

Reply
Thread Tools

Get aspx File Name

 
 
Jeff
Guest
Posts: n/a
 
      04-26-2004
I need to determine, at runtime, the page name of the currently requested
aspx page.
Page.ToString(), returns sumething like "ASP.MyFile_aspx". What I'd prefer
is to get the actual file name "MyFile.aspx".

Any suggestions?

Thanks.


 
Reply With Quote
 
 
 
 
Rob Meade
Guest
Posts: n/a
 
      04-26-2004
"Jeff" wrote ...

> I need to determine, at runtime, the page name of the currently requested
> aspx page.
> Page.ToString(), returns sumething like "ASP.MyFile_aspx". What I'd prefer
> is to get the actual file name "MyFile.aspx".


In vanilla ASP you could have used, Request.ServerVariables("SCRIPT_NAME") -
but I'm sure someone here will have a better way to resolve it in .net )

Regards

Rob


 
Reply With Quote
 
 
 
 
Ramdas
Guest
Posts: n/a
 
      04-26-2004
why not use page.Request.Path

>-----Original Message-----
>I need to determine, at runtime, the page name of the

currently requested
>aspx page.
>Page.ToString(), returns sumething

like "ASP.MyFile_aspx". What I'd prefer
>is to get the actual file name "MyFile.aspx".
>
>Any suggestions?
>
>Thanks.
>
>
>.
>

 
Reply With Quote
 
Andrea Williams
Guest
Posts: n/a
 
      04-26-2004
Here's what I've been using:

public static string PageName()

{

string strTemp;

int intPos;

strTemp =
System.Web.HttpContext.Current.Request.ServerVaria bles["SCRIPT_NAME"].ToStri
ng();

intPos = strTemp.LastIndexOf("/");

strTemp = strTemp.Substring(intPos + 1);

return strTemp;

}

"Jeff" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I need to determine, at runtime, the page name of the currently requested
> aspx page.
> Page.ToString(), returns sumething like "ASP.MyFile_aspx". What I'd prefer
> is to get the actual file name "MyFile.aspx".
>
> Any suggestions?
>
> Thanks.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to get the file name from a String containing the path plus the file name? Mike Schilling Java 2 03-05-2010 03:53 AM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
Get file name of associated aspx file Sacha Korell ASP .Net 4 01-07-2004 09:55 PM
including one aspx file in another aspx file vish ASP .Net 2 07-16-2003 10:29 PM
Re: Urgent! how to get object name, method name and attribute name based on the strings? ding feng C++ 2 06-25-2003 01:18 PM



Advertisments