i want to remove the query string from the url in C#. I will redirect to this page with a query string from another page like this, http://www.something.com/details.aspx?id=100.
But the url in status bar should be changed to http://www.something.com/search.aspx.
I can’t use sessions or ‘post’. I tried implementing url rewriting,but i don’t really understand how to set the rule to remove query string.
Anyone pls help…
Its not a rule to remove the query string, but its KIND OF A REDIRECT (url rewriting), see.
You set this code at Global.asax Application_BeginRequest method.
Of course, instead of the Contains method you better use a regex.
This code means that you will reuse details.aspx but using search.aspx on your URL. So instead of redirecting user to /details.aspx?id=100 you will directly send him to /search.aspx and its done, you dont have to “remove the query string” as theres no query string to the user.