Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2011, 12:46 PM
Registered User
 
Join Date: Oct 2011
Posts: 5
Thanks: 2
Thanked 2 Times in 2 Posts
Default Successful ASP.NET Login not recognised

I have been using the standard login/register facilities provided by VWD in a “production” environment using IIS 7.5 and .Net 4 while continuing with SQL Server Express. I installed SSMSE and attached the aspnet database and after some initial problems with the Connection String (discussed on another thread) everything was fine.

I don’t know what I may have done but "out of the blue" a login or register request continues to be honoured in that the User and Membership table entries are updated, and the Login control's OnLoggedIn event is triggered without error. However the user is not recognised as being logged in as the LoginView control continues to show the Anonymous Template and a request to obtain the MemberShipUser via Membership.GetUser(false) returns "nothing".

The problem is still there after uninstalling SQL Server Express then re-installing (without SSMSE) and using a User Instance. Login/Register actions work but the login is not recognised by other components.

Any suggestions on how to identify the problem would be much appreciated!
 
Old November 3rd, 2011, 03:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Can you post the code for the web.config file and the page? In addition can you describe your setup (where you run this site, how you configured the server and so on)? Also, what happens when you look at User.Identity in the code behind of a page while debugging?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Peter T Roberts (November 4th, 2011)
 
Old November 4th, 2011, 03:17 PM
Registered User
 
Join Date: Oct 2011
Posts: 5
Thanks: 2
Thanked 2 Times in 2 Posts
Smile Successful ASP.NET Login not recognised

Imar - Many thanks for your reply.

I'm afraid I have to confess to an own goal. I hadn't appreciated that logged-in status was indicated by a cookie and that there was no further reference to the database once the login had been completed.

I followed the recommendations in your excellent book to the letter particularly Chapter 19 and Appendix B. Apart from a slight problem with the connection string after attaching the database using SSMSE everything worked fine until login stopped working for no apparent reason.

I have just realised that the problem is due to my changing to an invalid URL address (one including '_' rather than '-' to access my Website. It appears that IE (or ASP.NET?) won't handle cookies associated with such names. After correcting the URL, login is now working once again without problem.

Thank you once more for your reply as it encouraged me to redouble my efforts to solve the problem which I had struggled with for some time!

Regards
Peter
The Following User Says Thank You to Peter T Roberts For This Useful Post:
Imar (November 5th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 4 Login timeout R4VEN ASP.NET 4 General Discussion 13 October 30th, 2010 08:32 AM
asp.net login error akshay144 ASP.NET 3.5 Basics 1 August 3rd, 2009 08:18 PM
asp.net login control kulkarnimonica ASP.NET 2.0 Professional 6 September 25th, 2007 05:22 PM
Windows Login via ASP.net rwalker VS.NET 2002/2003 9 June 20th, 2007 03:27 PM
ASP.net login page in C# in 2.0 debjanib ASP.NET 2.0 Basics 4 March 23rd, 2007 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.