how can i do such thing in model or controller?
<%= Url.Action("Home"); %>
how can i do such thing in model or controller?
<%= 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.