Home Equivalent of url rewrite dbprovider in MVC 4
Reply: 0

Equivalent of url rewrite dbprovider in MVC 4

Sujit.Warrier
1#
Sujit.Warrier Published in 2017-09-14 06:29:07Z

So In my webforms version Im using Url rewrite for IIs along with dbprovider to perform routing by matching the Url with db and the route accordingly.

This is the sample URL "http://localhost/Brands/ABC". here "Brands/ABC" is matched in the db and routed to corresponding URL "Brands.aspx?BrandId=10000".

I want something similar in MVC 4. i.e I dont want the Id to appear in the URL.

Currently all the solutions I found were using Route Config. Which I implemented.

routes.MapRoute(
            name: "Brand",
            url: "Brands/{ignore}/{BrandId}",
           defaults: new { controller = "Brand", action = "Index" 
            },
           namespaces: new[] { "CSPL.B2C.Web.Controllers" }
            ); 

This Gives me the URL "http://localhost/Brands/ABC/10000". But I dont want this Id i.e 10000 to appear in the URL. any Suggestions?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.480426 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO