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. How to get wether the opened page is secure or nonsecure in asp.net

How to get wether the opened page is secure or nonsecure in asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorial
7 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.
  • M Offline
    M Offline
    monuSaini
    wrote on last edited by
    #1

    Hello Everybody, I am unable to get that thw opened page is secure or nonsecure. Actually i want know that page url is starting with http or https regards Rahul rahul saini

    S C 2 Replies Last reply
    0
    • M monuSaini

      Hello Everybody, I am unable to get that thw opened page is secure or nonsecure. Actually i want know that page url is starting with http or https regards Rahul rahul saini

      S Offline
      S Offline
      Sun Rays
      wrote on last edited by
      #2

      u can use it.. url = Request.ServerVariables("HTTP_REFERER") in url u will get whole url from addressbar. now u can check it. whether it's starting from http or https

      Thanks, Sun Rays

      M 1 Reply Last reply
      0
      • M monuSaini

        Hello Everybody, I am unable to get that thw opened page is secure or nonsecure. Actually i want know that page url is starting with http or https regards Rahul rahul saini

        C Offline
        C Offline
        ca8msm
        wrote on last edited by
        #3

        Try parsing the Request.Url.OriginalString path

        Mark, http://aspnetlibrary.com

        1 Reply Last reply
        0
        • S Sun Rays

          u can use it.. url = Request.ServerVariables("HTTP_REFERER") in url u will get whole url from addressbar. now u can check it. whether it's starting from http or https

          Thanks, Sun Rays

          M Offline
          M Offline
          monuSaini
          wrote on last edited by
          #4

          Hello Sun Rays Thanks for rplying me. the code you have written is not working Can you please explain me more clearly Thanks Rahul rahul saini

          C S 2 Replies Last reply
          0
          • M monuSaini

            Hello Sun Rays Thanks for rplying me. the code you have written is not working Can you please explain me more clearly Thanks Rahul rahul saini

            C Offline
            C Offline
            ca8msm
            wrote on last edited by
            #5

            That method may not work as the referrer isn't always passed by the browser (the user can disable it if they want) and it wont exist if you type the address directly into the address bar. Check out my earlier reply on the Request.Url.OriginalString method.

            Mark, http://aspnetlibrary.com

            1 Reply Last reply
            0
            • M monuSaini

              Hello Sun Rays Thanks for rplying me. the code you have written is not working Can you please explain me more clearly Thanks Rahul rahul saini

              S Offline
              S Offline
              Sun Rays
              wrote on last edited by
              #6

              Rahul, u try this write this on your page load event. Dim str As String str = Request.Url.OriginalString in str it will give u whole path of addressbar. Dim http As Boolean If str.StartsWith("http:/") Then http = True ElseIf str.StartsWith("https:/") Then http = False End If

              Thanks, Sun Rays

              M 1 Reply Last reply
              0
              • S Sun Rays

                Rahul, u try this write this on your page load event. Dim str As String str = Request.Url.OriginalString in str it will give u whole path of addressbar. Dim http As Boolean If str.StartsWith("http:/") Then http = True ElseIf str.StartsWith("https:/") Then http = False End If

                Thanks, Sun Rays

                M Offline
                M Offline
                monuSaini
                wrote on last edited by
                #7

                Hello Sun Rays Issue is solved with url = Request.Url.AbsoluteUri.ToString Thanks RAHUL rahul saini

                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