vsharma10286
vsharma10286

Reputation: 41

http content is showing in asp.net application

.Net Application is hosted on IIS Server and SSL is enabled on Default WebSite. All of the application's content is rendered on HTTPS. However, a few images in the same application and directory are being rendered over HTTP. I want everything to be rendered over HTTPS

Below is the log that I found for the images

onReceivedError: -8 error desc: net::ERR_CONNECTION_TIMED_OUT error url: http://XXXXXXX/Simulations/ModelSkins/352018174944853370.jpeg

I expect the above URL to be on https as below

https://XXXXXXX/Simulations/ModelSkins/352018174944853370.jpeg

Upvotes: 0

Views: 71

Answers (1)

Jokies Ding
Jokies Ding

Reputation: 3504

If your image are displayed like

<img src="http://XXXXXXX/Simulations/ModelSkins/352018174944853370.jpeg" alt="IIS" width="960" height="600" />

Please download and install URL rewrite: https://www.iis.net/downloads/microsoft/url-rewrite

Then you could use outbound rule to rewrite these link by adding and modify following rule to your web .config system.webServer Section:

<rewrite>
    <outboundRules>
        <rule name="outbound rule">
            <match filterByTags="Img" pattern="http://XXXXXXX/(.*\.(png|jpeg))" />
            <action type="Rewrite" value="https://XXXXXXX/{R:1}" />
        </rule>
    </outboundRules>
</rewrite>

https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-outbound-rules-for-url-rewrite-module

enter image description here

Upvotes: 1

Related Questions