I am using ASP.net core
I can use the html action inside the view
@Url.Action("GetOptions", "ControllerName", new { id="1"});
However, I want to get the string value in the controller.
eg. sort of
string Url= Url.Action("GetOptions", "ControllerName", new { id="1"}).ToString();
In previous versions of MVC, you can refer to the helper in the controller on
UrlHelper urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
Basically what I want to do is generate a URL string view in my controller
source share