如何从 post 方法获取值到 codehind 文件

发布于 2024-08-27 13:55:06 字数 504 浏览 4 评论 0原文

我创建了一个网页,它将作为“post”方法发布。而不是作为“get”方法。

    <html>
<head>
</head>
<body>
<FORM action="RetrieveData_Post.asp" id=form1 method=post name=form1>
 First Name:
 <br>
 <INPUT id="txtFirstName" name="txtFirstName" >
 <br>
 Last Name:
 <br>
 <INPUT id="txtLastName" name="txtLastName" >
 <br>
 <INPUT type="submit" value="Submit"> 
</FORM>
</body>
</html>

我想检索另一个表单后面的代码中文本框中的值。请帮我。

I have created a Webpage which will post as "post" method..not as "get" method.

    <html>
<head>
</head>
<body>
<FORM action="RetrieveData_Post.asp" id=form1 method=post name=form1>
 First Name:
 <br>
 <INPUT id="txtFirstName" name="txtFirstName" >
 <br>
 Last Name:
 <br>
 <INPUT id="txtLastName" name="txtLastName" >
 <br>
 <INPUT type="submit" value="Submit"> 
</FORM>
</body>
</html>

i want to retieve the values in the textboxes in the code behind of another form. Please help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离线来电— 2024-09-03 13:55:07

将 action="RetrieveData_Post.asp" 更改为 action="RetrieveData_Post.aspx" 创建 aspx 页面并用于

HttpContext.Current.Request.Form 

检索值。

Change action="RetrieveData_Post.asp" to action="RetrieveData_Post.aspx" create the aspx page and use

HttpContext.Current.Request.Form 

for retrive values.

你与昨日 2024-09-03 13:55:06

您可以在 HttpContext 中访问请求的表单字段:

HttpContext.Current.Request.Form

或者,要覆盖 cookie、表单、查询字符串和服务器变量,请使用 ItemParams< /code> HttpRequest 实例的集合。

(在代码隐藏中,Page 基本类型具有 Request 属性,以避免通过 HttpContext。)

You can access the form fields of a request in the HttpContext:

HttpContext.Current.Request.Form

or, to cover cookies, form, query string and server variables use either the Item or Params collection of the HttpRequest instance.

(In code behind, the Page base type has a Request property to avoid going via HttpContext.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文