473,471 Members | 4,687 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Anyone has seen this error?

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.
Feb 7 '06 #1
5 1202
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" <An****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
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.

Feb 7 '06 #2
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 [MVP]" wrote:
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" <An****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
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.


Feb 7 '06 #3
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" <An****@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
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 [MVP]" wrote:
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" <An****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
> 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.


Feb 7 '06 #4
> 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 [MVP]" wrote:
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" <An****@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
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 [MVP]" wrote:
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" <An****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
> 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.


Feb 7 '06 #5
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" <An****@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
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 [MVP]" wrote:
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" <An****@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
> 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 [MVP]" wrote:
>
>> 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" <An****@discussions.microsoft.com> wrote in message
>> news:3E**********************************@microsof t.com...
>> > 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.
>>
>>
>>


Feb 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mart Rogers | last post by:
I have the following problem with an ASP.Net solution and would be grateful for any advice on solving it : I load an existing ASP.NET solution into Visual Studio (2002), then from Solution...
0
by: numerous instabilities in deploying VB | last post by:
I have been working on a VB product It is working beautifuly on my XP dev box and my windows 2000 test machines in the lab. When I install at the customer site, I get all kinds of wacky problems...
6
by: ATS | last post by:
INF: Has anyone made a CString, sprintf, and sscanf for .NET? Please help, I want to code with PURE .NET (i.e. pure CLR). No MFC, No ATL, no C-Run Time Library. But I want CString, sprintf,...
0
by: Frank | last post by:
I am attempting to convert an asp file to a asp.net file using C#. The original file has an ActiveX control which is contained in a cab file. The cab file contains the .ocx file which connects...
40
by: Jeff | last post by:
I have a system on a network and want to determine if anyone is currently connected to the back-end files. An interesting twist is that I have noticed that some users can be connected (have the...
10
by: Alan Silver | last post by:
Hello, I discovered the MSDN design templates yesterday and have been looking at them. I have a problem with the Personal template. I don't have SQL Server Express loaded, as I already have...
8
by: Wayne Gillespie | last post by:
I have an application in service (A97) which is a booking system for a modelling agency. When they add / edit a job I display a subform which lists all models, filtered according to criteria set by...
0
by: Erich93063 | last post by:
I am using Cold Fusion to access an ODBC connection for an accounting program called MYOB. They provide the ODBC driver that you can install. I have it installed and I used there utility to check...
1
by: MPutt | last post by:
I apologize if I am posting this to the wrong area, but I am stuck. Here is my problem. I am running a .NET 2003 Windows service against Oracle 9i. This service is attempting to run a stored...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.