Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on 

Web Service web site ASP.NET url redirect

I have a web site that uses ASMX page with the code page in a App_Code folder

I have SSL installed on IIS
But IIS "allows" http:// and https://
How do I implement a redirect if they use the non-secure url?

I do not have IRL Redirect installed on the IIS server and will not be able to do that for a few days
ASP.NET.NET ProgrammingC#Microsoft IIS Web Server

Avatar of undefined
Last Comment
Bembi
Avatar of Bembi
Bembi
Flag of Germany image

URL Rewite would be the right way, as you do not what to redirect to a different page but to replace the http by https
So if you have none of them installed, the only way would be to do it in front of IIS, if you have a device which is capable to do it.

Avatar of Larry Brister
Larry Brister
Flag of United States of America image

ASKER

I used the url rewrrite and it created the information in my web.config

However... if I leave out the leading https:// the redirect is NOT happening.

AM I missing something?

    </security>
        <rewrite>
            <rules>
                <rule name="wsdev HTTPS Redirect" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="(HTTPS)" pattern="^OFF$" />
                    </conditions>
                    <action type="Rewrite" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>
  </system.webServer>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bembi
Bembi
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo