为遗留系统编写替换的 asp/html 表单

发布于 2024-07-12 07:49:01 字数 374 浏览 9 评论 0原文

快问。

有一个遗留网站(不在我的控制之下,无法修改),它为用户提供一个表格来填写数据,然后用户“提交”该表格进行处理。 该表单实际上没有错误检查,对用户的帮助也很少(即,大约 12 年前它的设计非常糟糕,并且从那以后就没有更新过)。

尽管如此,该应用程序的后端执行着关键的功能。

我的问题是,是否有可能(没有任何能力修改遗留网站),在 ASP.NET 中编写我自己的新前端(具有适当的预提交验证),并且位于不同的服务器上。 域,然后只要我重现正在发送的表单/数据,就模拟“提交”到另一个网络服务器?

我想这里的关键问题是,是否可以将一个网站上的表单提交到另一个网站,并且可以通过对旧网站进行任何更改来完成此操作吗?

评论赞赏。

Quick question.

There is a legacy website (that is not under my control and cannot be modified), that gives users a form to fill in data and then the user 'submits' the form for processing. There is virtually no error checking on this form, and very little help for the user (i.e. it was very poorly designed about 12 years ago and hasn't been updated since).

None-the-less, the back-end of this application performs a critical function.

My question is, is it possible (without having any ability to modify the legacy website), to write my own new front-end in asp.net (with proper pre-submit validation) living on a different server & domain, and then simulate the 'submit' to another webserver as long as I reproduce the form/data that is being sent?

The key question here I guess, is it possible to submit a form produce on one website, to another, and can this be done with ANY changes to the legacy site?

Comments appreciated.

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

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

发布评论

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

评论(3

染墨丶若流云 2024-07-19 07:49:01

我想这里的关键问题是,是否可以将一个网站上生成的表单提交到另一个网站,并且可以通过对旧网站进行任何更改来完成此操作吗?

是的,我之前已经这样做过 - 前提是目标站点不进行任何引用检查。 POST 请求就是 POST 请求,无论它源自何处。

您只需要确保请求中的所有字段与来自原始页面的字段完全相同,即相同的字段名称、相同的编码等。

The key question here I guess, is it possible to submit a form produce on one website, to another, and can this be done with ANY changes to the legacy site?

Yes, I've done this before - provided that the target site doesn't do any referer checking. A POST request is a POST request, no matter where it originates from.

You just need to make sure that all the fields are exactly the same in your request as they would be coming from the original page, i.e. - same field names, same encoding etc.

歌入人心 2024-07-19 07:49:01

简短的答案是“是”,长的答案是“这取决于”。 HTML 和 HTTP 的基础知识允许这样做,但如果不了解更多有关遗留站点的实现的信息,您就无法确定它是否会起作用。

理论上,您只需要确保字段名称相同,并将表单的目标设置为旧站点的页面 URL。

在实践中,遗留站点可能会做各种使其难以或不可能实现的事情(例如,它可能需要正确设置 cookie 或保存内部状态)。

最好的办法就是尝试一下。 仅仅模拟基本字段并发布表单以查看其是否有效,应该不会花费很长时间。 一旦您知道它有效,那么您就可以担心添加额外的验证等

The short answer is "yes", the long answer is "it depends". The basics of HTML and HTTP allow for it, but without knowing a little more about the implementation of the legacy site you can't know for sure that it will work.

In theory you just need to make sure that the name of the fields are the same and set the target of the form to the legacy site's page URL.

In practice the legacy site could be doing various things that make it difficult or impossible to achieve (it could require cookies set correctly or hold internal state for example).

The best thing would be just to try it. It shouldn't take long just to mock up the basic fields and post the form to see if it works. Once you know it works then you can worry about adding your extra validation etc

海之角 2024-07-19 07:49:01

请注意,如果现有网站正在对用户进行身份验证,您将需要找到一种方法来收集和传递该信息。 不过,除此之外,菲尔的观点是正确的。

Beware that if the existing site is authenticating users you'll need to find a way to also collect and pass that info along. Otherwise, though, Phill's point is spot-on.

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