Click here to Skip to main content
15,303,572 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an ASP.NET web application project, I want to add Secured Login Functionality using Form Authentication and Authorization. I have some secured pages and some nonsecured pages. I want login prompt should always come for secured pages and not for nonsecure items. Also when I hit "BACK" button on browser and should not be able to go in my account without logging in. I need to be asked before logging in. Also it would be great if I move to nonsecure items it should ask me to logout first.
Thanks in advance.

-- Sameer B

1 solution

set authentication to form authentication in your webconfig file not specify the login page in webconfig file
2.for your secure page in page load or initialize event check for User.Identity.IsAuthenticated
3.and if user is not authenticated redirect to login page might use the same property on insecure page and if user is already authenticated then you can prompt user for logout or redirect user first to logout page

hope this will help you
Adwaitam 25-May-12 4:01am
Thank You....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900