public IHttpHandler GetHandler(HttpContextBase context, string requestType, string url, string pathTranslated)
{
if (context == null)
{
throw new ArgumentNullException("context", "context cannot be null.");
}
requestType = requestType ?? "GET";
if (this.Mode == DashboardEnabledMode.On ||
(this.Mode == DashboardEnabledMode.LocalOnly &&
context.Request.IsLocal))
{
string handlerUrl = ResolveHandlerUrl(this.HandlerUrl, context);
string handlerRelativeUrl = GetHandlerRelativeUrl(handlerUrl, context.Request.RawUrl);
QueryString queryString = QueryString.FromUrl(context.Request.Url);
IDashboardHandler handler = DashboardRouter.GetHandler(requestType, handlerRelativeUrl, this.RepositoryFactory);
if (handler != null)
{
handler.ApplicationName = this.ApplicationName;
handler.HandlerUrl = handlerUrl;
handler.HandlerRelativeRequestUrl = handlerRelativeUrl;
handler.QueryString = queryString;
handler.Verb = requestType.ToUpperInvariant();
}
else
{
context.Response.StatusCode = 404;
context.Response.End();
}
return(handler);
}
else
{
context.Response.StatusCode = 403;
context.Response.End();
}
return(null);
}