2010-01-16 4 views
3

MVC 컨트롤러에 대한 사용자 지정 ActionResult를 수행하려고합니다. 위의 예에서 나는 그것을보고있다. 내 System.Web.Mvc.MvcHttpHandle은 IHttpHandler 인터페이스를 구현하지 않습니다. System.Web.Mvc.dll은 버전 1.0.0.0입니다. 내가 내 자신의 httphandler를 작성해야합니까, 아니면 컨트롤러 ActionResult에서 사용해야하는 MvcHttpHandler에 특정한 것이 있습니까?MvcHttpHandler가 IHttpHandler를 구현하지 않는 것 같습니다.

/// <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); 
    } 
} 

감사합니다,

~ B

+0

이 코드가 컴파일 되었습니까? – user3285954

답변

1

내가 변경 솔루션

함께했다 :

IHttpHandler httpHandler = new MvcHttpHandler(); 

에 :

IHttpHandler httpHandler = new MvcHandler(context.RequestContext); 
관련 문제