如何在网页重定向期间保存值 [英] How to save values during WebPage Redirect

查看:194
本文介绍了如何在网页重定向期间保存值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在webform_1上,我有一些DDL和一个网格.从这个webform_1,在某些情况下,我将用户重定向到另一个webform_2.
现在,当我想从webform_2返回到webform_1时,我希望所有控件的值与重定向之前的值完全相同.
感谢任何解决方案.

On webform_1, i have some DDL and a Grid. From this webform_1,on some event, i am redirecting user to another webform_2.
Now when i want to return back from webform_2 to webform_1, i want all controls values exactly same what it was having before redirect.
Any solution is appreciated.

推荐答案

请记住,Web应用程序是无状态的. webform_1将无法记住以前的值.您需要保存值.有许多保存值的方法.您要保存的状态的性质和类型对于使用哪种机制会有一定的影响.这里没有一些特别的顺序.

1. 会话状态 [应用程序 [缓存 [ Cookie [
Remeber that web application are stateless. webform_1 won''t be able to remember previous values. You need to save the values. There are many ways of saving the values. The nature and type of the state you want to save will have some infunce as to which mechanism to use. In no particualr order here are some of them.

1. Session State [^]
2. Application[^]
3. Cache[^]
4. Database
5. Cookie[^]

If it is simple you may use session variable

//Set value
Session["MyValue"] =  value;

//Get value
value = Session["MyValue"];



您可以将其作为
查询字符串 [



You can pass it to your page as Query String[^] as well.


这篇关于如何在网页重定向期间保存值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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