Reputation: 3265
I've been looking for a while on how to rewrite URLs , I've seached on it in SO and Google but in vain.
My problem is that I have a small web application and I want to rewrite all my urls
So basically I want this :
localhost:56789/Controller1/Action1 => localhost:56789/something
localhost:56789/Controller1/Action2 => localhost:56789/something2
localhost:56789/Controller2/Action2 => localhost:56789/something3
...
Is it possible ? How ?
Thanks for your help :)
Upvotes: 0
Views: 43
Reputation: 16743
Open up /App_Start/RouteConfig.cs
Add this:
routes.MapRoute(
name: "Something",
url: "something", //Don't prefix this with a forward slash
defaults: new { controller = "Cotnroller1", action = "Action1" }
);
You can do pretty much anything with URLs these days.
Upvotes: 3