views:

315

answers:

6

I have some styles applied to html for example

<body style="background: #C3DAF9;">

and when I use forms authentication it is ignored. If I put the style into an external .css file then it works.

This doesn't seem like normal behaviour to me.

A: 

That's weird. I've experienced this problem but the other way around: when I use external style sheets the external style sheet is the one being ignored, and only my inline CSS works.

The solution to that problem was to add permissions for the folder where the external CSS file resides.

One suggestion: View the source of the rendered page, and check the body tag there. It is possible that the style is being overwritten somewhere with the value of the external CSS file.

Jon Limjap
Tried that and the style shows in the source so it's not being overwritten. I am using a customAuthentication httpModule which might be causing the issue. I created a blank application and there are no issues so will bring across bits until it breaks to help narrow it down. thanks
Stephen Price
A: 

Yes you should check the output html, and your browser.

If there is no style tag in your html output you could use and try:

<body bgcolor="#C3DAF9">
Hasan Tayyar BEŞİK
+1  A: 

Have you tried inspecting your HTML elements with Firebug? That should hopefully tell you what, if anything, is overriding your CSS.

Ian Oxley
A: 

Learn how to use Firebug and use it to determine what styles are applied to your page.

A: 

The background style does not take a 'color' value.

You are looking for background-color.

leppie
"background" is a valid shortcut property. See http://www.w3.org/TR/CSS21/colors.html#propdef-background
David Kolar
I stand corrected! Thanks :)
leppie
+1  A: 

Solved the problem. I'm not sure I understand why it happened but here is the offending code;

if (User.Identity.IsAuthenticated) {
    if (User.Identity is BookingIdentity) {
        BookingIdentity id = (BookingIdentity) User.Identity;

        Response.Write("<p/>UserName: " + id.Name);
    }
}

Removing the Response.Write makes everything work again. The Response.Write (which I added to check the user was logged in at same time as the forms authentication) seems to be doing something to the page render? Any ideas?

Turns out that Response.Write was the problem, it essentially aborts the rendering of the rest of the page from that point. (or words to that effect)

Stephen Price