<?xml version="1.0" encoding="iso-8859-9" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwizguide.com/rss_namespace/">
 <channel>
  <title>Datakent Forum : Session Problemi ve Çözümü</title>
  <link>http://forum.datakent.com/</link>
  <description>XML içerik linki; Datakent Forum : C# &amp; ASP.NET : Session Problemi ve Çözümü</description>
  <pubDate>Sat, 09 May 2026 21:21:10 +0000</pubDate>
  <lastBuildDate>Wed, 14 Jul 2010 10:38:18 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.54</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.datakent.com/RSS_post_feed.asp?TID=1947</WebWizForums:feedURL>
  <image>
   <title>Datakent Forum</title>
   <url>http://forum.datakent.com/forum_images/datakent.com_forums.png</url>
   <link>http://forum.datakent.com/</link>
  </image>
  <item>
   <title>Session Problemi ve Çözümü : Hocam cevap yazmaktan &#231;ok murat...</title>
   <link>http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4247#4247</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://forum.datakent.com/member_profile.asp?PF=3122" rel="nofollow">turknetyazilim</a><br /><strong>Konu:</strong> 1947<br /><strong>Gönderim Zamanı:</strong> 14.Temmuz.2010 Saat 10:38<br /><br /><P>Hocam cevap yazmaktan çok murat abiyle burda kod kapıştırıyoruz:)</P>]]>
   </description>
   <pubDate>Wed, 14 Jul 2010 10:38:18 +0000</pubDate>
   <guid isPermaLink="true">http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4247#4247</guid>
  </item> 
  <item>
   <title>Session Problemi ve Çözümü : senden ba&#351;ka cevap yazan yok mu...</title>
   <link>http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4246#4246</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://forum.datakent.com/member_profile.asp?PF=3864" rel="nofollow">h.cetiner</a><br /><strong>Konu:</strong> 1947<br /><strong>Gönderim Zamanı:</strong> 13.Temmuz.2010 Saat 16:16<br /><br /><P>senden başka cevap yazan yok mu ismail?</P>]]>
   </description>
   <pubDate>Tue, 13 Jul 2010 16:16:58 +0000</pubDate>
   <guid isPermaLink="true">http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4246#4246</guid>
  </item> 
  <item>
   <title>Session Problemi ve Çözümü : Arkada&#351;lar yukar&#305;daki &#231;&#246;z&#252;mde...</title>
   <link>http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4240#4240</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://forum.datakent.com/member_profile.asp?PF=3122" rel="nofollow">turknetyazilim</a><br /><strong>Konu:</strong> 1947<br /><strong>Gönderim Zamanı:</strong> 12.Temmuz.2010 Saat 12:12<br /><br />Arkadaşlar yukarıdaki çözümde postback den çaktı.<DIV>En sağlam kodu veriyorum.Kesin. Çözüm % 100 çalışıyor<BR><FONT color=#0000ff size=2><FONT color=#0000ff size=2><P>&lt;</FONT></FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>script</FONT></FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>language</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>="javascript"</FONT></FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>type</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>="text/javascript"&gt;</P></FONT></FONT><FONT size=2><P>window.onbeforeunload = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>function</FONT></FONT><FONT size=2>() {</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>((window.event.clientX&lt;0) || (window.event.clientY&lt;0))</P><P>{</P><P>document.getElementById(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>'ctl00_LoginControlBox1_hpLogOff'</FONT></FONT><FONT size=2>).click();</P><P>}</P><P>} </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2><P>&lt;/</FONT></FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>script</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>&gt;</P><DIV></DIV><FONT color=#a31515>'ctl00_LoginControlBox1_hpLogOff' bu isim güvenli çıkış butonun html tarafındaki ismi ve ben usercontrol içersinde olduğu için bu şekilde bir ismi var sizde değişik olabilir.</FONT></FONT></FONT></DIV>]]>
   </description>
   <pubDate>Mon, 12 Jul 2010 12:12:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4240#4240</guid>
  </item> 
  <item>
   <title>Session Problemi ve Çözümü : Merhaba;  arkada&#351;lar bir ka&#231;...</title>
   <link>http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4238#4238</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://forum.datakent.com/member_profile.asp?PF=3122" rel="nofollow">turknetyazilim</a><br /><strong>Konu:</strong> 1947<br /><strong>Gönderim Zamanı:</strong> 11.Temmuz.2010 Saat 17:57<br /><br />Merhaba;<DIV>&nbsp;</DIV><DIV>arkadaşlar bir kaç gündür bununla uğraşıyordum bir çözüm yolu buldum paylaşayım dedim.Asp.net ve Session ile uğraştığınız zaman bu session bazen uyuzkuk yapıyor.</DIV><DIV>&nbsp;</DIV><DIV>Bilindiği üzere sessiondaki bir değişkene değer atandığı zaman o değer&nbsp; tarayıcı kapanana kadar veya session manuel olarak Session.Abandon();&nbsp;komutu ile sonladırılına kadar orda tutulur.</DIV><DIV>&nbsp;</DIV><DIV>diyelim ki üyeler isminde bir tablonuz var.alanlar ve tipleri şu şekilde</DIV><DIV>üyeno otomatik sayı </DIV><DIV>kullaniciadi varchar(50)</DIV><DIV>parola varchar(50)</DIV><DIV>üyeonlinemı bit</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>bu tabloya göre kullanıcı giriş yapacak ve giriş yaptığında online olacak. yani bilgiler doğrulandıktan</DIV><DIV>sonra üye giriş yapmıştır ve artık online dır.</DIV><DIV>update üyeler üyeonlinemi=1 where üyeno=X</DIV><DIV>&nbsp;</DIV><DIV>daha sonra&nbsp; online üyeleri getiren sql de şu şekilde olsun</DIV><DIV>select * from üyeler where üyeonlinemi=1&nbsp;&nbsp; bu sorguda online üyeleri getirir.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>şimdi üye çıkış yaptığında yani tüm sessionları öldürdüğünde.</DIV><DIV>bunu mesela bir butonun click eventinde yaptığımızı düşünelim</DIV><DIV>o üye artık çıkış yaptığı için artık online değildir. ve üyeonlinemi alanı=o olmalıdır.</DIV><DIV>bunuda diyelim bir linkbutton un(Çıkış butonu) click eventine yazdığımızı düşünelim.</DIV><DIV>Sessionları sonlardırmadan önce üye yi online durumundan düşürmemiz lazım.</DIV><DIV>yani şöyle bir sql işleyecek.</DIV><DIV>update üyeler üyeonlinemi=0 where üyeno=session&#091;üyeno&#093; gelecek</DIV><DIV>şeklinde. buraya kadar herşey güzel.çıkış olayını adam bizim koyduğumuz linkbutona tıklayıpta çıkarsa sorun olmuyor. ama kalkıpta bizim koyduğumuzdan butona tıklamayıpta tarayıcıyı kafattığında ozaman bizim </DIV><DIV>update üyeler üyeonlinemi=0 where üyeno=session&#091;üyeno&#093;&nbsp; çalışmıyor.</DIV><DIV>yani üyemiz hale online gözüküyor.Bu yanlış</DIV><DIV>Bunun için global.asax dosyasında farklı eventleri inceledim</DIV><DIV>fakat hiçbirim işimi görmedi.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Örnek mesela</DIV><DIV>Session_end olayı burda ben</DIV><DIV>update üyeler üyeonlinemi=0 where üyeno=session&#091;üyeno&#093;</DIV><DIV>böyle bir kod işletmeye kalktığımda zaten session öldüğünden session daki değere erişemiyorum.</DIV><DIV>O bende aşağıdaki gibi bir kod geliştirdim.</DIV><DIV>İlk düşündüğüm şuydu.</DIV><DIV>Acaba ben ie yi kapattığımda hangi olay tetiklenir.Kürşat hocamın gönderdiği bir javascript kod aklıma bir fikir getirdi.Dedim buldum.</DIV><DIV>o event Page nesnesinin unload yordamıydı.</DIV><DIV>Şimdi bu kadar hikayeden sonra Coding...<img src="http://forum.datakent.com/smileys/smiley4.gif" height="17" width="17" border="0" alt="Big smile" title="Big smile" /></DIV><DIV>&nbsp;</DIV><DIV>Öncelikle projenizde bir masterpage ve bu masterpage i kullanan bir default.aspx sayfanızız olduğunu varsayayıroum.Bu işlemi Page nesnesinden yapmamız lazım.Gidipte masterpage de yapamayız.Çünkü masterpage bir usercontrolden türemiştir.ve Page nesnesinin özelliklerini,yordamlarını vs taşımaz.</DIV><DIV>&nbsp;</DIV><DIV>Default.aspx Code Behind<BR><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>protected</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> Page_Load(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EventArgs</FONT></FONT><FONT size=2> e){</P><DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (!Page.IsPostBack){</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.Unload += </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EventHandler</FONT></FONT><FONT size=2>(Default_MainPage_Unload);}</FONT><FONT size=2></DIV><P>}</P></FONT></DIV><DIV>&nbsp;</DIV><DIV><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> Default_MainPage_Unload(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EventArgs</FONT></FONT><FONT size=2> e){</P><P></P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (Session&#091;</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"üyeno"</FONT></FONT><FONT size=2>&#093; != </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>null</FONT></FONT><FONT size=2>){</P><P>burda sql sorgunuz işleyecek : update üyeler üyeonlinemi=0 where üyeno =sessiondaki üyeno</P><DIV></FONT><FONT size=2></DIV><P>}</P><P>}</P></FONT></DIV><DIV>bunları yaptıktan sonra artık kullanıcı üye girişi yapıp sizin koyduğunuz çıkış butonuna tıklamayıp gidip tarayıcıyı bile kapatsa online durumundan düşecektir.</DIV><DIV>herkese iyi çalışmalar.</DIV><DIV>written by iso</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Sun, 11 Jul 2010 17:57:39 +0000</pubDate>
   <guid isPermaLink="true">http://forum.datakent.com/forum_posts.asp?TID=1947&amp;PID=4238#4238</guid>
  </item> 
 </channel>
</rss>