2013-02-25 2 views
0

웹 사이트를 만들었고 세션에 데이터를 저장했습니다. 사용자가 세션을 중단하면 세션에서 데이터를 설정해야합니다.ASP.NET에서 세션 포기가 작동하지 않습니다.

Logout.aspx : Global.asax에있는

protected void Page_Load(object sender, EventArgs e) 
    { 
     try 
     { 
      WebUser user = (WebUser)Session["User"]; 
      Session["User"] = null; 
      Session.Abandon(); 
      if (user != null) 
       SentiWordnetUtils.LogYaz(user.uAdi + "\t Çıkış Yaptı"); 


      if ((Request.Cookies["OturumRef"] != null)) 
       Response.Cookies["OturumRef"].Value = string.Empty; 

      Response.Redirect("Login.aspx"); 
     } 
     catch (Exception ex) 
     { 
      LogYaz("Oturum Sonlandırma Hatası "+ex.Message.ToString()); 
     } 

    } 

session_end 기능 :이 코드는 지역에 노력하고 있지만 IIS에서 작동하지 않는

void Session_End(object sender, EventArgs e) 
    { 
     List<TBL_SentiWordNet> tempList = (List<TBL_SentiWordNet>)Session["listProcess"]; 
     if (tempList == null) 
      return; 
     using (DataClassesDataContext dc = new DataClassesDataContext()) 
     { 
      foreach (TBL_SentiWordNet word in tempList) 
      { 
       var a = (from i in dc.TBL_SentiWordNets where i.id == word.id select i).FirstOrDefault(); 

       a.state = 0; 

      } 
      dc.SubmitChanges(); 
     } 
     Session["listProcess"]= null; 
     Session["User"] = null; 


    } 

. a.state은하지 않을 0

의 Web.config :

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <system.web> 
    <sessionState mode="InProc" timeout="30" /> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
     <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
     </assemblies> 
    </compilation> 
    </system.web> 
    <connectionStrings> 
    <add name="myconnectionstring" connectionString="Data Source=127.0.0.1;Initial Catalog=mydb;Persist Security Info=True;User ID=userID;Password=password" providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <system.webServer> 
     <defaultDocument> 
      <files> 
       <clear /> 
       <add value="default.aspx" /> 
       <add value="Default.htm" /> 
       <add value="Default.asp" /> 
       <add value="index.htm" /> 
       <add value="index.html" /> 
       <add value="iisstart.htm" /> 
      </files> 
     </defaultDocument> 
    </system.webServer> 
</configuration> 

답변

관련 문제