Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Authenticates but won't log in

Posted on 2012-09-13
18
Medium Priority
?
613 Views
Last Modified: 2012-09-17
I've been working on a project for some time and its been functional pretty much.  Suddenly I cannot log in using the membership provider.  It authenticates via

 If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then
            FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, ckRemember.Checked)
end if

But the user never actually logs in.  It stays stuck on the login page.  Additionally, i have a label on the header that says "welcome back [login name]" and that doesn't appear.  It's almost as if the authentication cookie isn't firing or something.

Any ideas?
0
Comment
Question by:jglazer63
  • 11
  • 6
18 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38397412
Have you tried using Fiddler (or similar) to inspect the series of redirects. You can determine whether or not you are actually getting to the next page. If you are, then something is screwy with the authentication cookie; if you don't get to the next page, then something is wrong with the redirect.
0
 

Author Comment

by:jglazer63
ID: 38397417
Not yet but the master page has an element in the programming that shows the logged in user name (if logged in) and it's not showing.  In addition it also has a loginview control that never shows the "loggedinemplate" as it would if the person actually logged in.  So the redirection test, in my mind, is not necessary, the person is just not being registered as logged in.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38397427
I doubt this will make a difference, but can you try explicitly setting the authentication cookie:

If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then
    FormsAuthentication.SetAuthCookie(txtUserName.Text, ckRemember.Checked)
    FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, ckRemember.Checked)
End If

Open in new window

0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 

Author Comment

by:jglazer63
ID: 38397431
You're right it didn't make a difference.  I did that before I posted the question here.

In the midst of a .net 4.0 update.  We'll see how that works....
0
 

Author Comment

by:jglazer63
ID: 38397434
...just finished ... no difference :-(
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38397437
What value have you set for the Forms authentication timeout value in web.config?
0
 

Author Comment

by:jglazer63
ID: 38397443
<authentication mode="Forms">
            <forms loginUrl="~/Start.aspx" timeout="2880"/>
        </authentication>
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38397450
What about the session timeout (web.config)?
0
 

Author Comment

by:jglazer63
ID: 38397455
don't have a setting.
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 1336 total points
ID: 38397473
Just covering all of the bases, but to confirm you have stepped through the code and seen that the call to the membership provider succeeds and the body of the If is entered (i.e. the redirect occurs)?
0
 

Author Comment

by:jglazer63
ID: 38397477
At this point I created a blank test.aspx file with:
        <asp:LoginName ID="LoginName1" runat="server" FormatString="Welcome, {0}" />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" />

and


    Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        If Membership.ValidateUser("myuser","mypass") Then
            FormsAuthentication.SetAuthCookie("myuser", False)
        End If
    End Sub

And the loginname never shows a value.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1336 total points
ID: 38397486
Do you have an <authorization> section set up within web.config? If so, how have you configured any <allow> or <deny> elements?
0
 

Author Comment

by:jglazer63
ID: 38397487
i do but the test.aspx page is self contained and accessible.  I don't think adjusting those sections will make a difference.  I am working strictly from test.aspx right now just to see if I can get myself logged in (bypassing the main project all together).
0
 

Author Comment

by:jglazer63
ID: 38397490
It's late I'm heading to bed.  Will start fresh tomorrow.  Maybe a re-install of the application via IIS??  I am totally at a loss as to why its suddenly not working.
0
 

Author Comment

by:jglazer63
ID: 38398398
reinstall application... no luck
0
 

Author Comment

by:jglazer63
ID: 38398469
Ok, I found a clue.

I am setting up a test web site for development of this project.  This is where the problems arrose.  The issue is the web site is at

http://myproject.com

The test web site is at

http://test.myproject.com

It seems that the auth cookie is getting confused between those two sites.  Is there some way to limit the cookie to just the tld (myproject.com)?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 664 total points
ID: 38399350
0
 

Author Closing Comment

by:jglazer63
ID: 38406656
A combination of help did the trick.  Thanks guys!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question