Removing a querystring from url in asp.net

后端 未结 4 671
[愿得一人]
[愿得一人] 2020-12-18 15:36

HI, I need to remove a querystring when a user clicks a particular LinkButton. So for example if the querystring is http://UserProfileManager.com?UserID=1234 .... when the u

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-18 16:02

    you cant actually remove a querystring from the URL. I mean to say that there is no .remove() method available for that. If you still want to do so you will have to use the .substring() method and get it done manually.

    Just a tip that may prove helpful: If you are using the QueryString values to maintain different states on the same page then i would rather suggest you to keep those values in a ViewState on the page and make changes to it accordingly. This way your URL will remain clean, users wont be able to harm your flow and will work just fine.

    take care!

提交回复
热议问题