开发者

How to display a page only for the first time in asp.net

开发者 https://www.devze.com 2022-12-17 01:42 出处:网络
I am developing an application using Asp.Net.My question is whether there is any solution to display a page only for the first time.i.e when the user logs in for the first time it should ask to change

I am developing an application using Asp.Net.My question is whether there is any solution to display a page only for the first time.i.e when the user logs in for the first time it should ask to change the password but when the user logs in after changing the password it should not display th开发者_如何转开发e changepassword page instead it should redirect to another page.I have used session variables to do this but after the session expires its again showing the change password page.Can anyone help me to solve this problem.


You should take a flag parameter in database as per user and set the flag on first login. If it is set then don't display the page.


Since the lifetime of the flag for showing this page is tied to the lifetime of the user entity, you have to keep it as a property of the user entity.

In other words - save it as a flag in the database where you keep the user details.


A common approach for this issue is to store the "user is logged-in" flag as a cookie, rather than in session state. The built-in ASP.NET membership system works that way, for example, using the concept of a "ticket."

0

精彩评论

暂无评论...
验证码 换一张
取 消