问题描述
我有一个.NET类库。我想通过一个隐藏的变量,从一次$隐藏页C $ c和获取它背后的页面另一code。请注意,我没有任何设计网页(aspx页面),在那里我可以使用的形式标记和GET / POST方法。我们怎样才能做到这一点?
I have a .Net class library. I want to pass a hidden variable from once code behind page and fetch it in another code behind page.PLease note I dont have any design page(aspx page) where I can use form tag and get/post method.How can we do this?
注:我想使用隐藏域从1页值传递到另一个
NB: I want to use hidden fields to pass value from 1 page to another.
推荐答案
如果你希望保持隐藏那么变量,你可以使用一个会话来存储你的对象。
If you are wanting to keep the variable hidden then you could use a session to store your object.
例如,
设置会话值
Session["HiddenValue"] = "something";
获取会话值
string something = (string)Session["HiddenValue"];
请记住然而,会议只在有限的时间(这可以thorugh IIS和您的网络配置中配置)。
Do keep in mind however, that sessions are only for a limited time (this can be configured thorugh IIS and your web configuration).
这里是了解会话和会话状态一个很好的资源
这篇关于如何从一个页面传递一个隐藏字段到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!