How to retrieve current page name

Discussion in 'ASP .Net' started by Valerian John, Aug 20, 2003.

  1. 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
    Valerian John, Aug 20, 2003
    #1
    1. Advertising

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

    "Valerian John" <> wrote in message
    news:...
    > 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
    >
    >
    >
    >
    MS News \(MS ILM\), Aug 20, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ersin Inan

    Retrieve Page Name in asp.net page

    Ersin Inan, Nov 7, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    27,474
    Keith
    Nov 8, 2003
  2. Matthew Heidemann
    Replies:
    14
    Views:
    232
    eT Ma
    Mar 22, 2011
  3. Walle Wallen
    Replies:
    2
    Views:
    78
    Walle Wallen
    Jun 11, 2010
  4. Replies:
    3
    Views:
    357
  5. Replies:
    6
    Views:
    155
Loading...

Share This Page