S
Sasquatch
I'm having trouble creating a simple login page using the asp:login
control. I followed some instructions in a WROX book, "Beginning
ASP.NET 2.0," and the instructions are very straight forward, but it
won't work for me. Here's what I did.
1. Created a new folder named "testlogin"
2. Turned that folder into an application using the IIS properties
3. Created two new web form pages, /testlogin/default.aspx and
/testlogin/login.aspx
4. In Visual Web Developer 2005 Express, I clicked the "Website" menu
and selected "ASP.NET Configuration." I used this to add a user
"myuser" and to restrict the /testlogin directory to allow myuser and
deny anonymous users.
5. In Visual Web Developer 2005 Express, I opened login.aspx and
dropped a login control onto the page.
6. Now when I try to go to /testlogin/default.aspx, I get redirected
to /testlogin/login.aspx like I would expect.
7. But when I try to log in, it always fails, giving me the default
"Your login attempt was not successful. Please try again." message.
Here is my code.
First, here is my code for default.aspx...
<%@ Page Language="C#" MasterPageFile="~/MasterMain.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHead"
Runat="Server">
<title>Main Page</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain"
Runat="Server">
This is a page with content!
</asp:Content>
....and here is my code for login.aspx...
<%@ Page Language="C#" MasterPageFile="~/MasterMain.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHead"
Runat="Server">
<title>Log In</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain"
Runat="Server">
<div id="WebResources">
<div class="BoxTop">
<h1>Intranet Log In</h1>
</div>
<div class="BoxBottom" style="text-align: center;">
<asp:Login ID="Login1" runat="server"></asp:Login>
</div>
</div>
</asp:Content>
....and here is the code for MasterMain.master...
<%@ Master Language="C#" %>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
// ADD HEADER FOR P3P PRIVACY COMPLIANCE
Response.AddHeader("P3P","policyref=\"http://www.mysite.com/w3c/p3p.xml\",
CP=\"CURa ADMa DEVa TAIa CONi TELi OUR IND DSP NON COR\"");
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="verify-v1"
content="rjt+CLTPK4mfkrCVRYbqnZLFzetUkCTbticDbHaHzHE=" />
<link href="/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="P3Pv1" href="http://www.mysite.com/w3c/p3p.xml" />
<asp:ContentPlaceHolder ID="ContentHead"
runat="server"></asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<asp:ContentPlaceHolder ID="ContentMain"
runat="server"></asp:ContentPlaceHolder>
</form>
</body>
</html>
Somebody please help. This is very frustrating.
Thanks!!!
control. I followed some instructions in a WROX book, "Beginning
ASP.NET 2.0," and the instructions are very straight forward, but it
won't work for me. Here's what I did.
1. Created a new folder named "testlogin"
2. Turned that folder into an application using the IIS properties
3. Created two new web form pages, /testlogin/default.aspx and
/testlogin/login.aspx
4. In Visual Web Developer 2005 Express, I clicked the "Website" menu
and selected "ASP.NET Configuration." I used this to add a user
"myuser" and to restrict the /testlogin directory to allow myuser and
deny anonymous users.
5. In Visual Web Developer 2005 Express, I opened login.aspx and
dropped a login control onto the page.
6. Now when I try to go to /testlogin/default.aspx, I get redirected
to /testlogin/login.aspx like I would expect.
7. But when I try to log in, it always fails, giving me the default
"Your login attempt was not successful. Please try again." message.
Here is my code.
First, here is my code for default.aspx...
<%@ Page Language="C#" MasterPageFile="~/MasterMain.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHead"
Runat="Server">
<title>Main Page</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain"
Runat="Server">
This is a page with content!
</asp:Content>
....and here is my code for login.aspx...
<%@ Page Language="C#" MasterPageFile="~/MasterMain.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHead"
Runat="Server">
<title>Log In</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain"
Runat="Server">
<div id="WebResources">
<div class="BoxTop">
<h1>Intranet Log In</h1>
</div>
<div class="BoxBottom" style="text-align: center;">
<asp:Login ID="Login1" runat="server"></asp:Login>
</div>
</div>
</asp:Content>
....and here is the code for MasterMain.master...
<%@ Master Language="C#" %>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
// ADD HEADER FOR P3P PRIVACY COMPLIANCE
Response.AddHeader("P3P","policyref=\"http://www.mysite.com/w3c/p3p.xml\",
CP=\"CURa ADMa DEVa TAIa CONi TELi OUR IND DSP NON COR\"");
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="verify-v1"
content="rjt+CLTPK4mfkrCVRYbqnZLFzetUkCTbticDbHaHzHE=" />
<link href="/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="P3Pv1" href="http://www.mysite.com/w3c/p3p.xml" />
<asp:ContentPlaceHolder ID="ContentHead"
runat="server"></asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<asp:ContentPlaceHolder ID="ContentMain"
runat="server"></asp:ContentPlaceHolder>
</form>
</body>
</html>
Somebody please help. This is very frustrating.
Thanks!!!