Reputation: 4984
i'm trying to do a custom ActionResult for a MVC controller. In the example i'm looking at it shows the snippet bellow. My System.Web.Mvc.MvcHttpHandle doesn't implement the IHttpHandler interface. The System.Web.Mvc.dll is version 1.0.0.0. Should i just write my own httphandler or is there something specific to the MvcHttpHandler that i need to use in a Controller ActionResult?
/// <summary>
/// Transfers execution to the supplied url.
/// </summary>
public class TransferResult : RedirectResult
{
public TransferResult(string url)
: base(url)
{
}
public override void ExecuteResult(ControllerContext context)
{
var httpContext = HttpContext.Current;
httpContext.RewritePath(Url, false);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
}
}
Thanks,
~B
Upvotes: 3
Views: 839
Reputation: 4984
I came up with a solution
I changed:
IHttpHandler httpHandler = new MvcHttpHandler();
to:
IHttpHandler httpHandler = new MvcHandler(context.RequestContext);
Upvotes: 1