Server.Transfer

  • Thread starter Thread starter Drew
  • Start date Start date
D

Drew

I have a server.transfer question. I have a page that
utilizes the server.transfer method. On the page that is
transfered to - lets say page 2, I want to do another
server.transfer. This gives me the error:
System.InvalidCastException: Specified cast is not valid.

What is the proper way to do this type of page
navigation? Thanks - Drew
 
Hi Drew,

I just did a test with 3 pages : webform1.aspx -- > webform2.aspx --<
webform3.aspx

where in the Page_Load of both webform1.aspx and webform2.aspx I do a
Server.Transfer and it worked fine, could you post part of the code where
the exception is risen,

Cheers,
 
Drew said:
I have a server.transfer question. I have a page that
utilizes the server.transfer method. On the page that is
transfered to - lets say page 2, I want to do another
server.transfer. This gives me the error:
System.InvalidCastException: Specified cast is not valid.

It doesn't sound like a Server.Transfer problem so much as a type conversion
issue. By the way, I can conceive of no well-designed scenario where you
would actually want to do this. Server.Transfer should not be used to break
up code or control program flow - a terribly expensive way to do things. If
you need less code in your classes, then you should either use regions, or
abstract some of the code out to other classes.

R/
 
I am away from my home computer - I'll post the code
shortly.

But you can do server.transfer to go to multiple pages?

p1 -> -> p2 -> -> p3 -> -> p4

doing a server.transfer on each one.

Is that the proper practice for navigating web pages in c#?

Thanks.
 
Hi Drew ,
But you can do server.transfer to go to multiple pages?

p1 -> -> p2 -> -> p3 -> -> p4

doing a server.transfer on each one.

Yes, you can, I did that yesterday testing your problem
Is that the proper practice for navigating web pages in c#?

No, it's not, What are you trying to do?

cheers,
 
Back
Top