Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

https and images on site

Status
Not open for further replies.

dstepans

Programmer
Jun 3, 2003
39
0
0
US
Hello,

I have images in header and footer. When user is redirected to secure part of site (for example during checkout) I need http be substituted by https in image urls.

What would be the best way to implement it?

Thanks,
Denis
 
Change the URL for the images in your checkout page to use HTTPS.

Specifying "https" means that the conversation between your server and their browser is encrypted. It doesn't say anything about where the files you're serving are coming from.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Thanks Chip,

but I don't want url for the images be encrypted all the time (I was told it slows down the site), I want it to be http but when the connection becomes secure (like during check out), I would like the image urls to change to https.

What would be the best way to detect secure connection and how would I change the http to https for the images?

Thanks,
Denis
 
You're not following me. Both of these point to the same image:


The only difference is how it's sent to the user. First one is unencrypted, and would be used on the majority of your site. 2nd one is encrypted, and only gets used on your check-out pages.

If you have mixed content (some content secure, some not) on a page, your user will see a popup complaining about insecure content. By changing all the URLs on the check-out page to use the https protocol you prevent this.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Thanks Chip,

I think I was not clear enaugh, I know the diff between http & https and that they point to the same image. My questin was how do I detect secure connection and the best method to change the urls.

The problem I have here is as follows. I have a header file which is inluded in all pages with both secure & unsecure connections. This header file has images. Since this same file is included in all pages, I need to somehow (how?)detect when the connection is secure & change http to https. The question is: how would I detect the secure connection and the best method to change image paths to https and then back for regular connection.

Thanks,
Denis
 
Hey Denis,

Something that I ran across
Using a HTTPModule to control HTTP/HTTPS -

If it's not 100% then maybe you can adapt it to meet your needs.

BTW, if you put the runat="server" in all you <img> tags, you can easily manipluate the src attribute at runtime. For example, you can specify the link with the tilde (VirtualApplicationPath) so
Code:
<img runat="server" src="~/images/x.gif">
always points to the images folder in the curretn virtual directory, regardless of how deep the virtual directory is nested in the server root.

Maybe something like that....

Ideally, we would like to be able to design the pages without having to worry about it being https or not. What we want is the fully qualified urls to be put in dynamically.

At any rate, I will be addressing this issue soon myself, so I will post any results here when found.

Greetings,
Dragonwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top