在asp.net中刷新会话值 [英] To refresh the session value in asp.net

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

问题描述

大家好,

我正在使用.NET 3.5框架.在我的应用程序中,我使用"Report.aspx"页面.在该页面中,我维护2个Session,如下所示:

Hello all,

I am using .NET 3.5 frame work.In my application i am having "Report.aspx" page.In that page i am maintaining 2 Sessions as follows:

Dim Safety_Rem As Integer
Safety_Rem = da_dt.Rows(da_dt.Rows.Count() - 1).Item(2)
Session("Safety_Rem") = Safety_Rem



同样的方式



and same way

Dim safety_rem1 As Integer
safety_rem1 = da_dt.Rows(da_dt.Rows.Count() - 1).Item(2)
Session("safety_rem1") = safety_rem1



当执行代码时,它将控制权转移到名为
的页面 我分别在其中使用这些会话值的"Guge.aspx"和"Kata.aspx"
如下
BC = Session("Safety_Rem")

BC = Session("safety_rem1")分别

只有在第一次执行代码时才会发生.如果值被更改
对于下一次执行代码,它会分别在两个变量中显示值,但不会将控件移到我实际使用这些值的"Guge.aspx"和"Kata.aspx"页面上.
我已经尝试过response.redirect()方法,但是它对我不起作用,因为在"Guge.aspx"和"Kata.aspx"上执行代码后,我想再次显示"Report.aspx",所以如果我使用response.redirect()仅显示"Guge.aspx"和"Kata.aspx"的内容,实际上只是
的一小部分 "Report.aspx"页面.我也曾经使用过ajax更新面板,但对我来说仍然不起作用.

有人可以帮我吗
在此先感谢

Yogesh



仍然我无法得到答案,有人可以帮助我.



when the code is get executed then its transfer the control to page called
"Guge.aspx" and "Kata.aspx" respectively where i used those session values
as follows
BC = Session("Safety_Rem")
and
BC = Session("safety_rem1") respectively

it happens only when first time code get executed.If the values are changed
for next execution of code then it shows values in both the variables respectively but it dose not move the control on pages of "Guge.aspx" and "Kata.aspx" where i actually used those values.

I had already tried response.redirect() method but it dose not work for me because after executing the code on "Guge.aspx" and "Kata.aspx" i want to show my "Report.aspx" again,so if i use response.redirect() it shows the content of "Guge.aspx" and "Kata.aspx" only which is actually small part of
"Report.aspx" page.I had also use ajax update panel still its not working for me.

Can somebody help me
Thanks in advance

Yogesh



Still i could not get the answer can somebody help me out of that.

推荐答案

HI.

投射Session对象.

例如,您有像
这样的会话
Session ["Name"] ="Salman Khan";

因此,这意味着您的Session ["Name"]
中有一个字符串
从会话中获取此字符串时,必须将其强制转换.因此将会话转换为字符串.

就像
字符串名称= Convert.ToString(Session ["Name"]);


希望它能解决您的问题

感谢和问候


更新:
请发送代码给您.或向我发送会话和重定向的确切路线

您如何使用Response.Redirect()方法
HI.

cast the Session object.

e.g you have session like

Session["Name"] ="Salman Khan";

so its means that you have a string in your Session["Name"]

when getting this string from the session, you have to cast it. so cast the session to string.

like
string Name = Convert.ToString(Session["Name"]);


I hope it will solve your Problem

Thank and Regards


UPDATES:
please send you code. or send me the Exact line of session and Redirection

How are you using the Response.Redirect() method


这篇关于在asp.net中刷新会话值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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