CSS not working! Please help.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've been having alot of problems with asp.net 2.0's style sheet. When I
apply a style sheet to a webform in the head tag (<link href="Site5.css" rel
="stylesheet" type ="text/css" runat="server" />), the webform does reflect
the styles in design mode, but not when I run the project. Sometimes it does,
sometimes it doesn't. Very frustrating. Right now I'm looking at my webform
in design mode, it has the look of the styles in my .css. But hit F5, and the
styles disappear.

It also seems that if you make too many changes in a css file, the styles no
longer appear in your webform. I have to create a site2.css, copy what was in
site1.css into it, and it will work, for a while. Then a site3.css, etc.

Has anyone else experienced this, and what have you done to correct it?
 
Richard said:
I've been having alot of problems with asp.net 2.0's style sheet. When I
apply a style sheet to a webform in the head tag (<link href="Site5.css" rel
="stylesheet" type ="text/css" runat="server" />), the webform does reflect
the styles in design mode, but not when I run the project. Sometimes it does,
sometimes it doesn't. Very frustrating. Right now I'm looking at my webform
in design mode, it has the look of the styles in my .css. But hit F5, and the
styles disappear.

It also seems that if you make too many changes in a css file, the styles no
longer appear in your webform. I have to create a site2.css, copy what was in
site1.css into it, and it will work, for a while. Then a site3.css, etc.

Has anyone else experienced this, and what have you done to correct it?

Haven't had issues like this (and I've been using .NET 2.0 since beta
1). Perhaps you can try with a different browser or see with a debugging
proxy what's actually happening... We can't really see why you're having
problems without the source.
 
In the "Troubleshooting the ASP.NET Development Server" topic in the VS2005
documentation, it states:
"In a file-system Web site, static files, such as images and style sheets,
are subject to ASP.NET authorization rules. For example, static files in a
file-system Web site will not be served to an anonymous user when anonymous
access to those files is disabled. However, when you deploy the Web site to a
server running IIS, IIS will serve the static files without using
authorization rules."

So, that is the problem. My app denies anonymous users because it is login
based. Once I login to the app, and go back a page, the styles are there.

I think it is very unfortunate that I have to put an exception in my
web.config file just to see my styles appear correctly in the built-in dev
server.
 
Back
Top