About 6 months ago I rolled out a site where every request needed to be over https. The only way at the time I could find to ensure that every request to a page was over https was to check it in the page load event. If the request was not over http I would response.redirect(‘https://example.com‘)
Is there a better way — ideally some setting in the web.config?
Please use HSTS (HTTP Strict Transport Security)
from http://www.hanselman.com/blog/HowToEnableHTTPStrictTransportSecurityHSTSInIIS7.aspx
Original Answer (replaced with the above on 4 December 2015)
basically
that would go in the global.asax.cs (or global.asax.vb)
i dont know of a way to specify it in the web.config