ASP.NET - Render Hidden Fields at the Top of a Form with .NET 3.5 SP1

I just came across a nice feature in ASP.NET 3.5 SP1 (currently in Beta) that I didn’t realize was included.  It’s always nice to discover hidden gems from time to time.  With ASP.NET 1.0, 1.1, 2.0 and 3.5 applications if a user or JavaScript function tried to do a postback before all of the ViewState and EventValidation data was loaded in the browser, a ViewState MAC validation error could be raised by the server.

In ASP.NET 3.5 SP1 Microsoft provides a new attribute on the <pages> element in web.config that now allows all hidden fields to be rendered at the top of a form rather than at the bottom which can help to avoid the ViewState MAC validation error when people perform a postback operation before the page has finished loading.  The attribute is named renderAllHiddenFieldsAtTopOfForm (which does what it says) and defaults to a value of true.  .NET 3.5 SP1 is currently in beta but once it’s officially released the new attribute is definitely a nice enhancement to the ASP.NET framework.

 

 

Need to display OrgCharts, site maps or other hierarchies in your ASP.NET applications?  Check out SmartChartPro.

Published Tuesday, July 22, 2008 2:35 PM by dwahlin
Filed under: ,

Comments

# re: ASP.NET - Render Hidden Fields at the Top of a Form with .NET 3.5 SP1

Tuesday, July 22, 2008 7:19 PM by Bill Beckelman

Thanks for the tip. That will definitely help as that is always a fun one to deal with. The trade off in perceived speed should be worth not having the page blow up.

# Always 英文技术文章参照( 十 ){ UpdateTime:2008-7-24; } My article in the cnblogs

Wednesday, July 23, 2008 8:48 PM by cnblogs.com

推荐: 1.第一名: iconfinder图标搜索。 2. Visual Studio2005 AND 2008 拼写检查工具( 更新版 )。 3. 超级时间节省器之免费的Sql Server工具。

# Link Listing - July 26, 2008

Sunday, July 27, 2008 1:03 AM by Christopher Steen

Link Listing - July 26, 2008