Reputation: 31
Let's say there's a view with a name MyView
.
How can I get a url if this view by its name?
Upvotes: 0
Views: 1912
Reputation: 34189
View cannot have an URL.
An action which returns this view as a result can have an URL.
You can simply acquire action's URL using UrlHelper
, it is available both in Controller class or CSHTML view file:
Url.Action("MyAction") // MyAction action of default controller
Url.Action("MyAction", "MyController") // MyAction action of specified MyController
Upvotes: 2