且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何为用户注销按钮编写代码

更新时间:2023-12-02 13:03:16

假设你正在使用会员资格(如果你不是,你应该),试试:

 FormsAuthentication.SignOut(); 


如果您正在使用会话

 Session.Abandon(); 
Response.Redirect( home.aspx);



或者解决方案#1也是正确的..


Session.Clear();

Session.Abandon();

Response.Redirect(Home.aspx);


Hii to all, iam developing a login page,whear user can register and can login to my page,up to this i have done, hear i want to provide a logout button for user to get back to his previous page i.e Home page, can u please send me the code for logout..thanks in advance


with regards
D Ramu

Assuming you are using Membership (and if you aren''t, you should), try:
FormsAuthentication.SignOut();


If you''re using Session :
Session.Abandon();
Response.Redirect("home.aspx");


or else Solution #1 is correct as well..


Session.Clear();
Session.Abandon();
Response.Redirect("Home.aspx");