asp.Netsessionはなぜ紛失したのですか?

8871 ワード

 :   Session           ?

 :           ,  :          ,       。



 :      Session.Abandon      Session_End  ?

 :  Session_End     InProc(    )   Session。     Session_End  ,    Session(        Session ),           (            )。



 :      InProc     Session     ?

 :                  ,        Session ,Session    aspnet_wp   ,       Session       ,                            。

        :

 Session variables are lost intermittently in ASP.NET applications

 http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316148

  1.0       bug             , bug   1.1 sp2   。

    bug        :

 ASP.NET Worker Process (Aspnet_wp.exe) Is Recycled Unexpectedly.

 http://support.microsoft.com/default.aspx?scid=kb;en-us;Q321792



 :    Session    Abandoned , Session ID      ?

 :  SessionID              , Session          Session ,         SessionID,   Session   ,      SessionID   。



 :        SessionID    ?

 :         Session           ,             Session。 Session       SessionID         ,   SessionID      。



 :ASP ASP.NET        Session?

 :  。             ,            ,   :http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ConvertToASPNET.asp



 :            Session ?

 :      Session   ,        (InProc) Session             。       InProc   ,                  ,               ,          ( InProc) Session 。



 :    Session_End     Response.Redirect Server.Transfer      ?

 :Session_End                  。                ,                 HttpRequest  ,         Response.Redirect Server.Transfer  。



 : Session_End       HttpContext  ?

 :  ,               (Request)   ,          。



 : Web Service      Session?

 :   Web Service   Session,   Web Service            ,         Web Service    Cookie。       MSDN   HttpWebClientProtocol.CookieContainer  。  ,            Web Service       ,      Session。



 :       HttpHandler   ,       Session?

 :      HttpHandler   ,      Session                 : IRequiresSessionState IReadOnlySessionState,              ,            INamingContainer       。



 :    webfarm ,         Web    Session      ?

 :       :

 PRB: Session State Is Lost in Web Farm If You Use SqlServer or StateServer Session Mode

 http://support.microsoft.com/default.aspx?scid=kb;en-us;325056



 :     Session Application_OnAcquireRequestState     ?

 :Session   HttpApplication.AcquireRequestState          。

        :

 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhandlingpublicevents.asp



 :     cookieless,     HTTP     HTTPS?

 :        :

 String originalUrl = "/fxtest3/sub/foo2.aspx";

 String modifiedUrl = "https://localhost" + Response.ApplyAppPathModifier(originalUrl);

 Response.Redirect(modifiedUrl);



 :Session global.asax         ?

 :Session   AcquireRequestState      ,             Session。





 :      Session        ?

 :         Session.Keys   。    :

ArrayList sessionCollection = new ArrayList();

foreach (string strKey in Session.Keys){

  sessionCollection.Add(Session[strKey]);

}

 

 :               Session?

 :      。       ASP ASP.NET    Session。



 :Session.Abandon Session.Clear    ?

 :            Session.Abandon ,   Session_End  (InProc   )。             Session_Start  。 Session.Clear    Session            Session,           。

 

 :        Session    ,Session         ?

 :Session   Reader/Writer    :

     Session      (    <%@ Page EnableSessionState="True" %>  ),            Session       。

     Session      (    <%@ Page EnableSessionState="ReadOnly" %>  ),            Session       。

            ;          ;             。                       Session ,          (     )   ,    。



 :Session         ?

 :Session               (  ) Session,        (         ),         ,         。  ,       Session。            Session,      。

 

 : global.asax         Session     ?

 :               Session,Session AcquireRequestState       ,                   Session,      。



 :             Session    ,         Session["Key"]    ?

 :Session["Key"]    this.Session["Key"],    Page        ,                  。            Session:

 HttpContext.Current.Session["Key"] = "My Seesion Value";



 :    InProc    Session ,   Session      ?

 :   IIS       ,

      IIS5   Session    aspnet_wp.exe       。

      IIS6 ,                   ,Session   w3wp.exe      。



 :Session           ?

 :   ,   20  。



 :          Session      ?    Session_End         ,     ,   ?

 : Session_End   Session   InProc        。Session_End        aspnet_wp       (     machine.config   )。  ,   Session_End   ,          SQL,     aspnet_wp         ,            SQL      。

 

 :       cookieless true            Session?

 :   cookieless ,                   ,        ASP.NET    URL   SessionID。

   : \myDir\mySubdir\default.aspx  ..\default.aspx  。



 :   SortedList   Session  Cache ?

 :        :

 SortedList x = new SortedList();

 x.Add("Key1", "ValueA");

 x.Add("Key2", "ValueB");

    Session :

 Session["SortedList1"] = x;

          :

 SortedList y = (SortedList) Session["SortedList1"];

 Chahe   。

 

 :              “Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive”?

 :              Microsoft Visual Studio .NET        ,   Window Sharepoint Server(WSS)   。

 WSS ISAPI           。            ASP.NET      ,ISAPI             URL。

      :      WSS      Session。

        :

 Session state cannot be used in ASP.NET with Windows SharePoint Services

 http://support.microsoft.com/default.aspx?scid=kb;en-us;837376



 :    Session  ?

 :    Session      HttpSessionState.Remove()  。

 

 :            Session           ?

 :  。           ,                。                          。

 

 :       frameset,     frame      SessionID           ,   ?

 :     frameset     htm      ASPX  。

        ,  frameset aspx  ,       ,         Web   ,       SessionID,          Frame      ,       SessionID     ,  FrameSet   SessionID。

        Html   FrameSet  ,       HTML  ,                 Session  ,         Frame     ,             SessionID,                。         ,SessionID    ,            SessionID。

 

 :            Session      SQL Server          。

 :  ,   :

 FIX: Using one SQL database for all applications for SQL Server session state may cause a bottleneck

 http://support.microsoft.com/default.aspx?scid=kb;en-us;836680



 : Session_End           HttpSessionState HttpContext  ?

 :           HttpSessionState  ,      Session     。      HttpContext  ,                ,          。



 : SQLServer     Session,     Session   ?

 : SqlServer   ,Session      SQL Agent        ,     SQL Agent    ?

 

 :    EnableSessionState “ReadOnly” ,    InProc         Session  ,     ?

 :  EnableSessionState   ReadOnly,   InProc           Session。      ,      Session      。



 :          SQL     ?

 :                。             :

 How To Use the ASP.NET Utility to Encrypt Credentials and Session State Connection Strings

 http://support.microsoft.com/default.aspx?scid=kb;en-us;329290



 :             Session ?

 :    HttpContext.Current.Session    ,      :

 HttpContext.Current.Session["SessionKey"] = "SessionValue";

                Application  。

 



 :       SQLServer           ?

 :   Session              SQLServer      ,            。

 



 : Session   cookieless       ?

 :  cookieless   true ,         :

 1、            

 2、         Http Https                 。

             ,   URL     Session ID   ,          Session。



 :     Session       ?

 :    ,       :http://support.microsoft.com/default.aspx?scid=kb;en-us;311209 

参考資料:開発者オンラインhttp://www.builder.com.cn/