Using ASP.NET MVC2, How to make filters work with hackable urls?

Think of New Egg's new e-commerce sweep model , where keyword links in the navigation bar further limit the currently displayed list of products with each choice.

I am setting up a home crawler with these types of routes:

http://{website.com}/{Housetype}/{PriceLow}-{PriceHigh}
http://mysite.com/Residential/180000-230000
http://mysite.com/Commercial/300000-500000

But now I want to add links to the side navigation, which further limit the content:

1 Bedroom
2 Bedroom
4 Bedroom

1-4 Acres
4-10 Acres
10+ Acres

How to transfer and maintain the choice between clicks using MVC? I think my options are:

  • Continue adding named parameters to the query string, for example / {acres}: {low} - {high}, but this requires that all parameters exist, I could not select more than one criterion, or I hit the maximum request length.
  • {housetype} { }, , , (, DTO), .AddCriteria( "Acres", ".gt.", "1" );.AddCriteria( "Acres", ".lt.", "4" ) .. .
  • - ?

, , ( ), ASP.NET MVC. .

+3
1

URL- , IQueriable URL-. . , ... IQueriable - /price -greaterthan-3/price-lessthan-4000/acres-lessthan-10/

+1

Source: https://habr.com/ru/post/1732719/


All Articles