How to Prevent ViewState from being Tampered

Step 1: Add below web config code to add Encryption in ViewState data. 
  1. <pages controlRenderingCompatibilityVersion="3.5" enableEventValidation="false"  
  2. clientIDMode="AutoID" viewStateEncryptionMode="Always">  
Now, your viewstate data is encrypted and key is macid
 
But If you want to add more security  then you can add customize key for encryption
 
To apply this assign your key to  "ViewStateUserKey" which is page property.
  1. protected override void OnInit(EventArgs e)  
  2.    {  
  3.        ViewStateUserKey = Session.SessionID;  
  4.    }  
And please assign it in oninit method because view state should not load before assigned key.
 
Above two are best ways to prevent your viewstate data 
Ebook Download
View all
Learn
View all