2

On my website I want to apply https only one of my website page "securepage.aspx"

my website look like http://www.test.com/

and my secure page will be https://www.test.com/securepage.aspx

my all resources like JS/Images are in assets folder and my webservices on root in commonwebservice folder.

http://www.test.com/assets/js/

http://www.test.com/assets/images/

when I have applied the https on secure page that page did use any CSS and JS file in chrome browser i.e my whole page messed up, even I have used there absolute URL for CSS and JS.

In this case my webservice give 500 error on all browsers.

Can anyone suggest and guide me what is the best way to handle this situation.

1 Answer 1

1

The behavior you are seeing is frustrating, but correct. When you serve a page with HTTPS, you must also serve all linked content under HTTPS as well.

Check our Protocol-relative URLs (http://paulirish.com/2010/the-protocol-relative-url/)

Basically, they look like this:

<img src="//domain.com/img/logo.png">

If your page is HTTP, the resource loads under HTTP, and if its HTTP, it loads securely, under HTTPS.

You must set up your server to serve out the CSS/JS/WS content under both, but once you do, the relative link above will allow you to switch seemlessly between the two. So for links in your master page, use the relative format, and then it won't matter if a content page is running under HTTP or HTTPS, the resources will pull from the same protocol as the page.

Sign up to request clarification or add additional context in comments.

1 Comment

I have tried as you said, but it not works on Chrome at all,even when I have set the webservice Path from absolute to relative like you told like //test.com/webservice/addtwo now when page load an alert popup opens which is asking for un/pwd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.