Server.Transfer From App1 to App2

  • Thread starter Thread starter Manuel Lopez
  • Start date Start date
M

Manuel Lopez

Hello,

We have two applications that will reside on the same webserver.

We want to be able to post from pages in App1 to to pages in App2.

We need to pass sensible data, so we cannot use querystring.

We are using server.transfer (needing to reference App2 in App1).

When we call a page in App2 from App1, the ApplicationDomain doesn´t
change when page in App2 loads, being this the one of App1.

When we try to post on the loaded page of App2, we get an execption of
invalid viewstate.

HttpException (0x80004005): El valor de viewstate no es válido para
esta página y puede estar dañado.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain() +423

Is this approach of using server.transfer valid between applications
(web projects)?

Or can you only use it in the same application domain?

Thanks for any guiadance or help.

Manuel
 
Hello Troy,

Yes can do a server.transfer to another page , as long as
you reference the dll that contains the codebehind of the
destination page.

The problem is that the application domain of the
destination page is not started, it uses application
domain of the caller page.

So once the destination page is loaded and you try to do
something, you get the invalid viewstate.

This is a big contraint, since you generally have quite a
few web apps that belong to the same webserver and need to
share context between them.

Not to mention that if you are sharing user controls, (by
having virtual directories to destination folder on all
web apps), server.transfer doesn´t work because it
considers that the shared user controls belong to another
application.

I really don´t know what to do???

-----Original Message-----
As far as I know, Server.Transfer cannot be used between different web
applications.

Manuel Lopez said:
Hello,

We have two applications that will reside on the same webserver.

We want to be able to post from pages in App1 to to pages in App2.

We need to pass sensible data, so we cannot use querystring.

We are using server.transfer (needing to reference App2 in App1).

When we call a page in App2 from App1, the ApplicationDomain doesn´t
change when page in App2 loads, being this the one of App1.

When we try to post on the loaded page of App2, we get an execption of
invalid viewstate.

HttpException (0x80004005): El valor de viewstate no es válido para
esta página y puede estar dañado.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium ()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain() +423

Is this approach of using server.transfer valid between applications
(web projects)?

Or can you only use it in the same application domain?

Thanks for any guiadance or help.

Manuel


.
 
Hi, Manuel,

I agree that AppDomain is the real problem here. Usually we don't share
context between web apps. If you really want to do that, maybe it is not a
good idea to maintain context state at the server-side. Have a try to save
viewstate at client side using cookies or something else and use
Response.Redirect() to navigate to another page which belongs to another web
app. I am not sure if viewstate will be correctly maintained through this
kind of redirection since even MSDN documents haven't mentioned that. Good
luck!

Troy

Hello Troy,

Yes can do a server.transfer to another page , as long as
you reference the dll that contains the codebehind of the
destination page.

The problem is that the application domain of the
destination page is not started, it uses application
domain of the caller page.

So once the destination page is loaded and you try to do
something, you get the invalid viewstate.

This is a big contraint, since you generally have quite a
few web apps that belong to the same webserver and need to
share context between them.

Not to mention that if you are sharing user controls, (by
having virtual directories to destination folder on all
web apps), server.transfer doesn´t work because it
considers that the shared user controls belong to another
application.

I really don´t know what to do???

-----Original Message-----
As far as I know, Server.Transfer cannot be used between different web
applications.

Manuel Lopez said:
Hello,

We have two applications that will reside on the same webserver.

We want to be able to post from pages in App1 to to pages in App2.

We need to pass sensible data, so we cannot use querystring.

We are using server.transfer (needing to reference App2 in App1).

When we call a page in App2 from App1, the ApplicationDomain doesn´t
change when page in App2 loads, being this the one of App1.

When we try to post on the loaded page of App2, we get an execption of
invalid viewstate.

HttpException (0x80004005): El valor de viewstate no es válido para
esta página y puede estar dañado.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium ()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain() +423

Is this approach of using server.transfer valid between applications
(web projects)?

Or can you only use it in the same application domain?

Thanks for any guiadance or help.

Manuel


.
 
Back
Top