HTML表单的通用操作页面

时间:2011-02-23 14:50:08

标签: asp.net

帮助,我需要创建一个通用操作页面,接受来自html表单的帖子数据。服务器在Windows 2003 iis6上运行asp.net 2。

我不希望页面回发给自己,而是重定向到另一个页面。如何创建接受其他页面数据的页面?不确定从哪里开始

由于

1 个答案:

答案 0 :(得分:0)

这就是HttpContext.Request对象的用途。它是句柄保持发布的变量:

http://msdn.microsoft.com/en-us/library/system.web.httpcontext.request(v=VS.80).aspx

编辑:举个例子

<form method="POST" action="someotherpage.aspx">
    <!-- form stuff here -->
    <input type="hidden" name="username" value="steve" />
    <input type="submit" />
</form>

然后在someotherpage.aspx中,您将使用HttpContext.Request对象来获取变量:

string username;

if(HttpContext.Request["username"] != null)
    username = HttpContext.Request["username"];