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. Advertisements

  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. Advertisements

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,942
    Keith
    Nov 8, 2003
  2. HaukiDog
    Replies:
    0
    Views:
    545
    HaukiDog
    Mar 7, 2004
  3. GS
    Replies:
    1
    Views:
    2,428
    Patrick.O.Ige
    Mar 3, 2006
  4. Penny

    How to retrieve current page url?

    Penny, Jun 17, 2005, in forum: ASP General
    Replies:
    4
    Views:
    281
    Adrienne
    Jun 18, 2005
  5. Matthew Heidemann
    Replies:
    14
    Views:
    501
    eT Ma
    Mar 22, 2011
  6. Walle Wallen
    Replies:
    2
    Views:
    137
    Walle Wallen
    Jun 11, 2010
  7. Replies:
    3
    Views:
    615
  8. Replies:
    6
    Views:
    404
Loading...