Groups | Blog | Home
all groups > asp.net > february 2005 >

asp.net : Object Moved to here


Ganesh Ramamurthy
2/28/2005 11:45:03 PM
Hi Experts,

I am getting the following error when I do a Response.Redirect from an aspx
page to another aspx page. I am using the following code in my global.asax
Application_Error event to redirect to an error page.

Session["Error"] = Server.GetLastError();
Response.Redirect("Error.aspx");

However I am not able to go to the Error Page and am getting this error.

I am getting the error "Object Moved to Here". All other pages in the
application are working well. This is an error page which I added in an
already working application. I wrote code in the Global.asax to redirect to
the error page on an unhandled error.

I searched the web and somewhere I got an instruction to add the following
lines to the code

Response.Expires = 0;
Response.Buffer = true;
Response.Clear();

I added those lines but still am getting this error. I am getting the error
only in the production site and not in my development environment.

Can anyone please help me get out of this urgent issue.

Thanking you in advance

Regards
William F. Robertson, Jr.
3/1/2005 10:59:09 AM
Add Server.ClearError() to your Application_Error

Session["Error"] = Server.GetLastError();
Server.ClearError();
Response.Redirect( "Error.aspx" );

Couple things of note. Not all application errors have a Session context
attached to them. You probably want to check

if ( System.Web.HttpContext.Current != null )
{
System.Web.HttpContext.Current.Session["Error"] = Server.GetLastError();
}

HTH,

bill

"Ganesh Ramamurthy" <GaneshRamamurthy@discussions.microsoft.com> wrote in
message news:82AE36C3-0D1C-4D76-8BBC-C3F91B0FADDC@microsoft.com...
[quoted text, click to view]

AddThis Social Bookmark Button