Search code examples
asp.netasp.net-mvcasp.net-mvc-3httpcookie

Getting error "the element 'httpCookies' has been locked in a higher level configuration"


I'm getting the error "The element 'httpCookies' has been locked in a higher level configuration" when i try to access an asp.net mvc 3 application. This happens when i add the line below inside my <system.web> section.

<httpCookies httpOnlyCookies="true" requireSSL="true" lockItem="true" />

This is happening on windows server 2003 (IIS 6). The error doesn't occur on windows 7 & Windows 2008 R2 (IIS 7 & above)

I have checked the machine.config file on both the windows 2003 server and my windows 7 development machine and it contains below line on both machines.

<section name="httpCookies" type="System.Web.Configuration.HttpCookiesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Solution

  • Removing the attribute lockItem="true" resolved the issue but i still have no clue in which higher level configuration it is locked.

    So my line now looks like below

    <httpCookies httpOnlyCookies="true" requireSSL="true" />