如何设置 IIS 来运行 HTML 表单的服务器代码?
如果我有一个带有小表单的简单 html 页面,我想将其数据存储在服务器上的数据库中,那么我的服务器上需要什么才能接受表单输入?
我不想在 HTML 页面中使用任何 ASP.NET 代码。
If I have a simple html page with a small form whose data I'd like to store in a DB on the server, what do I need on my server to be able to accept the form input?
I'd rather not use any ASP.NET code in the HTML page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如我在评论中提到的,与 ASP.NET 中的 Java Servlet 最接近的是
IHttpHandler
的原始实现。您会注意到它具有以下约定:这与公开方法的 Java servlet 非常相似:
不同之处在于,在
ProcessRequest
中,您将获取context.Request
和context.Response
。最后,您需要在
web.xml 中注册您的处理程序。配置
:As I mentioned in the comments, the closest thing to a Java Servlet in ASP.NET is a raw implementation of
IHttpHandler
. You'll note it has the following contract:This is very similar to a Java servlet which exposes the method:
The difference being that in
ProcessRequest
you'll grabcontext.Request
andcontext.Response
.Finally, you need to register your handler in the
web.config
:您的 HTML 表单将数据提交到服务器。您将需要服务器上有一些东西来接受此数据并将其写入数据库。这可以是 ASP.NET 应用程序、PHP、Perl 或 Python 脚本,或者您可以在服务器上运行的任何其他内容。
您的 HTML 页面不一定必须具有任何 ASP.NET 代码,即使您的服务器端应用程序是用它构建的。
Your HTML form submits data to the server. You will need something on the server that accepts this data and writes it to your database. This could be an ASP.NET app, PHP, Perl or Python scripts, or just about anything else that you can get to run on your server.
Your HTML page doesn't necessarily have to have any ASP.NET code, even if your server-side application is built with it.