我将授权标记添加到web.config时出现登录页面设计问题 [英] Login page design issue when i add authorization tag into web.config
本文介绍了我将授权标记添加到web.config时出现登录页面设计问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设计了一个登录页面,当我在web.config文件中添加授权标签时,总设计会改变,就像图像和图标没有出现一样。
i我正在使用此代码进行授权
< 身份验证 mode = Forms >
< 表单 loginUrl = LoginPage.aspx timeout = 2880 / >
< / authentication >
< 授权 >
< 拒绝 用户 = ? / >
< allow 用户 = * / >
< / authorization >
请与我分享任何想法。
请查看我的登录页面aspx代码:
< asp:内容 ID = Content1 ContentPlaceHolderID = head runat = 服务器 >
< link href = 样式/ LOUPeStyles.css rel = 样式表 type = text / css / >
< link href = CSS / bootstrap.css rel = stylesheet type = text / css / >
< link href = CSS / bootstrap-responsive.css rel = stylesheet type = text / css / >
< 样式 类型 = text / css >
html , body {
background-color : #eee;
}
正文 {
padding-top : 80px;
}
。 container {
width : 250px;
}
。容器 > 。 contentt {
background-color : #fff;
padding : 0 0 12px;
margin : 250px -40px;
- webkit-border-radius : 10px 10px 10px 10px;
- moz-border-radius : 10px 10px 10px 10px;
border-radius : 10px 10px 10 px 10px;
- webkit-box-shadow : 0 1px 2px rgba(0,0,0,.15);
- moz-box-shadow < span class =code-keyword>: 0 1px 2px rgba(0,0,0,.15);
box-shadow : 0 1px 2px rgba(0,0,0, .15);
}
。 contentt 。 form-signin-heading
{
margin-bottom : 20px;
background-color : #0082AA;
font-family : Arial,Helvetica,sans-serif;
font-size : 14pt;
color : #FFFFFF;
font-weight : 正常;
text -indent : 20px;
}
。 login-form {
margin-left : 40px;
}
# ContentPlaceHolder1_btnlogin {
margin-top : -30px;
margin-left : 186px;
}
< / style >
< / asp:Content >
< asp:内容 ID = Content3 ContentPlaceHolderID = ContentPlaceHolder1 runat = server >
< ; div class < span class =code-keyword> = container >
< div class = contentt >
< h2 class = form-signin-heading > 登录< / h2 >
< asp:标签 ID = lblmsg runat = server > < / asp:Label >
< div class = login-form >
< div class = input-prepend >
< span class = 插件 > < / span >
< asp:TextBox ID = txtusername runat = server 占位符 = Domain\Username > < / asp:TextBox >
< / div >
< asp:RequiredFieldValidator ID = rfvUser
ControlToValidate = txtusername runat = server ForeColor = #CC3300 ValidationGroup = 验证 ErrorMessage = 请输入用户名 EnableClientScript = false / >
< div class = 输入前置 >
< span class = 附加组件 >
< / span >
< asp:TextBox ID = txtpassword runat = server
占位符 = 密码 TextMode = 密码 > < / asp:TextBox >
& / div >
< asp:RequiredFieldValidator ID = rfvPWD runat = server
ControlToValidate = txtpassword ErrorMessage = 请输入密码
< span class =code-attribute> ForeColor = #CC3300 ValidationGroup = 验证 EnableClientScript = false / >
< label class = 复选框 >
< asp:CheckBox ID = rememberchecked runat = 服务器 文字 = 让我登录 < span class =code-attribute> / >
< / label >
< asp:按钮 ID = btnlogin runat = server 文字 = 登录
< span class =code-attribute> CssClass = btn btn-primary onclick = btnlogin_Click / >
< / div >
< / div >
< / div > <! - / container - > ;
< / asp:内容 >
解决方案
你需要以这种方式在web.config中添加样式和图像的文件夹位置:
< location 路径 = CSS >
< system.web >
< 授权 >
< allow users = * / >
< / authorization >
< / system.web>
< / location >
这允许用户在未经过身份验证的情况下获取这些文件
I designed one Login Page when i add authorization tag into web.config file the total design would changed like images and icons are not appeared.
i am using this code for authorization
<authentication mode="Forms">
<forms loginUrl="LoginPage.aspx" timeout="2880" />
</authentication>
<authorization>
<deny users="?"/>
<allow users = "*"/>
</authorization>
Please share any idea to me.
Please check my login page aspx code:
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="Styles/LOUPeStyles.css" rel="stylesheet" type="text/css" />
<link href="CSS/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="CSS/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<style type="text/css">
html, body {
background-color: #eee;
}
body {
padding-top: 80px;
}
.container {
width: 250px;
}
.container > .contentt {
background-color: #fff;
padding: 0 0 12px;
margin: 250px -40px;
-webkit-border-radius: 10px 10px 10px 10px;
-moz-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.contentt .form-signin-heading
{
margin-bottom: 20px;
background-color: #0082AA;
font-family: Arial, Helvetica, sans-serif;
font-size: 14pt;
color: #FFFFFF;
font-weight: normal;
text-indent: 20px;
}
.login-form {
margin-left: 40px;
}
#ContentPlaceHolder1_btnlogin {
margin-top: -30px;
margin-left: 186px;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="container">
<div class="contentt">
<h2 class="form-signin-heading">Sign in </h2>
<asp:Label ID="lblmsg" runat="server"></asp:Label>
<div class="login-form">
<div class="input-prepend">
<span class="add-on"></span>
<asp:TextBox ID="txtusername" runat="server" placeholder="Domain\Username" ></asp:TextBox>
</div>
<asp:RequiredFieldValidator ID="rfvUser"
ControlToValidate="txtusername" runat="server" ForeColor="#CC3300" ValidationGroup="validate" ErrorMessage="Please enter Username" EnableClientScript="false" />
<div class="input-prepend">
<span class="add-on">
</span>
<asp:TextBox ID="txtpassword" runat="server"
placeholder="Password" TextMode="Password"></asp:TextBox>
</div>
<asp:RequiredFieldValidator ID="rfvPWD" runat="server"
ControlToValidate="txtpassword" ErrorMessage="Please enter Password"
ForeColor="#CC3300" ValidationGroup="validate" EnableClientScript="false" />
<label class="checkbox">
<asp:CheckBox ID="rememberchecked" runat="server" Text="Keep me signed in" />
</label>
<asp:Button ID="btnlogin" runat="server" Text="Login"
CssClass="btn btn-primary" onclick="btnlogin_Click" />
</div>
</div>
</div> <!-- /container -->
</asp:Content>
解决方案
Your need to add the folder location where you have the styles and images inside web.config on this way:
<location path="CSS"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location>
This allows the user get those files without being authenticated.
这篇关于我将授权标记添加到web.config时出现登录页面设计问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文