MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

SSL Enforce (Closed) (Mono Support )

Viewed 13536 time(s), 3 post(s) 7/17/2012 11:33:15 AMby developer
developer

developer

7/17/2012 11:33:15 AM
Hello boys,

I need to enforce HTTPS when user write only HTTP in browser. How can i make this? I tried to add <if> into <UrlRewriter>, but don't work.

And when I add this code into <system.webserver> section, I got "Internal server Error":

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

Thanks.
This content has not been rated yet. 
165 Reputation 19 Total posts
khorvat

khorvat

7/17/2012 1:51:56 PM
Hi,

if you are using IIS then you can use the following routine to manage this.

Let me know if this suites your needs.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
developer

developer

7/18/2012 11:08:02 AM
Yes, it works.

Before I tried to use this,

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

but it doesn't work, because the Microsoft URL Rewrite module was not installed on my server. Now it's OK.
This content has not been rated yet. 
165 Reputation 19 Total posts