1

At my work we have a standard timeout script that waits for 15 mins and prompts a user asking if they want to continue the session. Is there anyway within IIS to create a dummy endpoint that the script can be changed to call to refresh the session. For all our applications we use the same script so I want it to be the same end point for each application. I was leaning toward creating an HTTP handler to do this, however I wasn't sure if this was enough. I'm looking to emulate the approach taken here.

Keeping ASP.NET Session Open / Alive

public class SessionKeepAliveHttpHandler : IHttpHandler, IRequiresSessionState
{
    public bool IsReusable
    {
        get { return true; }
    }

    public void ProcessRequest(HttpContext context)
    {
        //Give it some long name it's no one is likely to have used
        context.Session["Global_Session_KeepAlive"] = System.DateTime.Now;
    }

and registering the handler like this

<httpHandlers>
    <add verb="POST" path="keep-alive.html" validate="false" type="SessionKeepAliveHttpHandler"/>
</httpHandlers>

I'm also not 100% sure about where to register the handler, reading online here it looks like I'd put it in the Machine.config. However I wasn't sure as I don't have direct access to the ISS server.

By default our session timeout script is setup to make a post request to just "keep-alive.html"

adc90
  • 303
  • 3
  • 10

0 Answers0