302 found response

人走茶凉 提交于 2019-11-29 11:09:06

问题


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.


回答1:


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:


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
}


来源:https://stackoverflow.com/questions/9143438/302-found-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!