473,508 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't create simple login page using asp:login control

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+CLTPK4mfkrCVRYbqnZLFzetUkCTbticDbHaHz HE=" />
<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!!!

Oct 3 '06 #1
2 4210
Do you have this hooked up to a database (ASP.NET configuration?). I ran
through the code, but I do not see it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"Sasquatch" <li*******@yahoo.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
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+CLTPK4mfkrCVRYbqnZLFzetUkCTbticDbHaHz HE=" />
<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!!!

Oct 3 '06 #2
Cowboy (Gregory A. Beamer) wrote:
Do you have this hooked up to a database (ASP.NET configuration?). I ran
through the code, but I do not see it.
What do you mean? I don't think so. I have a connection string in the
web.config for the root application, but this application does not
connect to a database. My understanding is that it is using the
/testlogin/App_Data/ASPNETDB.MDF file, although I have no idea how it
is supposed to know that. I just know that, when I add users using the
ASP.NET Configuration wizard, they get added to the aspnet_Users table
in the ASPNETDB.MDF database. But, like I said, I have no idea how
login.aspx is expected to know to look there. I assumed it's some sort
of default.

Here's a copy of the /testlogin application's web.config...

<?xml version="1.0" encoding="utf-8"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow users="intranet" />
<deny users="?" />
</authorization>
</system.web>
</configuration>

....and here's a copy of the website's root web.config file...

<?xml version="1.0"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SqlServerConnectionString"
connectionString="server=.\SQLEXPRESS;database=mai ndb;User
ID=mainuser;Password=mainpassword;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.net>
<mailSettings>
<smtp>
<network
host="smtp.mymailserver.com"
port="25" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<compilation debug="false"/>
<authentication mode="Forms"/>
<customErrors mode="Off"/>
</system.web>
</configuration>

....does that help? Please, any assistance is greatly appreciated!

Oct 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2523
by: Joe | last post by:
I have 3 servers server1: http://server1/login.asp, http://server1/page1.as server2: http://server2/login.asp, http://server2/page1.as server3: http://server3/login.asp, http://server3/page1.as ...
0
1099
by: news_server.nc.rr.com | last post by:
How can I create a properties collection for a user control? (or reference what's there if it already exist) I have a user control that displays an HTML table with several values. For each...
3
3037
by: mudgilgaurav | last post by:
I am very keen to learn AJAX and want to use it in my website Can anyone give me a bunch of code abt ajax and as well as tell me the flow of code
1
3045
by: xcelmind | last post by:
Hello Dev. Guru, I want to at this time introduce myself. I am Stanley Ojadovwa by name. I’m a freelance and a newbie in web application development. I’m currently using ASP as my application...
0
1217
by: parameswar | last post by:
Hi Friends I Have Worked In J2ee (struts).for Example I Am Creating A Login Page In J2ee I Have To Create A Context Directory,then I Have To Configure My Struts.config File,server.xml File In Conf...
10
14273
by: kai | last post by:
Hi, All I am trying to create a file folder for any login user, and create sub folders for the user on a web page. After the user login again, he can only sees his own folder on the Web page. I am...
3
6673
by: Ghanathe | last post by:
Hello!!! Can any one tell how to retrieve user name and other details like first name,address,contact no. and so on.... and display in welcome page after login page using c# and sql server...
1
1179
by: sweetpotatop | last post by:
I am currently using asp.net 2.0, I need a login page for my web application, but I will keep a list of users and access right of each users in a SQL database, I wonder how can this be done, as I...
4
2294
by: John Devlon | last post by:
Hi, I'm trying to create a login page using the default login controle. I also would like to use a custom Ms Acces database instead of a sql server database. Can anyone please tell me how to...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.