When invoking webservice I need to change response text when invoking certain operation .
Therefore I created HttpModule that catch response and change it.
Below the code :
public class BeginEnd : IHttpModule
{
public void Init(HttpApplication context)
{
context.EndRequest += (o, e) =>
{
HttpContext currContext = HttpContext.Current;
NameValueCollection collection = currContext.Request.QueryString;
if ( collection.Count > 0
&& collection["op"] != null
&& collection["op"] == "ChangeService" )
{
string xmlOther = "<root>My Test</root>";
currContext.Response.Clear();
currContext.Response.Write(xmlOther);
currContext.Response.End();
}
};
}
public void Dispose()
{
}
}
So as you see, I just clear Response object and put my text.
Is is a proper way to do it ?
It's working , but I think that I missing something
What do you think ?