我是用dreamweaver编写的!这些代码,我都是照着书上输入的,但就不知道是什么原因,还请大家帮帮忙!
以下是出错的提示:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The 'user' start tag on line '7' doesn't match the end tag of 'credentials' in file 'file:///E:/web/test/web.config'. Line 8, position 6. Source Error:
Line 6: <user name="ron" password="AB54B7H109AE41F0">
Line 7: <user name="scott" password="0f14AE901H7b45BA">
Line 8: </credentials>
Line 9: </forms>
Line 10: </authentication>
有三个文件,文件名和代码都在下面
web.config
<configuration>
<system.web>
<authentication mode="forms">
<forms name=".aspxauth" loginurl="/login.aspx" protection="encryption">
<credentials paswordformat="sha1">
<user name="ron" password="AB54B7H109AE41F0">
<user name="scott" password="0f14AE901H7b45BA">
</credentials>
</forms>
</authentication>
<authorization>
<allow users="ron,scott"/>
<deny user="*"/>
</authorization>
</system.web>
</configuration>
login.aspx
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.Security" %>
<script language="vb" runat="server">
public sub loginbutton_onclick(sender as object, e as eventargs)
if formsauthentication.authenticate(username.text,password.text) then
formsauthentication.redirectfromloginpage(username.text,persist.checked)
else
errorlabel.text="invalid username/password combination"
end if
end sub
</script>
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><asp:Label ID="errorlabel" runat="server"></asp:Label> <p>username:<asp:TextBox ID="username" runat="server" TextMode="SingleLine" /></p>
<p>password:<asp:TextBox ID="password" runat="server" TextMode="Password" /></p>
<p><asp:CheckBox ID="persist" runat="server" Text="keep me logged in between browser restarts" /> </p>
<p><asp:LinkButton ID="loginbutton" runat="server" Text="log in" OnClick="loginbutton_onclick"></asp:LinkButton> </p>
</body>
</html>
default.aspx
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.Security" %>
<script language="vb" runat="server">
public sub signoutbutton_onclick(sender as object,e as eventargs)
formsauthentication.signout()
response.Redirect("/login.aspx")
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<p>WELCOME</p>
<p>this is a secure page.</p>
<p><asp:LinkButton ID="signoutbutton" runat="server" Text="sign out" OnClick="signoutbutton_onclick"></asp:LinkButton> </p>
</body>
</html>
以下是出错的提示:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The 'user' start tag on line '7' doesn't match the end tag of 'credentials' in file 'file:///E:/web/test/web.config'. Line 8, position 6. Source Error:
Line 6: <user name="ron" password="AB54B7H109AE41F0">
Line 7: <user name="scott" password="0f14AE901H7b45BA">
Line 8: </credentials>
Line 9: </forms>
Line 10: </authentication>
有三个文件,文件名和代码都在下面
web.config
<configuration>
<system.web>
<authentication mode="forms">
<forms name=".aspxauth" loginurl="/login.aspx" protection="encryption">
<credentials paswordformat="sha1">
<user name="ron" password="AB54B7H109AE41F0">
<user name="scott" password="0f14AE901H7b45BA">
</credentials>
</forms>
</authentication>
<authorization>
<allow users="ron,scott"/>
<deny user="*"/>
</authorization>
</system.web>
</configuration>
login.aspx
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.Security" %>
<script language="vb" runat="server">
public sub loginbutton_onclick(sender as object, e as eventargs)
if formsauthentication.authenticate(username.text,password.text) then
formsauthentication.redirectfromloginpage(username.text,persist.checked)
else
errorlabel.text="invalid username/password combination"
end if
end sub
</script>
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><asp:Label ID="errorlabel" runat="server"></asp:Label> <p>username:<asp:TextBox ID="username" runat="server" TextMode="SingleLine" /></p>
<p>password:<asp:TextBox ID="password" runat="server" TextMode="Password" /></p>
<p><asp:CheckBox ID="persist" runat="server" Text="keep me logged in between browser restarts" /> </p>
<p><asp:LinkButton ID="loginbutton" runat="server" Text="log in" OnClick="loginbutton_onclick"></asp:LinkButton> </p>
</body>
</html>
default.aspx
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.Security" %>
<script language="vb" runat="server">
public sub signoutbutton_onclick(sender as object,e as eventargs)
formsauthentication.signout()
response.Redirect("/login.aspx")
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<p>WELCOME</p>
<p>this is a secure page.</p>
<p><asp:LinkButton ID="signoutbutton" runat="server" Text="sign out" OnClick="signoutbutton_onclick"></asp:LinkButton> </p>
</body>
</html>
解决方案 »
- 文件下载的iis路径取得
- 怎么做 无限分级类导出到XML文件?
- 文件上传怎样把文件名命名日期时间组成的文件名?
- 为什么连接不到别台的sql server?
- WebGrid排序问题,解决后马上结贴!----在线等。
- toolbar控件响应click事件?
- 怎样在DATAGRID中再增加一行合计?
- datagrid里面AutoGenerateColumns="true"或着不设AutoGenerateColumns,怎么加超级链接。
- MCAD了,散分。
- 为什么插入断点不进入if语句
- DataGrid 不能正常显示数据? 急
- 我要验证一个TextBox的内容不能为空 为什么 CompareValidator 验证控件做不到?
==>
Line 6: <user name="ron" password="AB54B7H109AE41F0"/> xml文件要求比html严格,“/>”是tag结束的规范
<user name="ron" password="AB54B7H109AE41F0">
<user name="scott" password="0f14AE901H7b45BA">
都没有结束标记
现又有一个新的错误发生了分析器错误信息: 无法识别的属性“LoginUrl”。源错误:
行 2: <system.web>
行 3: <authentication mode="Forms">
行 4: <forms name=".ASPXAUTH" LoginUrl="/login.aspx" Protection="Encryption">
行 5: <credentials passwordformat="clear">
行 6: <user name="Ron" password="AB54B7H109AE41F0" />
完事后,一起加分!
<forms loginUrl="login.aspx"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
仅供参考!!