Reputation: 4623
I am using VS2005 C#.
I have a login page which uses a background image from the CSS.
After I have modified my web.config to cater for AD authentication, the background image does not show anymore.
I am able to see the background image when viewed in source, but when the login page is viewed in browser, the background is plain white.
Below is the code snippet of my Login.aspx, loginCSS.css and Web.config:
Login.aspx:
<head runat="server"><link rel="stylesheet" type="text/css" href="loginCSS.css" />
<title>Login</title>
<script language="javascript" type="text/javascript">
</script>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<asp:Login ID="Login1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8"
BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
Font-Size="Small" ForeColor="#333333" Height="130px"
Width="303px">
<TextBoxStyle Font-Size="Small" />
<LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" />
<InstructionTextStyle Font-Italic="True" ForeColor="Black" />
<TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="Small"
ForeColor="White" />
</asp:Login>
</div>
</form>
</body>
</html>
LoginCSS.css
body
{
background-image:url('images/loginbackground.png');
background-repeat:no-repeat;
background-attachment:fixed;
}
Web.config:
<authentication mode="Forms">
<forms name=".ADAuthCookie" timeout="10" loginUrl="Login.aspx" defaultUrl="~/Common/Default.aspx">
</forms>
</authentication>
May I know what went wrong? Is there a better way to display a background image in my login form?
Upvotes: 1
Views: 1327
Reputation: 8293
Sounds like you might be requiring authentication for your CSS or image files.
Try adding
<location path="images">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="loginCss.css">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
which would give you anyone permission to retrieve your css/images without having to login
Upvotes: 4