Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > asp:login w/ ASP.NET 2.0 -- still can't get basic login page to work

Reply
Thread Tools

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

 
 
Sasquatch
Guest
Posts: n/a
 
      10-04-2006
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

 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      10-04-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
 
 
 
Sasquatch
Guest
Posts: n/a
 
      10-04-2006
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
login page stays on login page Shannon ASP .Net 2 01-09-2008 10:51 PM
Login page with Basic authentication (newbie) Steven K0 ASP .Net Security 1 04-10-2005 02:45 AM
Using Form based Authenication and still getting redirected back to the login page Irishmaninusa ASP .Net Security 0 09-23-2004 03:02 PM
Strange problem with Forms authentication: After successfull login, login page is still displayed Pascal Blanchard ASP .Net Security 1 08-18-2004 08:36 AM
Strange problem with Forms authentication: After successfull login, login page is still displayed Pascal Blanchard ASP .Net Security 0 08-17-2004 06:26 PM



Advertisments