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. General Programming
  3. C#
  4. get page name

get page name

Scheduled Pinned Locked Moved C#
comquestion
6 Posts 4 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.
  • T Offline
    T Offline
    TAREQ F ABUZUHRI
    wrote on last edited by
    #1

    hello how can get pae name from URL as this http://www.any.com/abc.aspx?ss=4 i want the result to be abc.aspx ????

    Palestine

    L H 2 Replies Last reply
    0
    • T TAREQ F ABUZUHRI

      hello how can get pae name from URL as this http://www.any.com/abc.aspx?ss=4 i want the result to be abc.aspx ????

      Palestine

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      would that be everything ending at the first question mark, and starting after the last slash before it ? the string class has everything you need. :)

      Luc Pattyn


      try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


      U 1 Reply Last reply
      0
      • L Luc Pattyn

        would that be everything ending at the first question mark, and starting after the last slash before it ? the string class has everything you need. :)

        Luc Pattyn


        try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


        U Offline
        U Offline
        Urs Enzler
        wrote on last edited by
        #3

        I'd rather use the Request object and its methods to access the different parts of the URL that do it myself with string operations. see MSDN HttpRequest class for more information.

        -^-^-^-^-^- no risk no funk

        1 Reply Last reply
        0
        • T TAREQ F ABUZUHRI

          hello how can get pae name from URL as this http://www.any.com/abc.aspx?ss=4 i want the result to be abc.aspx ????

          Palestine

          H Offline
          H Offline
          Hessam Jalali
          wrote on last edited by
          #4

          Uri mine=new Uri("http://www.any.com/abc.aspx?ss=4"); string path=mine.AbsolutePath //result would be like '/abs.aspx' just for this page //you can use string operations with string class or regex for above result or use the simpler way like the code below string name=mine.Segments[mine.Segments.Length-1]; // just give you the last part of the name

          T 1 Reply Last reply
          0
          • H Hessam Jalali

            Uri mine=new Uri("http://www.any.com/abc.aspx?ss=4"); string path=mine.AbsolutePath //result would be like '/abs.aspx' just for this page //you can use string operations with string class or regex for above result or use the simpler way like the code below string name=mine.Segments[mine.Segments.Length-1]; // just give you the last part of the name

            T Offline
            T Offline
            TAREQ F ABUZUHRI
            wrote on last edited by
            #5

            how can get the URL from asp.net page ??

            Palestine

            H 1 Reply Last reply
            0
            • T TAREQ F ABUZUHRI

              how can get the URL from asp.net page ??

              Palestine

              H Offline
              H Offline
              Hessam Jalali
              wrote on last edited by
              #6

              if you mean getting the url of current page you can use Uri pageUri=Request.Url; if you need mapping or rewriting for url see: http://www.codeproject.com/aspnet/urlrewriter.asp http://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/

              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