asp.net mvc - ASP net MVC: How to ignore one get variable with route? -


i have url: http://url.com/segment1?id=885&variable_need_to_ignore=value

i need exclude last variable (&variable_need_to_ignore=value) url , process without variable (ideally without redirect, on same page) http://url.com/segment1?id=885 (with route config ideally).

you change query string parameters url path parameters. check out this. imho make urls cleaner , follow more of restful paradigm.

if not creating route "http://url.com/segment1" , ignore query string parameter "variable_need_to_ignore" inside code.

it still leaves questions: why need ignore , why in url in first place if not in need of it?

edited

if incoming parameters out of control , need ignore them, ignore them in code. since resource exists @ url provide, imho, 404 isn't valid response in situation. query string should used kind of filter on results return, should not required parameters in first place.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -