Click here to Skip to main content
15,615,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actually i create small login and logout buttons,

1.when i login my home page is opening it's ok but when i click back in browser it going to back login page and showing my username and password.

2.when i click logout button it is going to logout but when i click forward button its coming to homepage

3. in my local system when i testing my home page url pasted in mybrowser it will openig without credinalities like login and logout how to solve all this problems can anyone experts in .NET please give clear cut material examples with good explanation ..........

it is very use to me please share your knowledge ...........
Updated 8-Dec-14 2:11am

1 solution

Here, you need to consider the most important feature of an application i.e. Authentication and Authorization for security purpose.
Remember one thing when you have login application, firt and foremost thing to consider from security point of view is this query which you have posted.
Nowcoming to your queries, you need to have to use Windows.History.Forward()
feature in javascript Windows history forward[^]
The above method allows you to manipulate the browsers history. So the back button would not work in the similar fashion.
Using this in both the pages will solve your problem 1 & 2.
Another suggestion is to use session or forms authentication in ASP.NET for security purpose.
Few links:-
Form authentication and authorization in ASP.NET[^]
These would surely help you for 3rd query. You could also set the Session(trivial) for the unique username or email and then use Authorize attribute to check if the session exists or not then allow to navigate into the pages else the login page.
And on logout just remove the session, so that they cannot get into the pages directly without login.
I hope I could make you understand some thing.
Post back any queries you have.
Share this answer
Member 10458660 9-Dec-14 4:14am    
Thank you for your answer suraj Sahoo

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