Problem with server.transfer

R

Robin

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?
 
B

bruce barker

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)




| 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?
|
|
 
A

Alvin Bruney [ASP.NET MVP]

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
------------------------------------------------------------
 
P

Patrick Olurotimi Ige

Hi Robin ....Some differences i came to find out with time.
Hope it helps
Patrick

The Response.Redirect() method can be used to connect to any specified
URL. The specified URL can point to any resource and may also contain
query strings. The use of Response. Redirect causes an additional round
trip to the server.

The Server.Transfer( ) method performs a server-side redirection of a
page. The use of Server.Transfer( ) avoids an extra round trip but only
works with an ASPX file residing in the
same Web application on the same Web server. Also, when you use the
Server.Transfer method, any query string on the original request is not
automatically passed to the new page.

The Server.Execute method is like a function call to an ASPX file. This
method executes the specified ASPX file and then returns execution to
the calling ASPX page. The file specified
as an argument to the Server.Execute( ) must be an ASPX file residing on
the same Web server and the argument should not contain query string
data.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top