Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3240082
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:02:41+00:00 2026-05-17T18:02:41+00:00

I have a handler, like this, using IRequiresSessionState: public class MyHandler : IHttpHandler, IRequiresSessionState

  • 0

I have a handler, like this, using IRequiresSessionState:

public class MyHandler : IHttpHandler, IRequiresSessionState
{
  // code
}

In the code, I am able to read and set Session values. I also check ensure that the caller is logged in. That all works fine.

The web site uses forms authentication, so in the web.config, I have this:

<authentication mode="Forms">
   <forms loginUrl="Login.aspx" timeout="10" slidingExpiration="true"></forms>
</authentication>

The problem is that AJAX calls from the client to the server code MyHandler do not extend the life of the session!

So even if the user is busy sending and receiving data from the server, they time out 10 minutes after their last full page load.

In the handler, I’ve tried specifically changing a value is the session on each call, but not even that extends the time out.

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:02:41+00:00Added an answer on May 17, 2026 at 6:02 pm

    Finally got a solution to this… sort of.

    I abandoned trying to get the handler to do the job, and instead called a normal ASPX page. In that page, I removed the HTML code, and used Response.Write(…) to send back some JSON that I wanted. However, even with that, my session was not being extended!

    I finally realized that in the PreRender event, I used Response.ClearHeaders(). That was the problem. It turns out that the Forms authentication system was updating the session ticket cookie when needed, but was adding it to the Headers before my code was running. So when I cleared the headers, I was erasing the new cookie before it was sent to the browser.

    So, if you are having problems with sessions not being extended, check to make sure that your code is not using ClearHeaders()!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ASHX HTTPHandler which implements IRequiresSessionState. When I call this handler, and call
I have some questions about the following code: using System; namespace ConsoleApplication2 { public
In my routing I would like to have something like not found route handler.
I'm using C and sometimes I have to handle paths like C:\Whatever C:\Whatever\ C:\Whatever\Somefile
In some VB6 code, I have a handler for a TreeView's Collapse event: Private
I have some event handler on a boundary class that manages a persistence mechanism
I've hit a small dilemma! I have a handler called vote; when it is
I have an exception handler . In my asp.net application. It’s written in Global.asax.
I have a resource handler that is Response.WriteFile(fileName) based on a parameter passed through
I have an onclick handler for an <a> element (actually, it's a jQuery-created handler,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.