How to encrypt the ViewState ?

Posted by Raja under ASP.NET category on | Views : 4967
Generally ViewState should not be encrypted due to performance reason. Encryption of ViewState comes with an overhead as it consumes the server resources when encrypting and decrypting the ViewState however in certain scenario, you can't avoid it; In that case if the data is sensitive, you must encrypt the ViewState. To do that, try writing following attributes in the Page directives.

<%@ Page ViewStateEncryptionMode="Always" %>

Keeping the encryption mode "Always" ensures that all the ViewState of the page is encrypted always.


Comments or Responses

Login to post response