Get file name of associated aspx file

  • Thread starter Thread starter Sacha Korell
  • Start date Start date
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
 
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
 
You can also use Request.PhysicalPath. This will return the full path &
file name of the aspx page being displayed.

Jeff
 
Back
Top