如何在Web应用程序中将数据从一页传送到另一页 [英] how to carry data from one page to another in web application

查看:59
本文介绍了如何在Web应用程序中将数据从一页传送到另一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要输入保单编号.在第一页上,我想浏览我的Web应用程序的另外5页.考虑到低复杂度,应使用哪种状态管理技术?请尽快提供帮助.谢谢.

I want to enter a policy no. on the first page that i want to carry through another 5 pages of my web application. Which state management technique should be used considering low complexity? Please help as soon as possible.Thank You.

推荐答案

您好,

您可以使用Sesson对象,这对于http会话是唯一的.

您可以使用以下代码将数据存储到会话中.

Hi,

You can use Sesson object, That will be unique to http session.

You can use below code to store data into session.

Session["POLICYNO"] = policy_number;



然后,您可以使用以下代码访问其他页面中的策略编号.



Then you can access policy number in other page with below code.

int policy_number;
if(Session["POLICYNO"] != null)
{
   policy_number = Convert.ToInt32(Session["POLICYNO"].ToString()); 
}
else
{
  //You can show error message with no policy number in session
}



希望这对您有所帮助.



Hope this will help you.


请参见将数据从一页传输到另一页的多种选择.

-查看状态
-控制状态
-隐藏的字段
-饼干
-查询字符串
-应用程序状态
-会话状态
-配置文件属性

有关更多信息,您可以检查此链接 [ ^ ]

这一切都取决于您的要求,每个&每个方法都有其优点和优点.缺点.

查看此链接 [将页面值传输到另一个页面 [
See there are multiple options you have for transfering data from one page to another.

-View state
-Control state
-Hidden fields
-Cookies
-Query strings
-Application state
-Session state
-Profile Properties

For more info you can check this link[^]

Its all depend upon your requirements, each & every approch has some merits & demerits.

Check out this link[^], It explains advantages & disadvantages of each & every approch.

Transferring page values to another page[^]

If the policy no is small size data & it don''t have any security concern you can go with query string option. You can encrypt the data if you have security issue.


根据您的要求,您可以使用以下任何一种解决方案

1)查询字符串
2)Cookies
3)ViewState
4)表格数据
5)会话
As per your requirement you can use any of these solutions

1) Querystring
2) Cookies
3) ViewState
4) Form Data
5) Session


这篇关于如何在Web应用程序中将数据从一页传送到另一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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