ASP.NET MVC – how to get a full path to an action

You mean like using the Action method on the Url helper:

<%= Url.Action("DoThis", "MyController") %>

or in Razor:

@Url.Action("DoThis", "MyController")

which will give you a relative url (/MyController/DoThis).

And if you wanted to get an absolute url (http://localhost:8385/MyController/DoThis):

<%= Url.Action("DoThis", "MyController", null, Request.Url.Scheme, null) %>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)