In my project I have a lot of handlers, each of it has hundreds of functions.
public class DataHandler1 : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
switch (CommandName)
{
case "GetTime":
GetTime(context);
break;
....
}
}
private void GetTime(HttpContext context)
{
string str = ...;
context.Response.Write(str);
}
Each function reads the Request.QueryString
and writes result as Response.Write
.
Initially idea of this handlers was be call it only from JS, but now I need perform this handlers from server side (ASP.NET Classic). It's impossible to rewrite huge amount of functions or create double of this code for server side perform.
So, the best solution looks like an overload and override of Response.Write
to receive simple string in my own code something in this way.
var X = new DataHandler1(context, myCurrentUserDM);
string ResponseWriteResult = X.GetTime.RequestQueryString("?a=1&b=2&c=3");
Is this possible?
