从不同的网页访问隐藏字段值
我已将字符串值存储在页面的隐藏字段中。 如何从不同的网页访问它?
I have stored a string value in a hidden field of a page.
How to access it from a different webpage?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你有两个选择。
一个。将该字符串值放入会话中。
b.在 url 中传输该值。
You have two options.
a. Putting that string value in a Session.
b. Transmitting that value in the url.
在包含隐藏值的页面上,您可以将该表单发布到其他页面并从 this.Request.Form["hidden-field"] 获取值。
这是您正在寻找的答案吗?也许更多细节会有所帮助。
祝你好运!
On the page that contains the hidden value, you could post that form to the other page and get the value from this.Request.Form["hidden-field"].
Is that the sort of answer you are looking for? Maybe more details would help.
Good luck!
如果您不介意使用 jQuery,并且只要页面位于同一域中,那么您可以使用
.load()
方法来完成。此方法基本上对页面带有隐藏字段的页面
您正在调用的页面
执行
GET
请求附加说明:如果它们位于不同的域中,那么您唯一的其他选项是:
查询字符串
会话
引用:
http://api.jquery.com/load/
http://www.java2s.com/Code/ASP/Request/GetquerystringfromRequestC.htm
http://msdn.microsoft.com/en-us/library/ms178581.aspx
If you don't mind using jQuery, and as long as the pages are on the same domain, then you can do it with the
.load()
method. This method basically does aGET
request to the pagePage with hidden field
Page you're calling from
additional notes:
If they are on different domains then your only other options are:
Query Strings
Sessions
references:
http://api.jquery.com/load/
http://www.java2s.com/Code/ASP/Request/GetquerystringfromRequestC.htm
http://msdn.microsoft.com/en-us/library/ms178581.aspx
您还可以使用 cookie 跨页面传输值。也许您想阅读这篇文章以了解有关状态管理的更多信息。一定要读一下。一定会帮助你的。阅读本文后您可以决定要使用什么。
希望对您有帮助。 http://www.codeproject.com/KB/vista/ASPNet_State_Management.aspx
You can also use cookies to transfer the value across pages. May be you would want to read this piece of article to know more about the state management. Do read it. Will definitely gonna help you. You can decide what you want to use after reading this.
Hope it helps you. http://www.codeproject.com/KB/vista/ASPNet_State_Management.aspx