How do I avoid ASP.NET session timeout from a httphandler?

From: bhatti (bhattisatish_at_gmail.com)
Date: 03/22/05

  • Next message: JohnH.: "Re: ASP.NET User.Identity.Name returns wrong value?"
    Date: 22 Mar 2005 06:17:11 -0800
    
    

    Hi,

    I have a HTTPHandler code that handles file uploads on a ASP.NET
    server (IIS 6.0). The code handles large file uploads which can range
    from 1K to 500MB. In case of large files, the upload is successful,
    but the session times out and we end up taking the user to the login
    page.

    The machine.config has the following settings:
    <httpRuntime maxRequestLength="131072" executionTimeout="36000"/>
    and
    <sessionState mode="InProc"
    stateConnectionString="tcpip=127.0.0.1:42424" stateNetworkTimeout="10"
    sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
    cookieless="false" timeout="20"/>

    All the worker process re-cycle options have been disabled.

    Some solutions we have tried out:
    - In the Httphandler code, while handling the file upload we check for
    the session timeout against the HttpApplication.Session.Timeout and if
    the upload time is approaching the session timeout we tried to adjust
    the HttpApplication.Session.Timeout value expecting the server code to
    extend the session, but that does not occur.

    - Have a small js code that pings the server every 5 mins. This seems
    to work, but in our specific upload page, we have implemented an
    activex control which internally uses WinInet to upload, resulting in
    usage of max 2 connections. Thus the js with activex control does not
    work for us as js code is not able to open a new connection.

    - Increase the session timeout on the config file. After some playing
    around and tweaking, we realised that 70% of the users have no issues
    if we set it to 30 mins, but around 10% of users regularly transfer
    50MB and above, and for these people the timeout is irritating. Due to
    the load on the servers the OPS guys do not like extending the timeout
    period further.

    Any suggestions?

    thx in advance
    bhatti.


  • Next message: JohnH.: "Re: ASP.NET User.Identity.Name returns wrong value?"

    Relevant Pages

    • Re: Strange behaviour of ASP library
      ... One thing I've noticed about file uploads is that different browsers on ... Firefox vs. IE on a site with upload to ASP.NET, ... > system, tried to upload the file to the server, then it wasn`t being ...
      (microsoft.public.inetserver.asp.components)
    • protecting file upload
      ... I've read a few bits on the web about vulnerabilities in providing ... file uploads where the upload could contain ../../ and so allow 'back ... browsing' to other files on the server and copying them to a public ...
      (comp.lang.php)
    • Re: FTP Troubles - Timing out maybe?
      ... I am not sure if it does this with Windows Firewall turned off or not. ... The server isn't behind a router, so I am nervous about turning off the ... I still can't upload anything over around 9 megs without ... The file uploads ok, but sits at 99% for a few minutes, then ...
      (microsoft.public.inetserver.iis.ftp)
    • Re: File Upload - Security Issues
      ... You want to upload a file for what reason and ... these viruses have less chance of being able to execute (even if succeeded ... :> file and what pitfalls you see re: security might be helpful on this ... :>: files to an IIS server that doesn't have MS Office actually installed? ...
      (microsoft.public.scripting.vbscript)
    • Re: File Upload - Security Issues
      ... uploaded and the user could upload any or all of these in theory. ... There is no one product that can give you 100% security, ... > Code doesn't execute in local memory space unless remote user has rights ... > You don't have MS Office installed on the server. ...
      (microsoft.public.scripting.vbscript)