How do you persist querystring values in asp.net mvc?

前端 未结 4 1740
独厮守ぢ
独厮守ぢ 2021-01-01 21:24

What is a good way to persist querystring values in asp.net mvc?

If I have a url: /questions?page=2&sort=newest&items=50&showcomments=1&search=abcd

4条回答
  •  清酒与你
    2021-01-01 22:15

    I would just keep the values in the Session that way the paging links only need to have;

    /questions?page=2

    /questions?page=3

    The one reason why I would not us the QueryString is because I don't want the user to see the values that I am passing to the program. It makes it way too easy for them to go into the address bar and start changing the values to 'see what happens'. With this code all they could do is change the page number.

提交回复
热议问题