Tuesday, September 24, 2013

Understanding (and testing for) view state MAC in ASP.NET web forms

Remember view state? For that matter, do you even remember web forms?! I kid because although MVC is the new hotness in the world of building ASP.NET websites, web forms remains the predominant framework due to both the very long tail of sites already built on it and the prevalence of developers with skills in this area who haven't made the transition to MVC (indeed some people argue that they can happily cohabit, but that's another discussion for another day). Anyway, back to view state. When we entered the world of .NET more than a decade ago now, view state was the smoke and mirrors that turned that stateless HTTP protocol into something that actually persisted data across requests entirely automagically. If, like me, you'd come from a classic ASP world you would have been used to a lot of plumbing going into passing data between requests and manually binding it back up to HTML controls to create the veneer of persistence. View state also made for a much lower friction transition process for folks moving from a win forms world where these problems of persistence didn't exist like they do in the web world. Ok, it could get out of control very quickly and many people bemoaned the (often hefty) overhead it could put on page and request sizes, but it served it a purpose. But there's one thing about view state that I suspect many people don't know and even if they've messed with it before, may not understand the consequences: MAC. This is actually a very important feature of view state and misusing it can not only leave you vulnerable now but you may very well find it becomes a breaking change in future versions of ASP.NET. Let me explain what it is, why you need it and how to test whether it's been disabled on a site.

I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This article is related to

C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials, ASP.Net