用jquery删除Session? [英] Remove Session with jquery?

查看:57
本文介绍了用jquery删除Session?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用jquery删除会话?
或我使用webmethod删除会话(这是一个很好的解决方案吗?):

is there any way to remove session with jquery? or i use webmethod to remove session (is this good solution?):

$.ajax({
    url: "Default.aspx/RemoveSession",
    type: "POST",
    data: {},
    contentType: "application/json; charset=utf-8",
    dataType: "json"
});

webMethod:

webMethod:

[WebMethod]
public static void RemoveSession()
{
    Session.Remove("UserName"); 
}


推荐答案


会话在服务器上维护,无法在不向服务器发送请求的情况下在客户端上删除。

Sessions are maintained on server and could not removed on client without sending request to server.

您最多可以执行ajax调用或使用回发删除会话。

You can do it will ajax call at most or use postback to remove the sessions.

这篇关于用jquery删除Session?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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