?
Solved

jquery ajax problem (un autherized) in asp.net web page

Posted on 2012-03-10
3
Medium Priority
?
1,839 Views
Last Modified: 2012-04-10
hi,

I have ajax method using jquery and it works so fine, but after some time of keeping the page opened, if I click the button (to request web method from server) I got this error message in firebug:

JSON:
Message
      "Authentication failed."
      
StackTrace
      null
      
ExceptionType
      "System.InvalidOperationException"

Response:
{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}


so how can I fix this problem?
0
Comment
Question by:njgroup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 37706363
what is the statusCode returned? is it 401?
if u refresh the page are you able to make it run?
0
 

Author Comment

by:njgroup
ID: 37706658
yes, if I refresh the page, its gonna run fine
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 2000 total points
ID: 37706668
this is due to session timeout in ajax calls.
you can either customize your ajax response instead of throwing 401 exception:
http://stackoverflow.com/questions/5238854/handling-session-timeout-in-ajax-calls

or, redirect to the login page or to increase expiration session timeout in your web.config or preventing session timeout altogether:
http://xpapad.wordpress.com/2010/06/19/preventing-session-expiration-with-ajax/

for each one of the solution proposed you need to understand the implications first,

cheers
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question