Question

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.

Was it helpful?

Solution 2

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)

OTHER TIPS

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

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.

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

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

You are looking for background-color.

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">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top