使用 ISAPI 注入 html 代码并响应 post 事件

发布于 2024-07-23 04:42:28 字数 672 浏览 3 评论 0原文

我想在任意 Web 应用程序的每个页面上注入代码。 让我们想象一下,我想为一个页面添加排名输入,该页面可以仅使用 web.config 打开/关闭,而不更改源代码。

我知道我可以使用 Filter 注入和更改 html,但我不确定我是否可以回复该帖子。 让我们想象一下用户投票后,投票面板将必须显示票数并禁用投票输入。 由于每个页面都会向自身发布,因此我还需要在从注入表单收到请求并返回表示操作成功的响应流(让我们说“OK”字符串)后立即中断管道。

问题

  • 我可以使用过滤器来做到这一点吗?
  • 访问表单数据(问题中涉及非服务器表单)(包括 FileUploads)有多难?
  • 是否可以通过 ClientScript 类或任何其他方式使用 JS 资源?
  • 是否可以仅在具有给定权限的用户登录时调用过滤器,否则忽略它。

操作摘要

  • 根据初始请求,注入非服务器表单并嵌入 JS。
  • 表单将使用伪 AJAX(IFrame 方法)发布/返回到其包含的页面,
  • 我获取发布数据,对它们进行处理,如果一切正常,则返回响应“OK”。
  • 注入的 JS 接收它并更改表单内容以反映响应

Ty。

I want to inject the code on each page for arbitrary web application.
Lets imagine i want to add rank input for a page that can be toggled on/off using web.config only, without changing the source code.

I know I can inject and change html using Filter, but I am unsure if I can respond to the post. Lets imagine user voted and after that voting panel will have to show number of votes and disable vote input. Since each page will post to itself, I need also to break pipline as soon as I get the request from injected form and return response stream signifying operation sucess (lets say "OK" string).

Questions:

  • Can I use filters to do that ?
  • How hard is to access form data (non server form is in qustion), including FileUploads ?
  • Is it possible to use JS resource using ClientScript class or any other way ?
  • Is it possible to invoke the filter only if user with given privileges is loged in and ignore it otherwise.

Summery of operations

  • On initial request, inject non server form and embeded JS.
  • Form will post/get back using pseudo AJAX (IFrame method) to its containing page
  • I get the post data, do something with them, and return response "OK" if all is good.
  • Injected JS receives it and change the form content to reflect response

Ty.

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

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

发布评论

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

评论(1

夏日浅笑〃 2024-07-30 04:42:28

如果您使用的是 ASP.NET,您可能需要查看 HTTP 模块

http: //msdn.microsoft.com/en-us/library/ms998536.aspx

这是执行您想要执行的操作的 ASP.NET 方式,并且比 ISAPI 更容易编程。

If you are using ASP.NET, you might want to look at HTTP Modules

http://msdn.microsoft.com/en-us/library/ms998536.aspx

It's the ASP.NET way of doing what you are trying to do, and is a lot easier to program against than ISAPI.

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