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

S

Sasquatch

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"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<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"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SqlServerConnectionString"
connectionString="server=.\SQLEXPRESS;database=maindb;User
ID=mainuser;Password=password;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.net>
<mailSettings>
<smtp>
<network
host="smtp.ourmailserver.net"
port="25" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<compilation debug="false"/>
<authentication mode="Forms"/>
<customErrors mode="Off"/>
</system.web>
</configuration>

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

Thanks,
John
 
M

Mark Fitzpatrick

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).
 
S

Sasquatch

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top