andr111
andr111

Reputation: 3052

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

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.

Upvotes: 0

Views: 243

Answers (3)

andr111
andr111

Reputation: 3052

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.

Upvotes: 0

slugster
slugster

Reputation: 49974

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.

Upvotes: 1

tsilb
tsilb

Reputation: 8037

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

Upvotes: 0

Related Questions