I need to create a route URL based on parameters as a part of a JSON return values.
What is the equivalent of Url.RouteUrl but to be used inside the controller code,
So I can return a string in my Json result that contains the routeurl .
I need this done outside of the controller class, in a separate class, can this be done at all?
You can still use
Url.RouteUrl, but in a slightly different way.Place a
using System.Web.Mvc;at the top of your class (of course, you might need to Add Reference to System.Web.Mvc).Then get the Url object by:
and access as usual:
Url.RouteUrl.