Is there a way to force web service request to use HTTPS.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AndrewK
    New Member
    • Dec 2008
    • 16

    Is there a way to force web service request to use HTTPS.

    I have an asp.net web service which has SSL enabled via IIS. It works fine if the user uses https, however I have a user that insists on using http on the url.
    What I'd like to do is have the web service (asmx) do the equivalent of the response.redire ct to change http to https automatically.
    I don't believe that I can do this from a web service so does anyone know a of a similar solution for web services.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I just did this yesterday :)

    I'm using Server 2008 as my operating system. To get around this problem I added a new Website and bound it to port 80 (http). This website has absolutely no content...in IIS I configured it to redirect all requests coming into it to the https:// url. The https website does not have any bindings to port 80...it is only bound to the SSL port (443)

    I did a lot of reading online and found a whole bunch of hacks to get around this issue...I think that this solution was the smoothest, easiest to understand that doesn't require any coding at all!

    -Frinny

    Comment

    • AndrewK
      New Member
      • Dec 2008
      • 16

      #3
      Originally posted by Frinavale
      I just did this yesterday :)

      I'm using Server 2008 as my operating system. To get around this problem I added a new Website and bound it to port 80 (http). This website has absolutely no content...in IIS I configured it to redirect all requests coming into it to the https:// url. The https website does not have any bindings to port 80...it is only bound to the SSL port (443)

      I did a lot of reading online and found a whole bunch of hacks to get around this issue...I think that this solution was the smoothest, easiest to understand that doesn't require any coding at all!

      -Frinny
      Thanks very much for your answer Frinny, it's much appreciated. However, I'm not sure that it's going to be applicable to me. I've only got one IP address to play with so creating two web sites may not be possible. Also I'm using IIS 6 and I'm not sure whether you can do web site redirections from IIS 6 (unless you know otherwise).

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        It is possible to have more than one website on the same IP. I do it all the time...each website is bound to a domain and/or port that it responds to.

        So you can have 2 websites: one is bound to port 443 and the other is bound to port 80. Both are on the same computer (same IP). Both are going to listen for and respond to requests made on different ports.

        I simply made the website bound to port 80 redirect all requests to the other website (bound to port 443).

        IIS6 I'm not so familiar with though.
        So I looked it up.
        Here is an article explaining how to configure IIS6 to host multiple websites: Hosting Multiple Websites in IIS6.

        The article you'll be interested in reading is the one about Creating Multiple Sites Using Ports (IIS 6.0)

        After you've created the second website (for port 80) you redirect all incoming requests to the "real" website (on port 443...SSL). See this article for information on how to do that: Redirecting Web Sites in IIS 6.0.

        -Frinny

        Comment

        • AndrewK
          New Member
          • Dec 2008
          • 16

          #5
          Originally posted by Frinavale
          It is possible to have more than one website on the same IP. I do it all the time...each website is bound to a domain and/or port that it responds to.

          So you can have 2 websites: one is bound to port 443 and the other is bound to port 80. Both are on the same computer (same IP). Both are going to listen for and respond to requests made on different ports.

          I simply made the website bound to port 80 redirect all requests to the other website (bound to port 443).

          IIS6 I'm not so familiar with though.
          So I looked it up.
          Here is an article explaining how to configure IIS6 to host multiple websites: Hosting Multiple Websites in IIS6.

          The article you'll be interested in reading is the one about Creating Multiple Sites Using Ports (IIS 6.0)

          After you've created the second website (for port 80) you redirect all incoming requests to the "real" website (on port 443...SSL). See this article for information on how to do that: Redirecting Web Sites in IIS 6.0.

          -Frinny
          Thanks Frinny. That's very helpful. I'll give it a go.

          Comment

          Working...