This is a problem I don't really understand. I think it maybe a time out issue.

I have a search box accessing csv files. if the browser is open for 20 minutes and I run a search the browser crashes.

if I stop a search in the middle of resolving data and then search again the browser crashes.

Any ideas?

Dani AI

Generated

The idle-time change that suggested is the right first step for the “site dies after 20 minutes” symptom, but the crash that happens when a search is stopped mid‑way and retried points to server-side resource/locking or state issues rather than the IIS idle timer alone. ’s note about session timeout is relevant: session expiration (InProc) and app‑pool recycles can make stored state disappear, but they won’t by themselves cause a browser crash — unclosed file handles, shared/static variables, long-running locks, or unhandled exceptions will.

Likely causes and quick fixes:

  • Per-request data accidentally stored in Shared/Static or Application scope. Replace with local variables or thread‑safe stores.
  • Long-running CSV parsing holding Application.Lock or other locks — avoid locking for long work.
  • File I/O not disposed (leaked handles) or exclusive file locks that block subsequent requests. Always dispose readers/writers.
  • Server continues heavy work after client abort; detect client disconnects and stop processing.
  • Add try/catch and robust logging so unhandled exceptions are captured.

Safe pattern (VB) for reading lines with client-disconnect check:

Try
  Using sr As New System.IO.StreamReader(csvPath)
    While Not sr.EndOfStream AndAlso Response.IsClientConnected
      Dim line = sr.ReadLine()
      ' parse line (local vars only)
    End While
  End Using
Catch ex As Exception
  ' Log with timestamp, SessionID, ThreadID, stack
End Try

Diagnostics checklist (in order): enable detailed errors/trace for the app, review Windows Event Viewer and IIS logs for 500s or CLR exceptions, enable Failed Request Tracing in IIS for the failing requests, add timestamped server logging around the search entry/exit, and reproduce while watching resource usage (CPU/memory). Short‑term workarounds (longer idle, client poll) cover symptoms but the root fix is thread‑safe per-request code, proper disposal of streams, and avoiding long locks; moving heavy parsing to an async/background task or using a proper session store (StateServer/SQL) are longer‑term improvements. Including the server-side code‑behind typically reveals the exact cause.

Recommended Answers

All 6 Replies

have a look at the application pool in iis associated with your site, the idel time may need to be extended.

I have altered that and it got me to the 20 minutes, which is ok. I could put a refresh in there for 15 minutes to avoid crashes. However that still leaves me with the following problem.

if I stop a search in the middle of resolving data and then search again the browser crashes.

So I think the issue is related to my variables holding data?

Any idea's would be appreciated.

what is the code you are using for the search?

I think u are using session variable. So it has a timeout. You can set the time from IIS. But it will be wise to check before using session variable. Like:

if(Session["myname"]!=null)
myname=Session["myname"].ToString();

Here is the code.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Inventory Search</title>
</head>

<body bgcolor="#CCCCCC">
    
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td><p align="center" style="margin-top: 0; margin-bottom: 0">
                    <img border="0" src="images/09-0208.jpg" width="985" height="195" />
                </p>
            </td>
        </tr>
    </table>
    
 <script language="javascript">
   window.onload=function Load()
   {
 	 document.forms["form1"].elements["TextBoxPartNumber"].focus();
	 document.forms["form1"].elements["TextBoxPartNumber"].value="";
	    }
 </script>

 
 <form id="form1" runat="server">

    <div>

        <table>
            
            <tr>
                <td>Product number</td>
                <td><asp:TextBox ID="TextBoxPartNumber" runat="server"></asp:TextBox></td>
				<asp:TextBox runat="server" style="visibility:hidden;display:none;"/><td><asp:Button ID="ButtonSearch" runat="server" Text="Search" /></td>
				<asp:RequiredFieldValidator ControlToValidate="TextBoxPartNumber" Text="Item Number Required" runat="server" /></tr>

            <tr><td><br /></td></tr>

            <tr>    
                <td></td>
                <td><asp:Label ID="LabelLine1" runat="server" Text=""></asp:Label></td>
                <td><asp:Label ID="LabelItemNumber" runat="server"></asp:Label></td>
            </tr>   
                     
            <tr>    
                <td></td>
                <td><asp:Label ID="LabelLine2" runat="server" Text=""></asp:Label></td>
                <td><asp:Label ID="LabelDescription" runat="server"></asp:Label></td>
            </tr>
            
            <tr>    
                <td></td>
                <td><asp:Label ID="LabelLine3" runat="server" Text=""></asp:Label></td>
                <td><asp:Label ID="LabelQty" runat="server"></asp:Label></td>
            </tr>

            <tr>    
                <td></td>
                <td colspan="2"><br /><asp:Label ID="LabelCallForDetails" runat="server" Text="Please contact sales at <b>1-800</b> for pricing" Visible="false"></asp:Label><br /></td>
            </tr>            

        </table>
        
        <br />
        Related Items:<br />
        <hr />
        
        </div>
        <asp:Table ID="TableAdditional" runat="server" Height="24px" Width="800px">
        </asp:Table>
        
    </form>
   
    
</body>
</html>

Please post your cs code. Otherwise other members cant identify your problem. It will be bteer to come up with the original error message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.