 |
| ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Professional 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
|
|
|
|

September 24th, 2007, 04:36 PM
|
|
Authorized User
|
|
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
asp.net login control
Hi all,
I am using the Asp.net 2.0 login control in my application.
I have not set the control's DestinationPageUrl property because O want the user to be redirected to the originally requested URL after being authenticated.
This works great if the user is able to login succesfully in the first attempt but if the user fails the first few times and then is able to login successfully, the page is not redirected to the originally requested URL but it reloads the login page again.
How can I get around this problem.?
Regards,
--Monika
|
|

September 25th, 2007, 01:51 AM
|
|
Authorized User
|
|
Join Date: Sep 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Do you mean that you handle authentication and redirection your self? If so, you could save PreviousPage property (or the URL behind that) at page_load when IsPostBack is false. After successful authentication, just redirect user back to saved URL.
Just take notice that some personal firewalls removes HTTP_REFERRER header from query so you need to write some fallback code redirects user to front page for example (or do something really fancy and maintain browser history at the server using session).
|
|

September 25th, 2007, 02:27 PM
|
|
Authorized User
|
|
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No, I dont handle the redirection. I havent specified any redirection url bcoz I want to go to the originally requested webpage after user is successfully logged in.
This works if the user successfully logs in the first attempt but if he succeeds after 1 or 2 attrempts , then the same login page is loaded instead of taking the user to the originally request web page.
How can I fix this problem? Is this a bug with Microsoft login control or some error from my side?
--Monika
|
|

September 25th, 2007, 02:35 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Can you show us your code?
It shouldn't be like that. ASP.NET keeps track of the originally requested page in the query string. Even after repeated logion failures, the page should still be there in the query string. Once you log on, you should be taken to the initially requested page....
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

September 25th, 2007, 04:32 PM
|
|
Authorized User
|
|
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well, here is the catch..!
In my Login control I have FailureAction = "RedirectToLoginPage"
Hence after every failure it goes to login page...then I have some custom error message for display.
The user logs in back successfully and then is not taken to the originally requested URl but to the LoginPage.
If I take off the FailureAction Part in the code.., it works fine!
--Monika.
|
|

September 25th, 2007, 04:38 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Well, in that case, drop the FailureAction setting and handle the custom error message in LoginError.
Would that work for you?
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

September 25th, 2007, 05:22 PM
|
|
Authorized User
|
|
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes...that works!
Thanks,your replies helped me look better into the code!
--Monika
|
|
 |