locked
Problem while enabling ViewState Encryption RRS feed

  • Question

  • User-614943948 posted

    I used this source code in my web.config file to enable viewstate encryption

    <system.web>  
      <pages viewStateEncryptionMode="Always" />  
    </system.web>  

    But after adding this line, i am coming across this IIS Error

    HTTP Error 500.19 - Internal Server Error
    The requested page cannot be accessed because the related configuration data for the page is invalid.
    
    Detailed Error Information:
    Module	   IIS Web Core
    Notification	   BeginRequest
    Handler	   Not yet determined
    Error Code	   0x800700b7
    Config Error	   Config section 'system.web/pages' already defined. Sections must only appear once per config file. See the help topic <location> for exceptions
    Config File	   \\?\F:\Maverick\Projects\Grids\Grid_Live\web.config
    Requested URL	   http://localhost:80/GridView/
    Physical Path	   F:\Maverick\Projects\Grids\Grid_Live\
    Logon Method	   Not yet determined
    Logon User	   Not yet determined
    
    Config Source:
       72:     <sessionState mode="InProc" cookieless="true" timeout="20"/>
       73:     <pages buffer="true" enableEventValidation="false">
       74:       <controls>

    Why enabling ViewState Encription is causing an eerror for page bugger?

    Monday, February 15, 2021 12:01 PM

All replies

  • User475983607 posted

    The error message clearly explains the problem.

    Config section 'system.web/pages' already defined.

    It seems you added another "page" node rather than modifying the existing "page" node.

    Monday, February 15, 2021 1:10 PM
  • User-1545767719 posted

    I used this source code in my web.config file to enable viewstate encryption

    <system.web>  
      <pages viewStateEncryptionMode="Always" />  
    </system.web>

    Why don’t you leave the ViewStateEncryptionMode setting default (i.e., Auto) and use the Page.RegisterRequiresViewStateEncryption method only on the page where the encryption of ViewState is really required?

    Tuesday, February 16, 2021 2:19 AM