How to turn route into URL in ASP.NET MVC Controller? -


In a view, the code controller 'em> action Method based on routes in the .asax.cs file.

  & lt;% = html.ActionLink ("text", "action", "controller")%>  

My question is how can I get a similar route-to-URL mapping outside of a scene, such as controller? There is no HTML member on the controller class on which ActionLink is called.

Some controller tasks need to be redirected to the browser, and I want to do a controller and action without to run the URL in the controller, which will be broken if I The routes are mapped to these URLs for controllers and actions

What you are looking for is Redirect Action .

If you want a URL, use the controller's url property - its one.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -