3
Reply

Advantages and DisAdvantages of Using ViewState

Prabhu Raja

Prabhu Raja

13y
21.7k
0
Reply

    Interviews AshishSearch Post A Question Category Most Popular Companies Most Popular Job Functions Advantages and DisAdvantages of Using ViewState Posted by Prabhu Raja in ASP.NET Programming on Nov 19, 2011 0 2 17325 DO YOU KNOW THE ANSWER FOR THIS QUESTION? POST IT BELOW.POST YOUR ANSWER Posted by tony on Nov 25, 20110 Prabhu Raja has it nailed very well except that viewstate is not secure - it looks scrambled but that's just base64 encoding, and so is easily readable. (A good viewstate reader was released some time ago by pluralsight) While adding the two lines below to web.config will go some way to actually encrypting the viewstate, it can still be cracked with not too much difficulty: Tony http://www.tonycox.netPosted by Prabhu Raja on Nov 19, 20110 Advantages: i) No server resources. ii) Viewstate ensures security because it stores the data in encrypted format. iii) Viewstates are simple. They are used by enabling or disabling the viewstate properties. iv) It is based on the wish of developer that they want to implement it at the page level or at control level.Disadvantages: i) If large amount of data is stored on the page, then page load might cause a problem. ii) Does not track across pages. Viewstate information does not automatically transfer from page to page.

    Prabhu Raja has it nailed very well except that viewstate is not secure - it looks scrambled but that's just base64 encoding, and so is easily readable.  (A good viewstate reader was released some time ago by pluralsight)

    While adding the two lines below to web.config will go some way to actually encrypting the viewstate, it can still be cracked with not too much difficulty:  

    <pages enableViewStateMac="true/>

    <machineKey validation="3DES" />


    Tony

    http://www.tonycox.net


    Advantages:
    i) No server resources.
    ii) Viewstate ensures security because it stores the data in encrypted format.
    iii) Viewstates are simple. They are used by enabling or disabling the viewstate properties.
    iv) It is based on the wish of developer that they want to implement it at the page level or at control level.

    Disadvantages:
    i) If large amount of data is stored on the page, then page load might cause a problem.
    ii) Does not track across pages. Viewstate information does not automatically transfer from page to page.