Using the ‘bindings’ feature of IIS7, I added an SSL certificate at the root of my website to ‘https’ (port 443). Then, I required an SSL connection for a specific directory, ‘/secure-directory/’. I can now redirect to this directory by explicitly linking to the https address: https://www.mysite.com/secure-directory/. The problem is that /secure-directory/ is the only directory I want to use SSL, and it contains navigation links which are now maintaining the https prefix, so my ‘Home’ link now directs to https://www.mysite.com instead of http://www.mysite.com.
What is the ideal way to preserve the http prefix for links in the /secure-directory/? I have the IIS7 URL Rewrite module so if someone can share an outbound rule, that would be much appreciated. Otherwise, I would like to know if I’m going about this entirely the wrong way, or of there is a better solution than a rewrite rule. Thanks.
Thanks for the replies. I considered implementing the global.asax and module solutions, but what ended up working best for my needs was an outbound rewrite rule. I may revisit this at a later date and re-evaluate my situation, but for now, this is what I’m using (with the 1860 port removed for production):
(The pattern prevents rewriting on server-side click events, whereas (.*) would rewrite and break them)