Accessing route URLs in the controller in ASP.Net MVC -


asp.net mvc has nice features making sure have correct url route want. can use htmlhelper class correct url views:-

@html.routelink("link text", new {controller = "articles", action = "tag"}) 

now great. however, find myself in situation want know url not writing view. question best way information in controller? have read various posts show how sneakily create instance of htmlhelper there must more straightforward way of doing this.

thanks.

you can try urlhelper.routeurl. urlhelper accessible via url property on controller.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -