Amr Elgarhy
Amr Elgarhy

Reputation: 68912

How to mask a url in mvc?

In mvc how to make a URL like this:
www.example.com/SomethingElse
go to a controller named for example "UsersList" -> which should be www.example.com/List

Upvotes: 1

Views: 1521

Answers (2)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038770

You could define a route:

routes.MapRoute(
    "MyRoute",
    "List",
    new { controller = "UsersList", action = "Index" }
);

Now when you navigate to /list, the Index action of the UsersList controller will be executed.

Upvotes: 2

Richard B
Richard B

Reputation: 1581

Amr: I think you are looking at the routing framework. In a standard asp.net Mvc application, there is an area in the global ASAx file that you can define routes, much like you are talking about.

Upvotes: 0

Related Questions