ViewState and Server.Transfer Best practices
Scenario :
Server.Transfer("destiny.aspx",true);
Above statement will cause ViewState is invalid exception
Reason :By default EnableViewStateMac is set to true, and hence on every page life cycle , it tries to validate the value of the ViewState(for security reason) ,which is a part of forms collection(__ViewState - hidden field) and by ViewState design at any given point you can post to only one form...Hence in the prior case , it tries to compare the ViewState of the source with the destiny and hence the above mismatch happens Best practices to Transfer the control to the other page without affecting the view state
Option 1
Server.Transfer("destiny.aspx",false);
Option 2
Passing Server control value between pages
http://msdn2.microsoft.com/en-us/library/6c3yckfw(vs.71).aspx
I hope this helps!.
Regards,
-Vinayak
Tuesday, December 21, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment