How can you secure/encrypt your querystring in asp.net?

前端 未结 4 654
鱼传尺愫
鱼传尺愫 2021-01-21 01:56

I was wondering how you could encrypt/decrypt your querystring in a simple asp.net page? some values need to be passed between different pages but the querystring cannot be chan

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-21 02:06

    How about adding the value you need to the Viewstate? Viewstate can encrypted and validated for you.

    ViewState["myKey"] = "myValue";
    

    and then later

    string myValue = ViewState["myKey"]
    

    To enable encryption:

    <%@Page ViewStateEncryptionMode="Always" %>
    

    or

    
       
          
       
    
    

提交回复
热议问题