Get file name of associated aspx file

S

Sacha Korell

Is there a simple way of getting the associated aspx file name from the
code-behind?

I did it this way:

Dim strFileName As String
strFileName = Path.GetFileName(Request.ServerVariables("PATH_TRANSLATED"))
Response.Write(strFileName)

But it seems there should be something like the following Pseudo Code:

me.MyASPXFileName


Thanks,

Sacha
 
S

Sacha Korell

Thanks Dave, but that doesn't really get the file name. If you have a file
called test.aspx and use

me.GetType.ToString

it will return ASP.test_aspx.

Sacha
 
J

Jeff Siver

You can also use Request.PhysicalPath. This will return the full path &
file name of the aspx page being displayed.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top