我如何为用户注销按钮编写代码 [英] How can i wrote code for user Logout button

查看:168
本文介绍了我如何为用户注销按钮编写代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii对所有人来说,我开发了一个登录页面,用户可以注册并可以登录我的页面,直到我已经完成,听到我想提供一个退出按钮,用户可以回到他的上一页,即主页页面,您能否发送给我注销代码..谢谢提前





关于

D Ramu

解决方案

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

 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");


这篇关于我如何为用户注销按钮编写代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆