How to retrieve current page name

  • Thread starter Thread starter Valerian John
  • Start date Start date
V

Valerian John

Hi, folks:

I am looking for a way to get the name of the current page in code. Just
the page name, eg. login.aspx.
I have used Request.CurrentExecutionFilePath and the Split method of the
String class, like this:
Dim thisPath As String = Request.CurrentExecutionFilePath

Dim thisPage As String() = thisPath.Split("/"c)

Dim pageName = thisPage(thisPage.Length - 1)

There must be a simpler way!

TIA,

Val
 
Dim pageName As String =
Request.CurrentExecutionFilePath().Replace(Request.ApplicationPath + "/",
"")
 
Back
Top