Server.Transfer incompatible with the CompositeWeb

Topics: User Forum
Nov 16, 2006 at 3:48 PM
just wanted to point out, that the Composite Web is Incompatible with the Server.Transfer.
this is, because server transfers are only allowed with pages, static files or Handlers derrived from defaultHttpHandler.
The badest thing about it is, that theres just an very, very general exception on this. was hard to find.
also it does not work, when you derrive from DefaultHttpHandler and implement all the async stuff, because the cleaning of the Execution pipe in .net throws an ReferenceNullException....
sad sad sad....
now i implemented another workaround. but this also works for ascx files. what makes it a little bit nicer again.
Jul 30, 2007 at 5:43 PM
I'm looking to the WCSF Workshop example where a NavigationService is defined.

I tryed to use HttpContext.Current.Server.Transfer(view) in the NavigationService and I also found that the CompositeWeb still have some problem with Server.Transfer: in fact the presenter of the transfer page is not created.


public class RedirectNavigationService : INavigationService
{
public void Navigate(string view)
{
//HttpContext.Current.Response.Redirect(view, true);
HttpContext.Current.Server.Transfer(view);
}
}

Can someone suggest me some solution/work around?
Oct 9, 2008 at 4:45 PM
Did you find any solution with NavigationService? I am looking for Server.Transfer option for navigation between web pages along with state. This is becoming now a higher priority.

Workarond will really helpful?!!
 
Thanks
Oct 10, 2008 at 8:33 AM
I'am afraid!
At the end I used only the Redirect because I didn't find any work around. No answer from the devoloping group arrived.

 

public

 

class RedirectNavigationService : INavigationService

 

 

 

 

{

 

public void Navigate(string view)

 

{

 

HttpContext.Current.Response.Redirect(view);

 

}

}

Oct 14, 2008 at 11:22 AM
The following piece of code is from Global Bank RI, in the controller of the EFT module.

protected virtual void RedirectTo(string newAddress)
{
    Guard.ArgumentNotNullOrEmptyString(newAddress, "newAddress");
    IHttpContext context = new Microsoft.Practices.CompositeWeb.Web.HttpContext(HttpContext.Current);
    context.Server.Transfer(newAddress);
}

This seem to be working properly when I was playing around with it...


Developer
Oct 14, 2008 at 2:58 PM

Hi

 

Which version of the WCSF are you using? If you are using the WCSF — June 2007 or an early version the problem is caused the dependency injection is only performed in the first page requested and not into the page that you are transferring. This causes that the presenter was not injected.

 

In the new releases of WCSF (from Composite Web Client Automation Bundle which works on Visual Studio 2005, or WCSF - February 2008 release which works on Visual Studio 2008) does not appear this problem since the dependency injection is performed in the PreInit event of the page (but your pages must inherit from the Microsoft.Practices.CompositeWeb.Web.UI.Page class).

 

Please let me know if this helps.

 

Mariano Converti

http://blogs.southworks.net/mconverti