21

I have implemented ajax request to populate my drop down fields. It is working Fine but when I stay idle for some time and select some value in drop down the ajax request gets 302 found response. Is it due to session out. Please let me know the solution, can we do some setting that it will never get response as 302 found.

2 Answers 2

29

The 302 status code indicates that the resource you are requesting has redirected to another resource. If this is behind some authentication, or requiring a session to be active then yes, it would follow that the session timing out is responsible for the ajax resource being called to redirect to possibly a login screen maybe.

I would seriously recommend using something like Charles or Fiddler to track the requests being made.

2
  • I am using <auth-method>Basic</auth-method>, so how to get the login window, if session out
    – Aditya
    Feb 4, 2012 at 19:08
  • 1
    @Digbyswift Its true and helped me. Its because of the session time out. thanks bro:)
    – Mad Angle
    Nov 28, 2014 at 6:47
1

In your code you should check whether a session is available, because when a GET/POST request is sent, there may be additional requests for images or other resources. Sessions won’t be available for those requests.

if (Context.Session != null)
{
    // your code
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.