Anyone has seen this error?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, friends,

In our development machine, the .net web app worked fine. Then we deployed
it to our server.

However, it did not work on the server. After a user entered user name/pswd
and tried to log in, we have the error message in Exception : Thread was
being aborted in Page_Load().

Page_Load()
{
try
{
if (this.IsPostBack)
{
if (Request.Form["txtLoginName"] == "admin" &&
Request.Form["txtPswd"] == "admin")
{
FormsAuthentication.SetAuthCookie(Request.Form["txtLoginName"],
System.Convert.ToBoolean(Request.Form["Persist"]));
Session["userName"] = Request.Form["txtLoginName"];
Response.Redirect("General/Index.aspx");
}
}
catch (System.Exception se)
{
Server.Transfer("Error/Error.aspx?msg=" + Server.UrlEncode(se.Message));
}
}

Any ideas? (I thought Response.Redirect("General/Index.aspx"); may be the
problem).

If I want to debug on server, how can I do it? (We are not allowed to set up
dev environment on the server.)

Help please, and thanks.
 
Response.Redirect DOES throw a ThreadAbortException, that's just how it
works, it aborts the thread and starts a new one, you can use
Redirect("...", false); to avoid the error (the execution will complete and
then redirect, as opposed to redirecting immediately).

You should try avoiding swallowing exceptions...catch System.Exception isn't
ideal.

Karl
 
Why it did not throw exception in dev machine?

I know to catch exception in .aspx page is expensive, but do you have a
better way to collect those errors?

Thanks.


Karl Seguin said:
Response.Redirect DOES throw a ThreadAbortException, that's just how it
works, it aborts the thread and starts a new one, you can use
Redirect("...", false); to avoid the error (the execution will complete and
then redirect, as opposed to redirecting immediately).

You should try avoiding swallowing exceptions...catch System.Exception isn't
ideal.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Andrew said:
Hello, friends,

In our development machine, the .net web app worked fine. Then we deployed
it to our server.

However, it did not work on the server. After a user entered user
name/pswd
and tried to log in, we have the error message in Exception : Thread was
being aborted in Page_Load().

Page_Load()
{
try
{
if (this.IsPostBack)
{
if (Request.Form["txtLoginName"] == "admin" &&
Request.Form["txtPswd"] == "admin")
{
FormsAuthentication.SetAuthCookie(Request.Form["txtLoginName"],
System.Convert.ToBoolean(Request.Form["Persist"]));
Session["userName"] = Request.Form["txtLoginName"];
Response.Redirect("General/Index.aspx");
}
}
catch (System.Exception se)
{
Server.Transfer("Error/Error.aspx?msg=" +
Server.UrlEncode(se.Message));
}
}

Any ideas? (I thought Response.Redirect("General/Index.aspx"); may be the
problem).

If I want to debug on server, how can I do it? (We are not allowed to set
up
dev environment on the server.)

Help please, and thanks.
 
Normally leave such global exception handling to a global handler - so you
don't have to repeat the code each time (global.asax onerror).

I'm not sure why it wouldn't throw in dev..maybe there's a machine.config
setting which is different...not sure, but I'm not surprised by the
behaviour, you simply need to code around it, a simple way is:

Catch (Exception se)
{
if (!se is ThreadAbordException)
{
//this is a real error
}
}

or use the false as in my example.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Andrew said:
Why it did not throw exception in dev machine?

I know to catch exception in .aspx page is expensive, but do you have a
better way to collect those errors?

Thanks.


Karl Seguin said:
Response.Redirect DOES throw a ThreadAbortException, that's just how it
works, it aborts the thread and starts a new one, you can use
Redirect("...", false); to avoid the error (the execution will complete
and
then redirect, as opposed to redirecting immediately).

You should try avoiding swallowing exceptions...catch System.Exception
isn't
ideal.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Andrew said:
Hello, friends,

In our development machine, the .net web app worked fine. Then we
deployed
it to our server.

However, it did not work on the server. After a user entered user
name/pswd
and tried to log in, we have the error message in Exception : Thread
was
being aborted in Page_Load().

Page_Load()
{
try
{
if (this.IsPostBack)
{
if (Request.Form["txtLoginName"] == "admin" &&
Request.Form["txtPswd"] == "admin")
{
FormsAuthentication.SetAuthCookie(Request.Form["txtLoginName"],
System.Convert.ToBoolean(Request.Form["Persist"]));
Session["userName"] = Request.Form["txtLoginName"];
Response.Redirect("General/Index.aspx");
}
}
catch (System.Exception se)
{
Server.Transfer("Error/Error.aspx?msg=" +
Server.UrlEncode(se.Message));
}
}

Any ideas? (I thought Response.Redirect("General/Index.aspx"); may be
the
problem).

If I want to debug on server, how can I do it? (We are not allowed to
set
up
dev environment on the server.)

Help please, and thanks.
 
Normally leave such global exception handling to a global handler - so you
don't have to repeat the code each time (global.asax onerror).

very good. but, just one more question:

Is that possible the error collected in global.asax onerror will only be the
last error, not the original one which actually raised a chain of exception
errors? Thus, errors may not be helpful to pin down the real problem?

Or global.asax onerror will be raised for every error in a chain, including
the original one?


Thanks.

Karl Seguin said:
Normally leave such global exception handling to a global handler - so you
don't have to repeat the code each time (global.asax onerror).

I'm not sure why it wouldn't throw in dev..maybe there's a machine.config
setting which is different...not sure, but I'm not surprised by the
behaviour, you simply need to code around it, a simple way is:

Catch (Exception se)
{
if (!se is ThreadAbordException)
{
//this is a real error
}
}

or use the false as in my example.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Andrew said:
Why it did not throw exception in dev machine?

I know to catch exception in .aspx page is expensive, but do you have a
better way to collect those errors?

Thanks.


Karl Seguin said:
Response.Redirect DOES throw a ThreadAbortException, that's just how it
works, it aborts the thread and starts a new one, you can use
Redirect("...", false); to avoid the error (the execution will complete
and
then redirect, as opposed to redirecting immediately).

You should try avoiding swallowing exceptions...catch System.Exception
isn't
ideal.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Hello, friends,

In our development machine, the .net web app worked fine. Then we
deployed
it to our server.

However, it did not work on the server. After a user entered user
name/pswd
and tried to log in, we have the error message in Exception : Thread
was
being aborted in Page_Load().

Page_Load()
{
try
{
if (this.IsPostBack)
{
if (Request.Form["txtLoginName"] == "admin" &&
Request.Form["txtPswd"] == "admin")
{
FormsAuthentication.SetAuthCookie(Request.Form["txtLoginName"],
System.Convert.ToBoolean(Request.Form["Persist"]));
Session["userName"] = Request.Form["txtLoginName"];
Response.Redirect("General/Index.aspx");
}
}
catch (System.Exception se)
{
Server.Transfer("Error/Error.aspx?msg=" +
Server.UrlEncode(se.Message));
}
}

Any ideas? (I thought Response.Redirect("General/Index.aspx"); may be
the
problem).

If I want to debug on server, how can I do it? (We are not allowed to
set
up
dev environment on the server.)

Help please, and thanks.
 
OnError will raise for any unhandled exceptions.

There's a chance this error will be of type HttpUnhandledException, you can
simply get the InnerException to get the real exception.

Karl

--
http://www.openmymind.net/



Andrew said:
Normally leave such global exception handling to a global handler - so
you
don't have to repeat the code each time (global.asax onerror).

very good. but, just one more question:

Is that possible the error collected in global.asax onerror will only be
the
last error, not the original one which actually raised a chain of
exception
errors? Thus, errors may not be helpful to pin down the real problem?

Or global.asax onerror will be raised for every error in a chain,
including
the original one?


Thanks.

Karl Seguin said:
Normally leave such global exception handling to a global handler - so
you
don't have to repeat the code each time (global.asax onerror).

I'm not sure why it wouldn't throw in dev..maybe there's a machine.config
setting which is different...not sure, but I'm not surprised by the
behaviour, you simply need to code around it, a simple way is:

Catch (Exception se)
{
if (!se is ThreadAbordException)
{
//this is a real error
}
}

or use the false as in my example.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Andrew said:
Why it did not throw exception in dev machine?

I know to catch exception in .aspx page is expensive, but do you have a
better way to collect those errors?

Thanks.


:

Response.Redirect DOES throw a ThreadAbortException, that's just how
it
works, it aborts the thread and starts a new one, you can use
Redirect("...", false); to avoid the error (the execution will
complete
and
then redirect, as opposed to redirecting immediately).

You should try avoiding swallowing exceptions...catch System.Exception
isn't
ideal.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Hello, friends,

In our development machine, the .net web app worked fine. Then we
deployed
it to our server.

However, it did not work on the server. After a user entered user
name/pswd
and tried to log in, we have the error message in Exception : Thread
was
being aborted in Page_Load().

Page_Load()
{
try
{
if (this.IsPostBack)
{
if (Request.Form["txtLoginName"] == "admin" &&
Request.Form["txtPswd"] == "admin")
{
FormsAuthentication.SetAuthCookie(Request.Form["txtLoginName"],
System.Convert.ToBoolean(Request.Form["Persist"]));
Session["userName"] = Request.Form["txtLoginName"];
Response.Redirect("General/Index.aspx");
}
}
catch (System.Exception se)
{
Server.Transfer("Error/Error.aspx?msg=" +
Server.UrlEncode(se.Message));
}
}

Any ideas? (I thought Response.Redirect("General/Index.aspx"); may
be
the
problem).

If I want to debug on server, how can I do it? (We are not allowed
to
set
up
dev environment on the server.)

Help please, and thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top