开发者

render Url.Action in model

how can i do such thing in model or controll开发者_如何学JAVAer?

<%= Url.Action("Home"); %>


You could use the Url property in the controller:

public ActionResult Index()
{
    string url = Url.Action("Home");
    // Do something with the url
    return View();
}

As far as the model is concerned you should avoid using such methods there. The model is passed to the view and the view has access to helper methods which can do the job.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜