会话值无法清除 [英] session value can not clear

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

问题描述

我参加了两场比赛。在弹出窗口中我想破坏会话但不能。

I have take two session. In the popup I want to destroy the session but can not.

Session["StyleNo"] = ddlStyleNo.SelectedValue.ToString().Trim();
        Session["DefectNo"] = ddlDefectType.SelectedValue.ToString().Trim();
        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'Reports/Smt_StyleWiseReportWindow.aspx?', null, 'height=700,width=760,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);



在弹出代码中我尝试了不同的三种方式在最后阻止但没有工作。


In popup codes I tried different three ways in finally block but none work.

finally
{
Session["StyleNo"] = null;
Session["StyleNo"] = "";
Session.Remove("StyleNo");
}

推荐答案

你可以使用session.clear();



了解更多细节:

http://stackoverflow.com/questions/1470445/what-is-the-difference-between-session-abandon-and-session-clear [ ^ ]



它会给出明确的想法.. :)
You can use session.clear();

for more details have look into this:
http://stackoverflow.com/questions/1470445/what-is-the-difference-between-session-abandon-and-session-clear[^]

It will give clear idea.. :)


在那段代码之后我清除了下拉菜单

After that code I clear the dropdown
Session["StyleNo"] = ddlStyleNo.SelectedValue.ToString().Trim();
        Session["DefectNo"] = ddlDefectType.SelectedValue.ToString().Trim();
        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'Reports/Smt_StyleWiseReportWindow.aspx?', null, 'height=700,width=760,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);










ddlStyleNo.Items.Clear();
ddlDefectType.Items.Clear();


这篇关于会话值无法清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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