ASP.NET HTTPS and RelativeUrls

I have a website with an SSL certificate for www.foo.com. What's the cleanest way to redirect requests to the https: // prefix? Should I create link servers side-by-side instead of relying on URL resolution with relative paths, ~ /?

Also, let's say I am redirected to the https: // page, the links on the page are created on the master page and resolved using relative paths. If the user clicks on any navigation item, they are essentially stuck at the https: // path, what's the best way to clear it?

All paths must work in dev (localhost), staging and production environments.

0


a source to share


2 answers


No, you don't have to do anything,

Unless you issue a fully qualified url, your redirects and relative urls of the relative url are always considered together with https: //, for example



Your page url is https: //mysite/folder1/page.aspx , and if you issue Response.Redirect ("/folder2/page2.aspx") then the website server only issues the relative url "/ folder2 / page2. aspx ", but the client (IE / FF2 / Safari) adds" https: // mysite "before the URL.

So, as long as you use relative URLs in your project, you are safe.

+1


a source


You can set the <base> tag to your html, which would mean everything will refer to that base url.



0


a source







All Articles