server.transfer

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

VB.NET....

Serving page 1 which has a text box and a button. When the button is push
the button_click event is called. In this event I want to serve Page 2 if
the text box contains <value1> and page 3 if the text box contains <value2>.

I am having trouble with the code to effect the transfer. The IF clause
works correctly.
---------------
Private Sub Button1_Click(ByVal sender as System.Object, ByVal e As
SystemEventArgs) Handles Burron1.click

If Text1.text = "text1" then
Server.Transfer("page2")
else
Server.Transfer("page3")
End IF

End Sub
------------

Page 1 displays correctly. After clicking the button, I get
"Server Error in '/test' Application
Exception Details: System.Web.HttpException: Error executing child request
for page2

Both pages are in the same project and were built in VB.NET with .aspx
extensions.

Thanks for your help.
 
Hi Dan,

Serving page 1 which has a text box and a button. When the button is push
the button_click event is called. In this event I want to serve Page 2 if
the text box contains <value1> and page 3 if the text box contains <value2>.

I am having trouble with the code to effect the transfer. The IF clause
works correctly.
---------------
Private Sub Button1_Click(ByVal sender as System.Object, ByVal e As
SystemEventArgs) Handles Burron1.click

If Text1.text = "text1" then
Server.Transfer("page2")
else
Server.Transfer("page3")
End IF

BTW, it Should be Text1.Text ="Value". Since you mentioned that IF condition
works properly, i think the problem lies in the way the Page 3 is handling
the QueryString.
The error points to the page2. Are you redirecting it to the right page???.

Hope this helps....


Happy Coding
 
What are the full path names to the files. Just "page2", not "page2.htm" or
"page2.aspx" ? And make sure to use the other version of the call to
preserve posted data.
 
Back
Top