473,725 Members | 2,118 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.mast er" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentH ead"
Runat="Server">
<title>Main Page</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentM ain"
Runat="Server">
This is a page with content!
</asp:Content>

....and here is my code for login.aspx...

<%@ Page Language="C#" MasterPageFile= "~/MasterMain.mast er" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentH ead"
Runat="Server">
<title>Log In</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentM ain"
Runat="Server">
<div id="WebResource s">
<div class="BoxTop">
<h1>Intranet Log In</h1>
</div>
<div class="BoxBotto m" style="text-align: center;">
<asp:Login ID="Login1" runat="server"> </asp:Login>
</div>
</div>
</asp:Content>

....and here is the code for MasterMain.mast er...

<%@ Master Language="C#" %>
<script runat="server">
protected void Page_Load(Objec t Src, EventArgs E)
{
// ADD HEADER FOR P3P PRIVACY COMPLIANCE

Response.AddHea der("P3P","poli cyref=\"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.dt d">
<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+CL TPK4mfkrCVRYbqn ZLFzetUkCTbticD bHaHzHE=" />
<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:ContentPla ceHolder ID="ContentHead "
runat="server"> </asp:ContentPlac eHolder>
</head>
<body>
<form runat="server">
<asp:ContentPla ceHolder ID="ContentMain "
runat="server"> </asp:ContentPlac eHolder>
</form>
</body>
</html>

Somebody please help. This is very frustrating.

Thanks!!!

Oct 3 '06 #1
2 4241
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*******@yaho o.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.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.mast er" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentH ead"
Runat="Server">
<title>Main Page</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentM ain"
Runat="Server">
This is a page with content!
</asp:Content>

...and here is my code for login.aspx...

<%@ Page Language="C#" MasterPageFile= "~/MasterMain.mast er" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentH ead"
Runat="Server">
<title>Log In</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentM ain"
Runat="Server">
<div id="WebResource s">
<div class="BoxTop">
<h1>Intranet Log In</h1>
</div>
<div class="BoxBotto m" style="text-align: center;">
<asp:Login ID="Login1" runat="server"> </asp:Login>
</div>
</div>
</asp:Content>

...and here is the code for MasterMain.mast er...

<%@ Master Language="C#" %>
<script runat="server">
protected void Page_Load(Objec t Src, EventArgs E)
{
// ADD HEADER FOR P3P PRIVACY COMPLIANCE

Response.AddHea der("P3P","poli cyref=\"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.dt d">
<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+CL TPK4mfkrCVRYbqn ZLFzetUkCTbticD bHaHzHE=" />
<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:ContentPla ceHolder ID="ContentHead "
runat="server"> </asp:ContentPlac eHolder>
</head>
<body>
<form runat="server">
<asp:ContentPla ceHolder ID="ContentMain "
runat="server"> </asp:ContentPlac eHolder>
</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"?>
<configuratio n
xmlns="http://schemas.microso ft.com/.NetConfigurati on/v2.0">
<system.web>
<authorizatio n>
<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"?>
<configuratio n
xmlns="http://schemas.microso ft.com/.NetConfigurati on/v2.0">
<connectionStri ngs>
<add name="SqlServer ConnectionStrin g"
connectionStrin g="server=.\SQL EXPRESS;databas e=maindb;User
ID=mainuser;Pas sword=mainpassw ord;"
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>
<system.net>
<mailSettings >
<smtp>
<network
host="smtp.myma ilserver.com"
port="25" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<compilation debug="false"/>
<authenticati on 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
2536
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 When the user login the username and password in http://server1/login.asp, and clic submit button, it will go to http://server1/page1.asp if the username/password are correct In http://server1/page1.asp, there are links to go to...
0
1110
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 field's value I have a public property that is set from a repeater's itemdatabound event. In the ItemDataBound Sub, I use something like the following where the datasource column name is always the same as the form's property name: ...
3
3059
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
3071
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 server technology with Microsoft access as my database source. Just as I have introduced myself, I’m a newbie in web application development. I’m currently working on an application that will allow
0
1223
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 Directory Of Tomcat.when I Submit My Form With Id And Pwd .then The Jsp Page Will Be Called And Values Are Transfered By Get,set Property If I Am Usuing Java Beans.then After Mapping In Struts.config File The Corresponding .class File Will Be Called...
10
14301
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 planning to use VB2005 or C#. I look the help files and searched on the web, I cannot find the answer. Is this possble in ASP.NET 2.0? Thanks
3
6687
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 plzzzzzzzzzzzz Thanking u Regards, Deepshika
1
1187
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 know there is a login control available in asp.net, however, I am not sure how all my requirements can tie up together with this new control. Besides, depending on the role, certain pages are availabe to certain role. Please advice. Thanks in...
4
2305
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 or where I can find some usefull information ? Thanx
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8097
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2157
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.