Hi guys,
Recently I bought Pro ASP.net. I am studying forms authentication. Please help me if anyone can solve this problem , i copied exactly code from book to my website for web.config:
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="MyApp" path="/" loginUrl="login.aspx"
protection="All" timeout="10">
<credentials passwordFormat="Clear">
<user name="billjones" password="test" />
<user name="marthasmith" password="test" />
<user name="joesoap" password="test" />
</credentials>
</forms>
</authentication>
<authorization>
<allow users="billjones,marthasmith,joesoap" />
<deny users="?" />
</authorization>
</system.web>
</configuration>
and login.aspx below
<%@Page Language="
VB" %>
<html>
<head>
<title>Login Form</title>
<style type="text/css">
body, input {font-family:Tahoma,Arial,sans-serif; font-size:10pt }
</style>
</head>
<body>
<form runat="server">
UserName: <input id="txtUsr" type="text" runat="server" /><p />
Password: <input id="txtPwd" type="password" runat="server" /><p />
<ASP:CheckBox id="chkPersist" runat="server" />
Remember my credentials<p />
<input type="submit" value="Login" runat="server" onserverclick="DoLogin" /><p />
<div id="outMessage" runat="server" />
</form>
</body>
</html>
<script language="
VB" runat="server">
Sub DoLogin(objSender As Object, objArgs As EventArgs)
If FormsAuthentication.Authenticate(txtUsr.Value, txtPwd.Value) Then
FormsAuthentication.RedirectFromLoginPage(txtUsr.V alue, chkPersist.Checked)
Else
outMessage.InnerHtml = "<b>Invalid credentials</b> please re-enter..."
End If
End Sub
</script>
after i use username and password to logon my secure page. there alway has some "!!" followed my others.aspx pages.I can't figure out what's wrong with these code. Thanks all