Problem with server.transfer
When using server.transfer generates the following error.
Thread was being aborted
Mscorlib
I have added
Catch threadEx As System.Threading.ThreadAbortException
' do nothing
To the code but still the error is produced, the page is not transferred to
the other page but the same page. It then rolls back the database changes.
What is required to get the server.transfer to work in a try catch
statement?
Re: Problem with server.transfer
"Robin" <robin9876 [at] hotmail.com> wrote in message
news:OlE$21PIFHA.3588 [at] TK2MSFTNGP14.phx.gbl...
> When using server.transfer generates the following error.
> Thread was being aborted
Use Response.Redirect (<URL>, false) instead
Re: Problem with server.transfer
Server.Transfer(), Response.End(), and Response.Redirect work by killing the
current thread. don't catch the thread abort. they all have an option to not
do the abort - but then the rest of the page processing continues (instead
of terminating at the statement), which may cause you problems.
-- bruce (sqlwork.com)
"Robin" <robin9876 [at] hotmail.com> wrote in message
news:OlE$21PIFHA.3588 [at] TK2MSFTNGP14.phx.gbl...
| When using server.transfer generates the following error.
| Thread was being aborted
| Mscorlib
|
| I have added
|
| Catch threadEx As System.Threading.ThreadAbortException
|
| ' do nothing
|
| To the code but still the error is produced, the page is not transferred
to
| the other page but the same page. It then rolls back the database changes.
|
| What is required to get the server.transfer to work in a try catch
| statement?
|
|
Re: Problem with server.transfer
How do you not catch the thread abort but catch other errors?
"bruce barker" <nospam_brubar [at] safeco.com> wrote in message
news:%23lo3q8RIFHA.2276 [at] TK2MSFTNGP15.phx.gbl...
> Server.Transfer(), Response.End(), and Response.Redirect work by killing
the
> current thread. don't catch the thread abort. they all have an option to
not
> do the abort - but then the rest of the page processing continues (instead
> of terminating at the statement), which may cause you problems.
>
>
> -- bruce (sqlwork.com)
>
>
>
>
> "Robin" <robin9876 [at] hotmail.com> wrote in message
> news:OlE$21PIFHA.3588 [at] TK2MSFTNGP14.phx.gbl...
> | When using server.transfer generates the following error.
> | Thread was being aborted
> | Mscorlib
> |
> | I have added
> |
> | Catch threadEx As System.Threading.ThreadAbortException
> |
> | ' do nothing
> |
> | To the code but still the error is produced, the page is not transferred
> to
> | the other page but the same page. It then rolls back the database
changes.
> |
> | What is required to get the server.transfer to work in a try catch
> | statement?
> |
> |
>
>
Re: Problem with server.transfer
like bruce said use the response.redirect(page.aspx,false)
--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
------------------------------------------------------------
"Robin" <robin9876 [at] hotmail.com> wrote in message
news:eu1CXepIFHA.3588 [at] TK2MSFTNGP14.phx.gbl...
> How do you not catch the thread abort but catch other errors?
>
> "bruce barker" <nospam_brubar [at] safeco.com> wrote in message
> news:%23lo3q8RIFHA.2276 [at] TK2MSFTNGP15.phx.gbl...
>> Server.Transfer(), Response.End(), and Response.Redirect work by killing
> the
>> current thread. don't catch the thread abort. they all have an option to
> not
>> do the abort - but then the rest of the page processing continues
>> (instead
>> of terminating at the statement), which may cause you problems.
>>
>>
>> -- bruce (sqlwork.com)
>>
>>
>>
>>
>> "Robin" <robin9876 [at] hotmail.com> wrote in message
>> news:OlE$21PIFHA.3588 [at] TK2MSFTNGP14.phx.gbl...
>> | When using server.transfer generates the following error.
>> | Thread was being aborted
>> | Mscorlib
>> |
>> | I have added
>> |
>> | Catch threadEx As System.Threading.ThreadAbortException
>> |
>> | ' do nothing
>> |
>> | To the code but still the error is produced, the page is not
>> transferred
>> to
>> | the other page but the same page. It then rolls back the database
> changes.
>> |
>> | What is required to get the server.transfer to work in a try catch
>> | statement?
>> |
>> |
>>
>>
>
>