473,725 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp:login w/ ASP.NET 2.0 -- still can't get basic login page to work

I'm still 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. I've got a little better troubleshooting
information for everyone now. First, here's how I set this stuff up...

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#" %>
<html>
<body>
Content page!
</body>
</html>

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

<%@ Page Language="C#" %>
<html>
<body>
<form runat="server">
<asp:Login ID="Login1" runat="server"> </asp:Login>
</form>
</body>
</html>

....and 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="myuser" />
<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=password; "
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>
<system.net>
<mailSettings >
<smtp>
<network
host="smtp.ourm ailserver.net"
port="25" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<compilation debug="false"/>
<authenticati on mode="Forms"/>
<customErrors mode="Off"/>
</system.web>
</configuration>

....that's it. Any assistance would be greatly appreciated.

Thanks,
John

Oct 4 '06 #1
2 2458
Where is that connection pointing? Is there a database there? If this is an
exact copy of the web.config, it looks like you haven't adjusted the
connection string to point directly to the database (it should be an mdf
file as this is a SqlServer connection).
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Sasquatch" <li*******@yaho o.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
I'm still 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. I've got a little better troubleshooting
information for everyone now. First, here's how I set this stuff up...

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#" %>
<html>
<body>
Content page!
</body>
</html>

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

<%@ Page Language="C#" %>
<html>
<body>
<form runat="server">
<asp:Login ID="Login1" runat="server"> </asp:Login>
</form>
</body>
</html>

...and 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="myuser" />
<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=password; "
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>
<system.net>
<mailSettings >
<smtp>
<network
host="smtp.ourm ailserver.net"
port="25" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<compilation debug="false"/>
<authenticati on mode="Forms"/>
<customErrors mode="Off"/>
</system.web>
</configuration>

...that's it. Any assistance would be greatly appreciated.

Thanks,
John

Oct 4 '06 #2
I thought the connection was assumed. I thought there was a default
connection that is set up in machine.config for membership. Likewise,
there is an aspnetdb.mdf file in the /app_data folder that contains the
users I set up, passwords hashed, etc. I thought the asp:control would
just know to look there by default. If not, what do I need to add to
my web.config? Can you send me an example? Thanks! -John

Mark Fitzpatrick wrote:
Where is that connection pointing? Is there a database there? If this is an
exact copy of the web.config, it looks like you haven't adjusted the
connection string to point directly to the database (it should be an mdf
file as this is a SqlServer connection).
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Sasquatch" <li*******@yaho o.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
I'm still 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. I've got a little better troubleshooting
information for everyone now. First, here's how I set this stuff up...

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#" %>
<html>
<body>
Content page!
</body>
</html>

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

<%@ Page Language="C#" %>
<html>
<body>
<form runat="server">
<asp:Login ID="Login1" runat="server"> </asp:Login>
</form>
</body>
</html>

...and 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="myuser" />
<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=password; "
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>
<system.net>
<mailSettings >
<smtp>
<network
host="smtp.ourm ailserver.net"
port="25" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<compilation debug="false"/>
<authenticati on mode="Forms"/>
<customErrors mode="Off"/>
</system.web>
</configuration>

...that's it. Any assistance would be greatly appreciated.

Thanks,
John
Oct 4 '06 #3

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

Similar topics

8
9853
by: mo | last post by:
Sorry I can't be more specific, but.... I'd like to create a secure login from an ASP page to a specific SQL Server 2000 Db. Is there an accepted methodology for doing this? Are there any resourses that show how this can be done? Thanks for any help. Mo
3
1563
by: Archie Campbell | last post by:
Most people cancel the "allow anonymous user" and IIS will automatically popup the user login dialog. Not me. I want anonymous users to be able to do somethings. Then, if they want to do more, they can to go to a "login page". This used to be my own ASP page. Now I dont want that. Instead I want the Windows login dialog to popup. How do I do that. How do I in my ASP page cause the Windows Login dialog to popup.
1
5506
by: Wayne Smith | last post by:
Applies to: Microsoft FrontPage 2000, Microsoft Access 2000, IIS 5.0 Operating System: Microsoft Windows 2000 Professional I am trying to protect a portion of a web site by allowing users to register a username and password & then login with those details, but so far I am having only marginal success. I am far from an expert on ASP programming, indeed the code I am using comes from "Sams Teach Yourself E-Commerce Programming with ASP" but it...
4
3377
by: R.A.M. | last post by:
I have a problem with logging in implementation in ASP.NET 2.0. I decided to use asp:Login control (which is enough), but I cannot find solution for handling logging in. I have an .aspx: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="DefaultPage" %> .... <form id="LoginForm" method="post" action="Menu.aspx" style="vertical-align: middle;" runat="server">
5
2017
by: R.A.M. | last post by:
Hello Could you help a beginner with login implementation using asp:Login (.NET 2.0). I have in Web.config: <authentication mode="Forms"> <forms name="Demo.NET" loginUrl="Default.aspx" /> </authentication> <authorization> <allow users="demo"/> <deny users="*"/>
2
4241
by: Sasquatch | last post by:
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...
3
6390
by: HeatherBMI | last post by:
I've been searching for a way to test this control with my NUnitASP tests for awhile now and have yet to come up with anything. I have all of my tests written, but until I can get past the initial login page, all my tests fail. Here is some of the login page code: <asp:Login ID="Login1" runat="server" Height="134px" OnAuthenticate="Login1_Authenticate" OnLoginError="OnLoginError" Width="336px" CreateUserText="Create a...
3
4336
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
The majority of pages on our site need authentication (forms auth against the aspnetdb database). I created an '~/auth' folder with its own config file forcing authentication for any pages in the folder. The default.aspx sits in the root folder and just does a Response.Redirect to an ~/auth/home.aspx page. The config forces authentication, which is carried out by ~/pub/login.aspx which has a standard asp:login control. I set up the...
3
1914
by: jerrydigital | last post by:
Hello, I have created a login.asp page which i have posted below. When I login into my site, it automatically takes me to the redirect page "index.html" which means that i entered the wrong login information. I believe i am not connecting to the access table correctly. Here are some of the characters I used(hope this helps clear up my asp page) Email --- this is the title to the login column in my access table Password --- password...
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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
4517
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...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.