开发者

I am passing a Controller as a parameter, can't get to RedirectToAction method?

My method looks like:

public static RedirectToResult(Controller controller, ...)
{

}

when I do:

controller.

I don't see RedirectToAction, how come?

I get RedirectToAction from within 开发者_如何学运维the controller's action, but not when I pass the controller as a parameter to another classes method. Why? really confused!


RedirectToAction is a protected function. You can only call it from inside the controller class.


If you're looking for an extension method you need the 'this' keyword before the type.

    public static ActionResult RedirectToResult(this Controller controller)
    {

    }

Hope this helps


You could try out T4MVC. It will definitely help in making strongly typed Url helpers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜