Response Redirect cannot be called in Page callback?

Robert picture Robert · Jul 17, 2010 · Viewed 19.6k times · Source

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?

Answer

Fredrik Eder picture Fredrik Eder · Jun 23, 2011

Try using the Response.RedirectLocation property instead which works during callback.

HttpResponse.RedirectLocation Property on MSDN