<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Ani S Menon's Blog- My Little thoughts</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/amenon/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/amenon/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:47:10 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Troubleshooting WorkerProcess Crash</title>
      <link>https://docs.microsoft.com/archive/blogs/amenon/troubleshooting-workerprocess-crash</link>
      <pubDate>Thu, 30 Aug 2007 18:44:00 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amenon/2007/08/30/troubleshooting-workerprocess-crash/</guid>
      <description><![CDATA[&nbsp;
Hello, 
There are some great blogs out there which gives a lot of in-depth information on...]]></description>
      <content:encoded><![CDATA[<P mce_keep="true">&nbsp;</P>
<P>Hello, 
<P>There are some great blogs out there which gives a lot of in-depth information on debugging. My main aim with this blog is to give an introduction to those who are very much new to debugging. . 
<P>In this blog I will try to explain how well we can troubleshoot Worker process Crash issues due to Stack Over flow exceptions. 
<P>Setting up Windows Debugger 
<P>========================= 
<P>Go ahead and download windows Debugger from the site. 
<P><A href="https://www.microsoft.com/whdc/devtools/debugging/default.mspx" mce_href="https://www.microsoft.com/whdc/devtools/debugging/default.mspx">https://www.microsoft.com/whdc/devtools/debugging/default.mspx</A> 
<P>By default it gets installed in C:\Program Files\Debugging Tools for Windows. Open Windbg à File àset the symbol file path as srv*C:\Symbols\Pub*https://msdl.microsoft.com/download/symbols. 
<P>Create a folder Symbols and a subfolder Pub under C:\, press ok and Save the work space. This folder is to store the publicly available symbols from Microsoft (<A href="https://msdl.microsoft.com/download/symbols" mce_href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</A>) 
<P>Setting up Debug Diag to Capture Crash dumps 
<P>========================================== 
<P>Install the latest version of DebugDiag <A href="https://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;displaylang=en" mce_href="https://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;displaylang=en">https://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;displaylang=en</A> 
<P>Configure DebugDiag to capture the memory dump when the ExitProcess or TerminateProcess&nbsp; command is called. This will ensure that we capture the memory dump when the faulting thread is terminating the process. 
<P>1. Open DebugDiag 
<P>2. On the Rules tab, click Add Rule 
<P>3. Select Crash and click Next 
<P>4. Select "All IIS Processes" and click Next 
<P>5. Under Advanced Settings, click Breakpoints 
<P>6. Click Add Breakpoint... 
<P>7. Select KERNEL32!ExitProcess and Kernel32!TerminateProcess .Change Action Type to Full UserDump 
<P>8. Click OK 
<P>9. Click Save and Close 
<P>10. Click Next through the rest of the wizard 
<P>Now whenever the crash occurs DebugDiag will capture the dump. By default it will be under C:\Program Files\DebugDiag\Logs\Crash rule for all IIS_COM+ related processes . 
<P>Make sure that you disable all the health monitoring settings in IIS Application pool to prevent the dumps getting generated due to a normal application pool recycle. 
<P>Once you have the dump load the same in Windbg. File&nbsp;--&gt;Open Crash dump. 
<P>Type in the following command in the debugger to get the symbols files for all the loaded modules from the symbol file path 
<P><B>.reload /f</B> --&gt; reloading the modules (F is for forcing reload) 
<P>Once the debugger finishes downloading the symbols, open up C:\Symbols\Pub folder and you can see the Public symbols that got downloaded. From next time onwards debugger will be getting symbols from this cached location. 
<P>In order to run the commands and look through the dumps we need the SOS.dll which comes along with .Net Framework. Copy SOS.dl from C:\WINNT\Microsoft.NET\Framework\&lt;Respective Version&gt;\ and put it under C:\Program Files\Debugging Tools for Windows folder. 
<P>For getting help on the commands available in SOS.dll type <B>!help</B> on the debugger window . You will be able to see the list of commands available. If you need further help on any command type in <B>!help &lt;Command Name&gt;</B> Eg :- <B>!help eeheap</B> 
<P>Now to look at the threads type in <B>!threads.</B> 
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_12.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_12.png" mce_href="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_12.png" atomicselection="true"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=242 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_12.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_12.png" width=1147 border=0 mce_src="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_12.png"></A> </P>
<P>We can see that thread 14 is the one which has caused the stack over flow exception.</P>
<P>We are thread 0 now. To move to thread 14 type <STRONG>~14s</STRONG> . To see the native call stack type <STRONG>kpn</STRONG></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_2.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_2.png" mce_href="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_2.png" atomicselection="true"><IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=386 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_2.png" width=889 border=0 mce_src="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_2.png"></A> </P>
<P>To see the Managed stack type <STRONG>!clrstack</STRONG></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_3.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_3.png" mce_href="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_3.png" atomicselection="true"></A><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_9.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_9.png" mce_href="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_9.png" atomicselection="true"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=294 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_9.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_9.png" width=965 border=0 mce_src="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_9.png"></A> </P>
<P>We can see that a function <STRONG>UserLogin()</STRONG> is getting called recursively which us causing the stack to overflow. Now let us try getting more details on the function such as the module and assembly name from which this function gets called.</P>
<P>Select a Code adress (Second column)&nbsp;from the above stack and type in <STRONG>!ip2md 02575e3a</STRONG></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_11.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_11.png" mce_href="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_11.png" atomicselection="true"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=149 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_11.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_11.png" width=781 border=0 mce_src="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_11.png"></A> </P>
<P>We can see the module name(02207a80), type in <STRONG>!dumpmodule</STRONG> to dump out the module information</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_13.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_13.png" mce_href="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_13.png" atomicselection="true"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=188 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_13.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_13.png" width=985 border=0 mce_src="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_13.png"></A> </P>
<P>You can see that the <STRONG>UserLogin()</STRONG> function is getting called from the assembly App_Web_itzw09g-.dll</P>
<P>You can dump out the module information using <STRONG>lmvm </STRONG>command</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_8.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_8.png" mce_href="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_8.png" atomicselection="true"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=310 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_8.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_8.png" width=1061 border=0 mce_src="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/4cbbbd3f7756_F736/image_thumb_8.png"></A> </P>
<P>Save the assembly to local disc using the command <STRONG>!savemodule App_Web_itzw09g_ c:\Assembly.dll </STRONG>and use reflector to get the function details.</P>
<P>Download Reflector</P>
<P><A title=https://www.aisto.com/Roeder/Frontier/Default.aspx?PermaLink=53 href="https://www.aisto.com/Roeder/Frontier/Default.aspx?PermaLink=53" mce_href="https://www.aisto.com/Roeder/Frontier/Default.aspx?PermaLink=53">https://www.aisto.com/Roeder/Frontier/Default.aspx?PermaLink=53</A></P>
<P>Pass your comments to know whether this blog was helpful.....</P>
<P>So till next time..Bye bye...</P>
<P>Ref:- <A title=https://support.microsoft.com/kb/892277 href="https://support.microsoft.com/kb/892277" mce_href="https://support.microsoft.com/kb/892277">https://support.microsoft.com/kb/892277</A></P>]]></content:encoded>
    </item>
    <item>
      <title>Using ASP.NET Tracing to Troubleshoot Session Loss</title>
      <link>https://docs.microsoft.com/archive/blogs/amenon/using-asp-net-tracing-to-troubleshoot-session-loss</link>
      <pubDate>Fri, 24 Aug 2007 21:59:04 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amenon/2007/08/24/using-asp-net-tracing-to-troubleshoot-session-loss/</guid>
      <description><![CDATA[Hi Again, This post is an Add-on to my previous blog. Yesterday I got my 15th Session loss case....]]></description>
      <content:encoded><![CDATA[<p>Hi Again, <p>This post is an Add-on to my previous blog. Yesterday I got my 15th Session loss case. This is the second time the same issue is coming to me and it took hardly 15 minutes for me to solve the same. But for the first time when we were troubleshooting the issue it took more than 8 hours to figure out what’s happening. Ok let’s start. <p><b><u><font size="3">Some Session variables are lost while moving between pages.</font></u></b> <p>Session variables are suddenly lost when we move from one page to another. That too only some specific session variables. There is no application domain restart, issue&nbsp;happens to all users from all machines&nbsp;and is consistently reproducible. <p>This is a little tricky scenario where we end up using all our troubleshooting skills and still end up at the “No Where” Side. <img alt="Happy" src="https://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif"> <p>Customer had created a simple ASP.Net application to reproduce the issue. There were only two pages, In Page 1 he was setting some Session variables .On click of&nbsp; "Move to Page2" we are redirected to page 2 where we print the Session variables. Page 2 contains an &lt;Img &gt; tag whose source is pointed to an image which doesn’t exist at all. So when we access the page we will see a cross sign.  <p>Page 1 <p>========================= <p>Session["Value1"] = "Ani"; <p>Session["Value2"] = "Menon"; <p>&nbsp; <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="275" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb.png" width="480" border="0"></a>  <p>Page 2 <p>======================= <p>Label1.Text = "First Value : " + Session["Value1"].ToString(); <p>Label2.Text = "Second Value : " + Session["Value2"].ToString(); <p>&nbsp; <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_2.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_2.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="281" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_2.png" width="470" border="0"></a>  <p>Now when click on “Back to Page 1” button, we are redirected to page 1, where we are trying to print the Session Values and Surprisingly one Session variable is lost. <blockquote> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_3.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_3.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="302" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_3.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_3.png" width="477" border="0"></a> </p></blockquote> <p>There is no other code in these pages and in Global.asax.cs (No session.clear() or Session.abandon etc). <p>Now the toughest part. How to troubleshoot this??&nbsp;<img alt="At wits end" src="https://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/102.gif"> !!!! .Here comes the power of ASP.Net tracing. Go ahead and enable tracing in Web.config file. <p>&lt;trace enabled="true"/&gt; <p>We tried browsing the pages again and checked for the sequence of events happening and found something interesting. <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_4.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_4.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="209" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_4.png" width="630" border="0"></a>  <p>See the figure above. We can see that there is a GET request for Error.aspx {from where this request came from <img alt="Worried" src="https://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/17.gif">!!}. <p>We checked the Virtual directory settings in IIS and found that under Custom Errors Tab customer has set a redirection to a custom Error Page for 404. File not found. <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_5.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_5.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="439" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_5.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_5.png" width="477" border="0"></a>  <p>(For demo purposes I am just redirecting to an Error&nbsp;page within the same directory as of the application, but in a complex real time scenario, this won’t be the case.) <p>We checked the Error.aspx.cs page and found that the Session value was set to “null” based on some condition. <p><b>Session["Value1"] = null;</b> <p>We removed the custom error page and that fixed the issue. Now the interesting thing is that if we have set a custom error page the 404 redirection won’t get logged in IIS logs or tools like fiddler (<a href="https://www.fiddlertool.com">www.fiddlertool.com</a>) as it is already been handled. <p><u>Fiddler trace with Custom Error Redirection</u> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_6.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_6.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="167" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_6.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_6.png" width="468" border="0"></a>  <p><u></u> <p><u>Fiddler trace without Custom Error Redirection</u> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_7.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_7.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="164" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_7.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/Usin.NETTracingtoTroubleshootSessionLoss_132AB/image_thumb_7.png" width="489" border="0"></a>  <p><u></u> <p>So ultimately what's happening was , when we are redirected to Page2.apsx a 404 is generated for &lt;IMG&gt;. This is handled by the custom Error page settings in IIS , which redirects the request to Error.aspx which which was clearing out the Session variable.<img alt="Cool" src="https://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/16.gif"> <p>Hope this helps…Until Next time... Bye Bye</p>]]></content:encoded>
    </item>
    <item>
      <title>Troubleshooting Session loss...</title>
      <link>https://docs.microsoft.com/archive/blogs/amenon/troubleshooting-session-loss</link>
      <pubDate>Tue, 21 Aug 2007 17:50:46 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amenon/2007/08/21/troubleshooting-session-loss/</guid>
      <description><![CDATA[Hi Guys,  I joined MS in April2006 and now it’s high time that I realized the need for a blog. I am...]]></description>
      <content:encoded><![CDATA[<p>Hi Guys,  <p>I joined MS in April2006 and now it’s high time that I realized the need for a blog. I am a member of the IIS/ASP.NET team here at Microsoft PSS. I troubleshoot, I deliver technical solutions to complex problems, and I work with software engineers/developers across the globe.  <p>One of the common and most difficult problems that I have to troubleshoot here in MS is Session loss. In this blog I will try to explain the different ways to approach a Session loss issue and the various reasons that can cause the same.  <p><b>Why to use ASP.Net Session?</b>  <p>HTTP is a stateless protocol, which means that it does not automatically indicate whether a sequence of requests is all from the same client or even whether a single browser instance is still actively viewing a page or site. As a result, building Web applications that need to maintain some cross-request state information (shopping carts, data scrolling, and so on) can be extremely challenging without additional infrastructure help.  <p><b>Where is Session Data Stored?</b>  <p>Session Data is stored on one of the following places depending on your application’s requirement  <ul> <li>In the worker process memory (InProc – Default)  <li>ASP.NET State Service  <li>SQL Server 2000 or higher database.</li></ul> <p><b>Session data Characteristics:-</b>  <ul> <li>Are stored per user.  <li>Are objects in memory and therefore must be checked before using.  <li>Are automatically discarded after a period of inactivity or on Session.Abandon(), Session.Clear().  <li>Session ID is issued on the first request by the server.  <li>Session ID is persisted in an in-memory cookie of the browser.</li></ul> <p><b>Identifying a session ID</b>  <ul> <li>Using a 120-bit <a href="https://msdn2.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.sessionid(VS.71).aspx">SessionID</a> string containing only the ASCII characters that are allowed in URLs. </li></ul> <p>• Fgazx3fsdqkww045itmtld45  <ul> <li>The SessionID strings are communicated across client-server requests either by means of an HTTP cookie or a modified URL with the SessionID string embedded, depending on how you configure the application settings.</li></ul> <p>Ok. Enough with basics, Let us move on to the troubleshooting part. Do remember one thing try to collect as much data as possible and try to isolate the issue to the lowest possible level. Proper isolation is the Key in Troubleshooting. And that’s the reason we are there for… J  <p>So what data we need and how to isolate? Let’s Begin. Try getting the answers for these questions.  <ul> <li>&nbsp;What Kind of application is it, whether it is ASP, ASP.NET 1.1 or ASP.NET 2.0? </li> <li>What do you mean by session loss? </li></ul> <blockquote> <p align="left">a. Are the users getting redirected to login page?  <p align="left">b. Is the Session variables in your application are giving Null values?  <p align="left">c. Are you seeing a custom error page which says session is Invalid? </p></blockquote> <ul> <li>How often does it happen? On each request? </li> <li>When it happens? When users are browsing the page or when they are sitting idle? </li></ul> <blockquote> <p>If idle, issue could be due to Session time out settings in Web.config </p></blockquote> <blockquote> <p>(&lt;sessionState mode="InProc" <b>timeout="20"</b> /&gt;), Application pool settings (Health monitoring), Forms Ticket getting expired etc. </p></blockquote> <blockquote> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_2.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_2.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="434" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_2.png" width="460" border="0"></a> </p></blockquote> <p>&nbsp;</p> <ul> <li>Does it happen simultaneously for all users or is it happening for only some users? </li></ul> <blockquote> <p>If all, then application domain or Worker process recycling would be the cause. If it’s happening for only some users there is a possibility that the Session state is set to (&lt;sessionState mode="InProc/&gt; and Web garden is enabled. </p></blockquote> <blockquote> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_3.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_3.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="432" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_3.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_3.png" width="458" border="0"></a> </p></blockquote> <p>&nbsp;  <ul> <li>Is this a Web farm scenario? If so what is the session state mode you are using? Inproc, State Server or SQl Server? </li></ul> <blockquote> <p>This can be checked in the web.config file in ASP.NET applications. (<a href="https://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/htm/UsingASPNET.asp">https://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/htm/UsingASPNET.asp</a> ) </p></blockquote> <blockquote> <p>If you are running Web farm and using Inproc Session that could be the possible cause of session loss as all the Session information is stored within the Worker process. </p></blockquote> <blockquote> <p>Format of the sessionState section: </p></blockquote> <blockquote> <p>&lt;sessionState  <p>mode="InProc"  <p>stateConnectionString="tcpip=127.0.0.1:42424"  <p>sqlConnectionString="data source=127.0.0.1;user id=sa;password="  <p>cookieless="false"  <p>timeout="20"  <p>/&gt;  <p>In order to use StateServer session state mode, you will have to start the ASP State Service on the machine specified in the stateConnectionString attribute.  <p>Another common issue that we have seen with Web farm scenario is when the IIS Metabase is not same for all the Web servers in the Farm. The main issue comes with Web site identifier mismatch.  <p><a href="https://support.microsoft.com/?id=325056">https://support.microsoft.com/?id=325056</a> </p></blockquote> <ul> <li>Are users getting redirected to Login page? Is he using forms Authentication? </li></ul> <blockquote> <p>Do remember that the answer to this question is very important as <i>neither ASP nor ASP.Net has got any mechanism where in users would be redirected to any login page on Session loss.</i>  <p>There is a very good KB article by Jerry Orman on troubleshooting Forms Authentication issues.  <p><a href="https://support.microsoft.com/kb/910439">https://support.microsoft.com/kb/910439</a> </p></blockquote> <ul> <li>Does the domain name/server name have special characters such as “_” in them? Check this <a href="https://support.microsoft.com/?id=316112">https://support.microsoft.com/?id=316112</a> </li> <li>Scenarios where all users get session loss from a specific machine and the same user can access from other machine? </li></ul> <blockquote> <p>In this case issue could be mainly due to the client browser dropping cookie. Best way to approach this will be to try browsing the site with an alternate browser or use tools such as fiddler or Network Monitor to capture the traffic and see what’s happening. </p></blockquote> <p><b>Troubleshooting Classic ASP Applications</b>  <blockquote> <p>Let us talk about how to troubleshoot Session Loss issues in a Classic ASP application scenario. We need to keep in mind that there is no inbuilt mechanism by which users get redirected to login page. The possible causes by which a Session loss can occur in an ASP application could be  <p><u>Application domain recycle</u>  <p><u></u> <p>To find whether the issue is due to application domain recycle we can add code to Application_OnEnd.  <p>Sub Application_OnEnd  <p>Set fso = CreateObject("Scripting.FileSystemObject")  <p>WriteFile ="C:\Inetpub\wwwroot\aspsessionevent\files\app.txt"  <p>Set fs =fso.OpenTextFile(WriteFile,8)  <p>fs.WriteLine "Application resetting..."  <p>fs.WriteLine now()  <p>fs.WriteLine  <p>fs.Close  <p>Set fs =nothing  <p>Set fso= nothing  <p>End Sub  <p>The possible causes by which Application domain can get recycled are Antivirus touching any of the configuration files, any modification happened to Global.asa file, any setting in application pool as discussed before etc.  <p>Ref: - <a href="https://support.microsoft.com/?id=316148">https://support.microsoft.com/?id=316148</a>  <p><a href="https://support.microsoft.com/?id=324772">https://support.microsoft.com/?id=324772</a>  <p>Another issue which can cause Session loss is the Session cookie getting dropped by client. </p></blockquote> <blockquote> <p>Session State requires that the client browsers accept cookies. Are cookies enabled? If not, they will have to use cookie-less session state. In ASP.NET this can be done in the web.config file in the sessionState attribute. However in classic ASP, there is no such option, browsers will have to accept cookies for session state to work correctly with classic ASP.  <p>Checking Cookie Settings in IE (Enabling Cookies):  <p>Go to the Menu Item for: Tools, -&gt;Internet Options -&gt; Privacy -&gt; Advanced -&gt; Check "Override automatic cookie handling", select "Prompt" for both FirstParty cookies and Third party cookies, click OK. </p></blockquote> <blockquote> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_4.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_4.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="523" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_4.png" width="423" border="0"></a> </p></blockquote> <blockquote> <p>Also Session cookie can get dropped if the number of cookies exceeds the default limit. Cookies are FIFO (first in - first out). Needless to say, ASPSessionID cookie is the first in, and when the limit is reached, it's also the first one to get discarded. This will result in a loss of session data.  <p>Ref: - <a href="https://support.microsoft.com/kb/306070">https://support.microsoft.com/kb/306070</a> .  <p>We can enable the extend logging in IIS and can parse IIS logs using tools such as Microsoft Excel to see whether the Session cookie is getting dropped from client.  <p>To enabled extended logging in IIS follow the steps.  <p>Open IIS Manager – Web site properties – Website Tab- Enable Logging Properties – Advanced – Select Cookie Logging. </p></blockquote> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_5.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_5.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="461" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_5.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_5.png" width="472" border="0"></a> </p> <p>&nbsp;  <blockquote> <p><u>Using Microsoft Excel to Parse the IIS log files.</u>  <p>Open Microsoft Excel – Click on File Menu-Open - Point to IIS log file – Select Delimited in the Text Import Wizard—Click Next – Check Space in Next screen—Click Next –Finish.  <p>Delete the first 3 unwanted rows. Select the #Fields –Right click Delete and select the Shift cells Left option to align the cells properly. Now check for the <b>cs(Cookie)</b> column to find the ASP.Net Session Cookie. We need to see the request from the beginning and see whether the Session cookie is getting dropped or not.  <p>If you are running on a Web farm scenario there are possibilities that you will lose sessions when you use Cisco Local Director and SSL.  <p>Ref: - <a href="https://support.microsoft.com/?id=251027">https://support.microsoft.com/?id=251027</a>  <p>Other possible causes could be Third party ISAPI filters or custom code in application which is causing a redirection. Make sure that you check all the include pages to check for any redirection code.  <p>Also if your application contains empty Global.asa Session variables do not persist, as IIS fails when it tries to parse the file.  <p>Ref: - <a href="https://support.microsoft.com/?id=281298">https://support.microsoft.com/?id=281298</a>  <p>Are you using framesets? Check the below two articles.  <p>Session variables are lost when ASP is located in Frame set  <p><a href="https://support.microsoft.com/?id=178037">https://support.microsoft.com/?id=178037</a>  <p>There is another article which explains about Session loss due to use of frames . This applies to both ASP and ASP.Net applications.  <p><a href="https://support.microsoft.com/?id=323752">https://support.microsoft.com/?id=323752</a> </p></blockquote> <p><b>Troubleshooting ASP.NET 1.1 &amp; 2.0 Applications</b>  <blockquote> <p>Before troubleshooting we need to make sure that you have installed all the latest windows updates and Service packs available for .Net Framework.  <p>To find application domain recycles in ASP.NET applications we can use tools such as Performance Monitor or can add logging code under Application_End.  <p><u>Using Performance Monitor to find Application domain restart</u>  <p>Open Performance monitor—Add counters – Select Correct ASP.Net version in Performance object – Select Application Restarts—Click on Add &amp; Close. </p></blockquote> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_6.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_6.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="377" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_6.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_6.png" width="382" border="0"></a> </p> <blockquote> <p>If the application domain gets recycled due to some reason you can see an increase in the counter.  <p><u>Adding logging code under Application_End</u>  <p>To figure out the exact cause of what is triggering ASP.NET application domain restarts in a production shared hosted environment (was it a web.config file change, a global.asax change, an app_code directory change, a directory delete change, max-num-compilations reached quota, \bin directory change, etc). Just add the code in the below blog to Application_End.  <p><a href="https://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx">https://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx</a>  <p>The code works with both ASP.NET V1.1 and ASP.NET V2.0.  <p>More information about Application shutdown reason can be found at the following msdn article  <p><a href="https://msdn2.microsoft.com/en-us/library/system.web.applicationshutdownreason.aspx">https://msdn2.microsoft.com/en-us/library/system.web.applicationshutdownreason.aspx</a>  <p><u>Troubleshooting Forms Authentication cookie loss</u>  <p>The best way to troubleshoot Forms authentication cookie loss is to enable extended logging as described before and check for ASP.Net FormAuth cookie. We need to keep in mind that the Sliding expiration works different incase of Forms authentication.  <p><a href="https://support.microsoft.com/kb/910439">https://support.microsoft.com/kb/910439</a>  <p>Excerpt:-  <p>If you use sliding expiration, the scenario is a bit more complicated. The cookie and the resulting ticket are updated if the user visits the site after the expiration time is half-expired. For example, you set an expiration of 20 minutes by using sliding expiration. A user visits the site at 2:00 PM, and the user receives a cookie that is set to expire at 2:20 PM. The expiration is only updated if the user visits the site after 2:10 PM. If the user visits the site at 2:09 PM, the ticket is not updated because half of the expiration time has not passed. If the user then waits 12 minutes, visiting the site at 2:21 PM, the ticket will be expired. The user is redirected to the login page. </p></blockquote> <blockquote> <p>We can also use tools such as Netmon or fiddler to capture the network traffic and check for form authentication cookie.  <p><u>Using Fiddler to check Forms Authentication cookie.</u> </p></blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_7.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_7.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="353" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_7.png" original-url="https://blogs.msdn.com/blogfiles/amenon/WindowsLiveWriter/TroubleshootingSessionloss_F78F/image_thumb_7.png" width="900" border="0"></a> </p> <blockquote> <p>Down load Network Monitor 3.1:- <a href="https://www.microsoft.com/downloads/details.aspx?familyid=18b1d59d-f4d8-4213-8d17-2f6dde7d7aac&amp;displaylang=en">https://www.microsoft.com/downloads/details.aspx?familyid=18b1d59d-f4d8-4213-8d17-2f6dde7d7aac&amp;displaylang=en</a>  <p>Download Fiddler: - <a href="https://www.fiddlertool.com/fiddler/">https://www.fiddlertool.com/fiddler/</a>  <p>Note: - Fiddler doesn’t capture network traffic over Local host. So use machine name or FQDN while trying to access the Web site. </p></blockquote> <p><b>Troubleshooting ASP.NET 2.0 Applications</b>  <blockquote> <p>We can follow the same troubleshooting steps as described in ASP.NET 1.1 section but ASP.NET 2.0 offers some advanced features which makes our life much better.  <p><u>The Web Events feature in ASP.NET 2.0</u>  <p>One of the major new services provided in ASP.NET 2.0 is the Web Events feature provided by the health monitoring system. By modifying the Web.config file, you can use the health monitoring system to log unhandled exceptions, expired forms, authentication tickets, and any other data you want logged in your application.  <p><a href="https://support.microsoft.com/?id=893664">https://support.microsoft.com/?id=893664</a>  <p>Some of the other known issues with ASP.NET 2.0 that can contribute to session loss include,  <p>Deleting ASP.NET 2.0 Application Sub-Directories Shuts Down the AppDomain  <p><a href="https://blogs.msdn.com/toddca/archive/2005/12/01/499144.aspx">https://blogs.msdn.com/toddca/archive/2005/12/01/499144.aspx</a>  <p>Unhandled exceptions cause ASP.NET-based applications to unexpectedly quit in the .NET Framework 2.0  <p><a href="https://support.microsoft.com/?id=911816">https://support.microsoft.com/?id=911816</a>  <p>Overwhelming Change Notifications  <p><a href="https://support.microsoft.com/?id=920970">https://support.microsoft.com/?id=920970</a>  <p>Another common issue that can cause Session loss is Application domain domain recycle due to file change notifications.  <p><a href="https://support.microsoft.com/kb/911272/en-us">https://support.microsoft.com/kb/911272/en-us</a>  <p>Hmm... I have tried to consolidate most of the stuffs that will help us in troubleshooting Session loss. If you need more help we are there at Microsoft PSS to assist you. </p></blockquote> <blockquote> <p>Happy Troubleshooting… :-)</p></blockquote>]]></content:encoded>
    </item>
  </channel>
</rss>