I am developing one webservice using c#.It is possible intercept the client request using Filter(Using HttpModule).But how it is possible to modify the request.I can get request like this
Stream InputStrm = App.Context.Request.InputStream;
i want to decrypt the request&Set it back.How can i do this??
It depends on the web service technology you're using. If you're using Web API or MVC, you use an ActionFilter
. If you're using asmx, you use a SoapExtension
. If you're using WCF, you have various extension points. If it's just a web request, an HttpModule
can apply a filter by saying HttpContext.Current.Response.Filter = new SomeFilter( HttpContext.Current.Response.Filter )
where SomeFilter
is a class like public class SomeFilter : Stream {
. Request.Filter should work the same way. http://www.15seconds.com/issue/020417.htm is an old article, but shows a bit about these Response.Filter classes.