Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Getting aspx filename in Http Request

Getting aspx filename in Http Request

Scheduled Pinned Locked Moved ASP.NET
regexquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ryno Burger
    wrote on last edited by
    #1

    Hi, I’m trying to get the aspx file name from the Http Request i.e. Default.aspx. All I need is just FileName.aspx. Any ideas please? Regex? Or is there an alternative solution? Thanks. R

    W 1 Reply Last reply
    0
    • R Ryno Burger

      Hi, I’m trying to get the aspx file name from the Http Request i.e. Default.aspx. All I need is just FileName.aspx. Any ideas please? Regex? Or is there an alternative solution? Thanks. R

      W Offline
      W Offline
      wEb GuRu
      wrote on last edited by
      #2

      Use the following code to get file name from URL of the page url = Request.Url.ToString pageName = url.Substring(url.LastIndexOf("/") + 1)

      Lets work it Out.........!

      R 1 Reply Last reply
      0
      • W wEb GuRu

        Use the following code to get file name from URL of the page url = Request.Url.ToString pageName = url.Substring(url.LastIndexOf("/") + 1)

        Lets work it Out.........!

        R Offline
        R Offline
        Ryno Burger
        wrote on last edited by
        #3

        Thank you for your reply. I found another solution too.. I first got my "filepath" string from the Http Request and then by using it the following way: string filename = Path.GetFileName(filepath) This also seems to work rather nicely. R.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups