Relegence
asked on
Login page looses styling when using forms authentication method
Hello,
I am writing a c# asp.net 2.0 application and using the forms authentication method for authentication.
A strange thing is happening - The authentication tag in web.config redirects to Login.aspx page.
This works fine, but when the Login page appears, it appears without the style, even though it is attached to a stylesheet.
when I open the Login page independently, it does have all the styling.
Why does it happen?
I am writing a c# asp.net 2.0 application and using the forms authentication method for authentication.
A strange thing is happening - The authentication tag in web.config redirects to Login.aspx page.
This works fine, but when the Login page appears, it appears without the style, even though it is attached to a stylesheet.
when I open the Login page independently, it does have all the styling.
Why does it happen?
When you say, "though it is attached to a stylesheet", are you sure it is attached. Have you checked the HTML code to verify that?
Can you paste the code that loads the stylesheet? And maybe a description of the paths of each file (i.e. stylesheet.css, login.aspx, etc).
You probably will only see this while debugging your application - e.g. when it runs within it's own webserver. This is because all file-types are handled by the asp.net proces and thus passes the settings of the web.config.
If you want it to work you would need to give everybody access to the include files, same way as you would give access (or deny access) to any of your other pages / folders.
If you want it to work you would need to give everybody access to the include files, same way as you would give access (or deny access) to any of your other pages / folders.
ASKER
Here is the relevant code;
In the web.config file;
<authentication mode="Forms">
<forms name="AOLTickerToolCookie"
</forms>
</authentication>
In DoLogin.aspx page:
<link href="Style.css" rel="Stylesheet" type="text/css" />
I've checked the source and it seems that the Login file is attached to the stylesheet correctly
ASKER
CJ S - How do I give access to the include files?
<location path="css">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
Put that outside the <system.web> directive - not inside.
ASKER
thanks - I'll try and let you know if it worked
ASKER
I am afraid it didn't help. I put it under <configuration>, is that ok?
Strange - maybe a clientside caching issue then?
does it work if you put the styles in the login page between the head tags?
ASKER
Yes, It works if I pit the style between the head tags.
But, another problem, related to the previous one, still happens - I have an imageButton which isn't displayed.
Something is wrong with the paths...
But, another problem, related to the previous one, still happens - I have an imageButton which isn't displayed.
Something is wrong with the paths...
all paths in the CSS are relative to where the CSS is.
in the head tags it would be relative to to where the page is.
in the css folder, the path to images in an 'images' folder at the same level as the 'css' folder would be -> ../images/myimage.gif
in the head tags it would be relative to to where the page is.
in the css folder, the path to images in an 'images' folder at the same level as the 'css' folder would be -> ../images/myimage.gif
ASKER
I know that paths are relative to where the css is.
The strange thing is that I've done this so many times before (this is a basic) and here it just doesn't work.
Since I'm calling the Login page using "authentication" in my web.config file, I think it is related to this somehow.
The strange thing is that I've done this so many times before (this is a basic) and here it just doesn't work.
Since I'm calling the Login page using "authentication" in my web.config file, I think it is related to this somehow.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.