views:

55

answers:

3

Hi,

I am getting the following error when I leave my web inactive for a while

"Response.Redirect.cannot be called in a Page callback."

I'm storing the user ids in session and during page load I check to see if the user id exists if not then I redirect them to the login page.

I am using devexpress controls, How can I get the redirect to work?

A: 

You can't get the redirect to work in a callback. Perhaps instead of doing Response.Redirect on the server you could write some value in a <script type="text/javascript"/> block and set the window.location.href (redirect) on the client side?

matt-dot-net
A: 

You can usually turn callbacks off for devexpress controls like the ASPxGridView using the "EnableCallbacks" property. This will obviously cause the controls to use postbacks, but it will also allow Response.Redirect to do its job.

AGoodDisplayName
A: 

Indeed, it is impossible to use the Response.Redirect during a callback. Please refer to the following blog post in this regard.

http://community.devexpress.com/blogs/aspnet/archive/2008/08/25/how-to-redirect-to-login-page-after-session-timeout.aspx

DevExpress Team