跨页ASP.net传递值 [英] Passing values across pages ASP.net

查看:171
本文介绍了跨页ASP.net传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要从一个页面传递IDS一长串到另一个,我想使用的查询字符串,但也要考虑到IDS传递可能达到300的数量,我认为是不是一个好主意。
从我的理解一个选项可能是使用session,这似乎是我在我的情况,但是,从另一方面

Hi i need to pass a long list of Ids from one page to another, i was thinking of using querystring but taking in consideration that the number of ids to be passed may reach 300 i think is not a good idea. an option from my understanding may be the use of session, this seems to me an optimal solution in my case but on the other hand

当用户执行某些动作和IDS的列表中不再需要的,但如果用户离开页面而不执行我要清除的会话的任何行动,我怎么能做到这一点我可以肯定清除会话?

I can certainly clear the session when the user performs a certain action and the list of ids is not longer needed, but if the user leaves the page without performing any action i want to clear the session, how can i do it?

如果多个用户使用的是相同的功能我是否需要混淆会话的项目或会话是为单个用户?

If multiple users are using the same functionality do i need the session's items to be confused or the session is for a single user?

我在asp.net C#的工作

I am working in asp.net c#

感谢

推荐答案

如果多个用户使用的是相同的功能和ID是为每个用户相同,则使用应用程序的状态,或Singleton模式。

If multiple users are using the same functionality and the id's are the same for each user, then use Application state, or a Singleton pattern.

如果每个用户都需要有自己的id的列表,那么你可以使用会话状态,这是为每个用户唯一的。在传统的ASP你不应该使用一个对象如集合,但在ASP.NET中,你可以在列表中放置这些,阵列等。

If each user needs to have their own list of id's then you can use Session state which is unique for each user. In classic asp you shouldn't use an object eg collection but in ASP.NET you could place these in a list, array etc.

在ASP.NET可以共享服务器之间的会话状态,如果你能在一个数据库会话服务,或放置会话状态。

In ASP.NET you can share session state between servers if you enable the session service, or place session state in a database.

您也可以考虑饼干,如果ID是数字,你可以逗号分隔他们和相对较低的开销重新加载它们,但需要提醒的是一个聪明的用户可能能够改变值。

You could also consider cookies if the id's are numeric you could comma separate them and reload them with relatively low overhead, but with the caveat that a smart user may be able to alter the values.

最后,你可以将这些值之间的调用数据库表店。

Finally, you could store these values in a database table between calls.

这篇关于跨页ASP.net传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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