如何不删除单个特定的会话变量? [英] how to not delete a single particular session variable?

查看:95
本文介绍了如何不删除单个特定的会话变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



假设我有30个会话变量...我想删除29个会话变量,但是要删除一个.我该怎么做请帮帮我!

我尝试使用Session.RemoveAll()删除所有会话.但是我的要求是删除除一个会话外的所有会话.我该怎么做?

Hi,

Assume I have 30 session variables...I want to delete 29 session variables but one.How can I do this please help me!

I tried Session.RemoveAll() With this it deletes ALL the sessions.But my required requirement is to delete all but ONE Session.How do i do it?

推荐答案

要么遵循安德烈的建议:存储要保留的变量的值,然后销毁所有变量并重新创建要保留的变量即可."或将所有其他值设置为null.

我?可能与Andre相同.
Either go with Andre''s suggestion: "Store the value of the variable you want to keep; then destroy them all and re-create the one you want to keep." or set all the other values to null.

Me? Probably the same as Andre.


if(Session["strlcaNo"]!=null) Session.Remove("strIcaNo");
if(Session["strEmail"]!=null) Session.Remove("strEmail");



您必须对所有这29个对象都这样删除....



you have to remove like this for all those 29....


这篇关于如何不删除单个特定的会话变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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