tags:

views:

142

answers:

1

Hello.

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.

+1  A: 

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.

Lou Franco