Server.Transfer problem

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

Guest

All,

I have a ASP.NET webform that has a button that when clicked simply directs
the user to another .htm page - code below

private void btnSend_Click(object sender, System.EventArgs e)
{

try
{
Server.Transfer("thanksr.htm");
}
catch(Exception ex)
{
string message=ex.Message;
}

}

When I attempt to perform the Server.Transfer I get an error saying "Error
executing child request for thanks.htm."

What am I doing wrong?

Thanks
Msuk
 
I have a ASP.NET webform that has a button that when clicked simply
directs
the user to another .htm page - code below
Server.Transfer can only be used to transfer execution to another ASPX page.
You will have to user Response.Redirect to redirect the user to your HTML
page.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
Hi

I have converted my .htm to a .aspx webform and when I perform the
Server.Transfer("thanks.aspx") the catch block is invoked with an error
saying 'Thread is aborting' but the the new page appears - what is still
wrong?

Thanks
Msuk
 
I have converted my .htm to a .aspx webform and when I perform the
Server.Transfer("thanks.aspx") the catch block is invoked with an error
saying 'Thread is aborting' but the the new page appears - what is still
wrong?
The Server.Transfer method ends the current response by calling
Response.End. The Resonse.End method calls the Abort method on the current
thread. This is why you get a "thread is aborting" exception. There is
nothing wrong with you code.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
msuk said:
All,

I have a ASP.NET webform that has a button that when clicked simply
directs


Please post ASP.NET questions to the asp.net NG.-
microsoft.public.dotnet.framework.aspnet . This NG is for Csharp

Willy.>
 

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