Pages settings don’t work for pre-compiled ASP.Net applications


My customer had a viewstate MAC validation problem. As a workaround, he wanted to disable the viewstate MAC validation before find out the final solution. However, he was still seeing the problems after added follow settings in the configuration files.

<pages validateRequest="false" enableEventValidation="false" enableViewStateMac="false" viewStateEncryptionMode="Never">

Customer’s application is a pre-compiled ASP.Net application with updatable option disabled. Looking at the code generated by compiler with above settings, we found these settings are hard coded. So, this means simply add the above setting into web.config doesn’t affect a pre-compiled application. To make this taking affect, the application has to be re-compiled.

[DebuggerNonUserCode]

private void __BuildControlTree(default_aspx __ctrl)

{

    __ctrl.EnableViewStateMac = false;

    __ctrl.EnableEventValidation = false;

__ctrl.ViewStateEncryptionMode = ViewStateEncryptionMode.Never;

This is a by-design behavior.

ASP.NET Precompilation Overview

http://msdn.microsoft.com/en-us/library/bb398860.aspx

See you next time,

Wei Zhao

Comments (5)

  1. V says:

    Good to know!

  2. Mr. Ken says:

    Thank you very much, great article.

    --------------End--------

    tudailoan.com

  3. Rrend says:

    Thank You! Save me a lot of time.

  4. Trung Thanh says:

    Thank you very much! This article save me a lot of time.


    http://thanhnt.com

Skip to main content