Is it possible to define a particular folder to be cookieless in IIS7, instead of just the root?
2 Answers
This is more of an ASP.NET question than an IIS question.
A regular folder cannot have session state "defined" (i.e. InProc, SessionState, SQLServer, cookieless). However, if you mark a folder as an application then you can disable session state for that application. Additionally, you can disable session state per file if you want.
However, the element in web.config can be set at any level and it will completely disable session state for you. You can set it in web.config in the folders that you don't want it like so:
<system.web>
<pages enableSessionState="false" />
</system.web>
Or you can set it in the root for a number of folders, like so:
<location path="images">
<system.web>
<pages enableSessionState="false" />
</system.web>
</location>
<location path="css">
<system.web>
<pages enableSessionState="false" />
</system.web>
</location>
- 16,599
Create another domain for cookieless elements such as images, js and css, then make them cookieless. The cookie setting works per domain (or subdomain) than per folder.