Https and images and js files

  • Thread starter Thread starter ABCL
  • Start date Start date
A

ABCL

Hi

I have asp.net web site that is working well on my m/c if I access
using http://
But I depyoed on production,It requiers to use https:// , If i browse
tha page using https://...and on login page it doesn't link images,
css and .js files on the login page. Once the user login successfully
and try to browse login page agian, The images and .js files are
working fine
what can be problem? how to solve it?

Thanks in ADvance
 
Hi

I have asp.net web site that is working well on my m/c if I access
using http://
But I depyoed on production,It requiers to use https:// , If i browse
tha page usinghttps://...andon login page it doesn't link images,
css and .js files on the login page. Once the user login successfully
and try to browse login page agian, The images and .js files are
working fine
what can be problem? how to solve it?

Thanks in ADvance

It sounds like you might be using full URL paths to your images and js
files. If you have an https:// page and in your html code you have
<img src="http://www.mydomain.com/images/image.gif" then you will have
problems. You should use relative paths to your included js/css/image
files, i.e. <img src="/images/image.gif"> and you shouldn't have any
problems.

The alternative is to create a variable in your code behind, something
like this:

string sHttps = Request.ServerVariables["HTTPS"] == "on" ?
"https://" : "http://";

Then in your aspx page, you would have <img src="<%=sHttps
%>www.somedomain.com/images/image.gif">

HTH,
Brandon
==================
http://www.busedge.com
 
I have asp.net web site that is working well on my m/c if I access
using http://
But I depyoed on production,It requiers to use https:// , If i browse
tha page usinghttps://...andonlogin page it doesn't link images,
css and .js files on the login page. Once the user login successfully
and try to browse login page agian, The images and .js files are
working fine
what can be problem? how to solve it?
Thanks in ADvance

It sounds like you might be using full URL paths to your images and js
files. If you have an https:// page and in your html code you have
<img src="http://www.mydomain.com/images/image.gif" then you will have
problems. You should use relative paths to your included js/css/image
files, i.e. <img src="/images/image.gif"> and you shouldn't have any
problems.

The alternative is to create a variable in your code behind, something
like this:

string sHttps = Request.ServerVariables["HTTPS"] == "on" ?
"https://" : "http://";

Then in your aspx page, you would have <img src="<%=sHttps
%>www.somedomain.com/images/image.gif">

HTH,
Brandon
==================http://www.busedge.com

I am using relative path, That is why once user will authenticate the
images are displaying, but w/o autheticate it is not displaying
 
It sounds like you might be using full URL paths to your images and js
files. If you have an https:// page and in your html code you have
<img src="http://www.mydomain.com/images/image.gif" then you will have
problems. You should use relative paths to your included js/css/image
files, i.e. <img src="/images/image.gif"> and you shouldn't have any
problems.
The alternative is to create a variable in your code behind, something
like this:
string sHttps = Request.ServerVariables["HTTPS"] == "on" ?
"https://" : "http://";
Then in your aspx page, you would have <img src="<%=sHttps
%>www.somedomain.com/images/image.gif">
HTH,
Brandon
==================http://www.busedge.com

I am using relative path, That is why once user will authenticate the
images are displaying, but w/o autheticate it is not displaying- Hide quoted text -

- Show quoted text -

Are you using Windows Authentication? If so, then you need to check
file/folder permissions on those folders like where the images are.
You need to make sure that the user who authenticates has access to
read those files.

-Brandon
==================
http://www.busedge.com
 
Back
Top