Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
300
Handling 401 and 302 status codes
posted

I am developing an igGrid control on an existing ASP.NET application that uses forms authentication. The issue is when the client session times out (after 20 min of inactivity) and then tries to page/sort/filter, a javascript error is thrown: The remote request to fetch data has failed:  (error) undefined

The response from the service is a 401 (unauthorized) with html content from IIS. It appears the grid is still trying to parse the response into JSON, even though there is an error in the response. NOTE: The same thing happens if the service sends back a 302 (redirect).

I tried digging through the 'dataBinding' event on igGrid to cancel the event and reroute to the login screen on a 401 error but I could not find the raw response.

I am wondering if there is a way to handle this case?

For the record, I am using version 2013.1, igGrid, igDataSource with remoteUrl, remote paging, remote sorting, and remote filtering. My url points to a Web Api OData service that returns JSON.