Rita
Rita

Reputation: 735

change url address in MVC Framework

I have a website that we migrated from ASP.NET to MVC Framework.

The url With ASP.NET that used to be Ex: http://Website1/MasterData The URL now with MVC Fraemwork became http://Website1/Home/MasterData.

Now as the users of the site have Bookmarked the old URL, Now we need to maintain the same url. I would appreciate if anyone can provide steps how we can this?

Appreciate your responses.

Upvotes: 1

Views: 1476

Answers (3)

Robert Harvey
Robert Harvey

Reputation: 180908

Provide a 301 redirect from the old url to the new url.

Or, provide static routes that trap the old urls and route them to the proper controller methods.

Upvotes: 2

AUSteve
AUSteve

Reputation: 3258

You could add a route in Global.asax so that users get the right screen from the old URL:

routes.MapRoute( _
    "OldMasterDataRoute", _
    "/Masterdata", _
    New With {.controller = "Home", .action = "MasterData", .id = ""} _
)

Upvotes: 1

stepanian
stepanian

Reputation: 11433

You can modify the RegisterRoutes method in the Global.asax.cs file to specify your desired paths.

Upvotes: 1

Related Questions