By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,967 Members | 1,596 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,967 IT Pros & Developers. It's quick & easy.

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

P: n/a
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=mai ndb;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

Oct 4 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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*******@yahoo.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.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"?>
<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=mai ndb;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

Oct 4 '06 #2

P: n/a
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*******@yahoo.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.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"?>
<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=mai ndb;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
Oct 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.