C#Web-App:会话变量的问题 [英] C# Web-App: problem with session variable

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

问题描述

大家好,


我真的需要一些帮助。我有一个使用c#的asp.net web项目。


我已将一个数据字段放在一个webform中的会话中,我将会话的相同数据字段调用到另一个web表单中同一个项目。


我之前工作过,现在突然间,当我尝试从会话变量中提取时,我的第二种形式的空值。

据我所知,我在这个项目中没有任何改变。


和我的syntaxt是:

展开 | 选择 | Wrap | 行号

解决方案

是这个代码


string getid = Session [" qid"]。ToString();


在webform2的页面加载中?


你可以调试并找到该会话变量的值,然后再从webform1重定向到webform2。你试过吗?


我正在调用字符串getid = Session [" qid"]。ToString();我在页面加载时调用的方法之一。


喜欢,

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


确定。在这里,我发现了一些奇怪的东西。


我可以将会话变量发送到我的webform3,因为我有几个带有相同projetc的webforms。


但是,我无法在webform 2上获取会话变量。


这怎么可能?我发现我的webform2没有任何问题。


如果您对此有任何想法,请帮助我。


谢谢你,

Hi all,

I really need some help. I have a asp.net web project using c#.

I have put one of my datafield in session in one webform and I am calling that same datafield of the session to another web form within a same project.

I worked before and now all of a sudden I am getting null value in my second form when i try to extract from session variable.

As far as I know I haven''t change anything in this project.

and my syntaxt is:

Expand|Select|Wrap|Line Numbers

解决方案

is this code

string getid = Session["qid"].ToString();

in the page load of webform2?

you shud be able to debug and find out the value of that session variable before getting redirected from webform1 to webform2. Have you tried it?


I am calling string getid = Session ["qid"].ToString(); to one of the method that I call on page load.

like,

Expand|Select|Wrap|Line Numbers


Ok. here I found something strange.

I can get session variable to my webform3 because I have several webforms withing same projetc.

But, I can not get session variable on webform 2.

How can this possible? And I can not find anything wrong with my webform2.

Please help me if any one of you have any idea on this.

Thank You,


这篇关于C#Web-App:会话变量的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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