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 Website address

Getting Website address

Scheduled Pinned Locked Moved ASP.NET
databasecomquestion
4 Posts 3 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.
  • H Offline
    H Offline
    hasanali00
    wrote on last edited by
    #1

    How can I get the URL of a webiste. I believe I can use Request.URL , but this would return: http://www.MySite.com/index.aspx However, I just want to get http://www.MySite.com or just: www.MySite.com thanks

    M G 2 Replies Last reply
    0
    • H hasanali00

      How can I get the URL of a webiste. I believe I can use Request.URL , but this would return: http://www.MySite.com/index.aspx However, I just want to get http://www.MySite.com or just: www.MySite.com thanks

      M Offline
      M Offline
      MoustafaS
      wrote on last edited by
      #2

      You can do it by removing the string after the / symbol.

      ------------------------------
      "The Soapbox has been so ..."

      1 Reply Last reply
      0
      • H hasanali00

        How can I get the URL of a webiste. I believe I can use Request.URL , but this would return: http://www.MySite.com/index.aspx However, I just want to get http://www.MySite.com or just: www.MySite.com thanks

        G Offline
        G Offline
        g00fyman
        wrote on last edited by
        #3

        create a Uri from it and use its properties to get what you want. hth g00fy

        H 1 Reply Last reply
        0
        • G g00fyman

          create a Uri from it and use its properties to get what you want. hth g00fy

          H Offline
          H Offline
          hasanali00
          wrote on last edited by
          #4

          Hi I have following code: Uri uri = new Uri("http://www.examples.co.uk/index.aspx"); websiteAddress = uri.Host; uri.Host would return "www.examples.co.uk". But how can I get: "examples.co.uk" thanks

          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