Reputation: 3948
How do I clear/remove query string parameters, which my MVC action, doesn't require/support?
For instance, my action requires, say an id and a bool flag, so the url would be something like: http://localhost:someport/controller/action/?id=1&remove=true
But, if a user types in something like, http://localhost:someport/controller/action/?id=1&remove=true&some-junk-param=0
Then, I want the some-junk-param
to be removed and not shown in the address bar, when the request is processed.
Any thoughts?
Upvotes: 0
Views: 524
Reputation: 847
If you need to get rid of unwanted query string parameters, you have two general options:
Caveats:
Caveats:
Of course every way is suitable for it's own cases, but looking at caveats the second way is better, because it affects developer expirience whereas first way affects user expirience.
Upvotes: 1