Well, the general answer is: do not do this! Although the viewstate (may be) encrypted, it is not intended to store sensitive data. The reason is that data in the form of a viewstate can be collected by a third party and later decrypted.
But this does not mean that you should not do this ... :-) Firstly, your connection exceeds https, so everything that you transmit is already encrypted. This means that collecting sensitive data will be very difficult. If a third party steals your sensitive data, it will first have to decrypt the connection, and THEN decrypt the view. Thus, it will be much easier for an attacker to use other approaches to obtaining your data (for example, to deceive users, phishing, etc.).
So, to ensure the security of your data, I will remain, to store them in an encrypted form and using https should be enough.
The choice between 1) and 2) should not have or have little effect on performance. When you store an object in a viewstate, the object is serialized and then saved, so no matter which approach you choose, the data is serialized for you. Designing a class to store your data sounds like a clean approach, so I would suggest this. You might even want to create a class that stores your sensitive data in encrypted fields to make it harder to get sensitive information, but it will cost even more performance.
source share