Ask a Question related to ASP.NET Security, Design and Development.
-
bebop #1
Forms-based Authentication
HI
I'm using Forms-based Authentication and trying out the
example from the book: "ASP.NET Professional Secrets"
after downloading the c# code there was no code for
chapter 15
Can anyone provide the code for chapter 15 and what it
includes?
I tried entering the code from the chapter by hand but I
can't get the program to work.
code from book:
<%@ Page language="C#"%>
<script runat = "server">
void btnLogin_Click(Object sender, EventArgs e) {
if (txtUserName.Value == "User" &&
txtPassword.Value == "Password")
{
FormsAuthentication.RedirectFromLoginPage
(txtUserName.Value, chkSaveCookie.Checked);
}
else
{
divMessage.InnerText = "Invalid user name or
password";
}
}
</script>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<form id="frmLogin" method="post" runat="server">
User Name: <input type="text" id="txtUserName"
name="txtUserName" runat="server">
</p>
Password: <input type="password" name="txtPassword"
id="txtPassword" runat="server">
<p/>
<input type="checkbox" name="chkSaveCookie"
id="chkSaveCookie" runat="server">Save my state
<p/>
<input type="button" name="btnLogin" runat="server"
onserverclick="btnLogin_Click" value="Login">
<p/>
<div runat="server" id="divMessage"></div>
</form>
</body>
</html>
also books mentions to do the following in the Web.Config
file:
set the mode attribute to Forms and provide a loginUrl
<authentication mode="Forms">
<forms name="WileyAuth" loginUrl="LoginPage.aspx"
path="/"> </forms>
and add a location element as well:
<location path="ProtectedPage.aspx">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
Any help on Forms-based Authentication would be
appreciated.
bebop
bebop Guest
-
Role based Forms Authentication
Before I start I must point out that this does work on my local Windows XP machine but does not work on a Windows 2003 Server. I have created a... -
Forms Authentication based on roles.
HI, I have the following problem. I am making a portal of DJs. The djs must have a Menu, the administrator another menu. I created 2 directories... -
Forms Based Authentication - Groups
What example are you talking about? It doesn't appear in the newsgroup where you posted. Joe K. "cathie corcoran via .NET 247"... -
Forms-based authentication expires before timeout
Hi, I'm having a problem with the forms-based authentication. The user is getting timed out before long before the timeout period has passed.... -
Forms based authentication pointing at a different URL
Everyone, I have a question about forms based authentication. Can the loginURL point at a different server than the current one? Example: A...



Reply With Quote

