I have a very strange problem. (fyi – I’m using forms authentication and manually creating a non persistant auth. ticket/cookie.) My login page has images and CSS applied to it. When I run my site locally (start without debugging), it brings up my login page, but none of my images are displaying and my css isn’t linking. I’m referencing correctly, I promise.
However, when I view this page in VS’s Design view, it shows the images and CSS. Also, if I run it and log in, and click the back button, everything shows up (images/css)! But if I logout (which redirects me to the login page), my images/css isn’t there! Its as if the page can’t reference its own resources unless the user is logged in. WTH. I’m only having this problem on my local VS server; it seems to work fine when I put it on the live server (woot). Anyone know why this is happening?
Here is a portion of my login page that is requesting the image/css:
...
<head runat="server">
<link rel="stylesheet" type="text/css" href="styles/BodyLayout.css" />
<title>Optoma USA - Login</title>
</head>
<body>
<center>
<div style="text-align:left; width:990px; height:780px; background-color:White;">
<div id="divBody">
<form id="form1" runat="server" target="_self">
<center>
<div style="height:100px; width:600px; text-align:center;">
<img src="images/Optoma_Logo.gif" alt="Unable to display image." />
</div>
</center>
...
also, here is my authorization code in web.config:
<authentication mode="Forms">
<forms loginUrl="~/index.aspx" name="adAuthCookie" path="/">
</forms>
</authentication>
<!--<authorization>:-->
<authorization>
<!-- <deny>: will deny all users and redirect to login page,
unless they are properly authenticated-->
<deny users="?"/>
<!--<allow>: might be configured later. probably will not need-->
<allow users="*"/>
</authorization>
I think your web.config contains
This means users cannot load anything other than the login page — but not its images, stylesheets, etc. You can merge the following into web.config to make an exception for images, for example: