Session state non può essere utilizzato in ASP.NET con Windows SharePoint Services.
Ecco la sorpresa del lunedì mattina.

Fortunatamente una KB di support.microsoft.com fornisce un ottimo workaround al problema.
Le modifiche vengono applicate al file web.config responsabile della nostra applicazione.

Vengono disabilitati gli handler di WSS e ripristinati gli handler di asp.net
Il livello di sicurezza delle pagine viene impostato a Full Trust.
Viene attivato il modulo di sessione a livello di applicazione.

E' necessario applicare tutti e tre queste tecniche per girare il problema, la sola modifica
delle direttive page per il modulo di sessione non fornisce la soluzione ricercata.

<!-- Clear out the WSS ASP.NET handler and specify the default ASP.NET handler for all pages. --> 
    
<httpHandlers
        <
clear /> 
        <
add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactorySystem.WebVersion=1.0.5000.0Culture=neutralPublicKeyToken=b03f5f7f11d50a3a" /> 
    </
httpHandlers>

<!
-- Set the trust to Full. WSS configures a very restrictive trust policy that does not allow ASP.NET Web application to run correctly. --> 
    
<trust level="Full" originUrl="" /> 

<!
-- Enable the session module. This can also be enabled on the WSS Web.config, but is not enabled by default. If you receive the following message: Parser Error Message: The module 'Session' is already in the application and cannot be added again. You can remove the following <httpModules></httpModules> section as session is already enabled on the virtual server. --> 
    
<httpModules
        <
add name="Session" type="System.Web.SessionState.SessionStateModule"/> 
    </
httpModules

<!
-- Enable session state for all the pages in the Web application. --> 
    
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false/>

 

powered by IMHO 1.2