开发者

IIS: https://example.com switches to http://example.com:443 after form submit

开发者 https://www.devze.com 2022-12-24 17:17 出处:网络
I have a .net 3.5 site with \"require SSL\" option checked. After submitting any form I got a message \"The page contains both secure and nonsecure items\" and if I click \"yes\", it changes the url f

I have a .net 3.5 site with "require SSL" option checked. After submitting any form I got a message "The page contains both secure and nonsecure items" and if I click "yes", it changes the url from "https://example.com/..." to "http://example.com:433/...". Does anyone know what can be the problem?

Edit: this happens only when I submit 开发者_运维技巧postback. If I type URL manually everything is ok.


This will usually happen when you are sourcing some of your page via SSL (using the https protocol), and some of it from regular HTTP protocol (most likely images or script or css files).

Go through and check which files you have referenced with an absolute path, and change them to relative.

Look for things like this:

<img source="http://somesite.com/myimage.png" />

this image will be delivered insecurely via HTTP, hence the warning in your page.


Is your SSL Certificate installed and valid? Does it happen from multiple clients?


Sorry, this was not the problem of IIS. It was redirect in the code:

UriBuilder url = new UriBuilder();
if (Request.Url.Port != 80)
{
    url.Port = Request.Url.Port;
}

I replaced this with:

UriBuilder url = new UriBuilder(Request.Url);

Now everything fine. Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号