HttpApplication.AcquireRequestState Event

Topics: Web Client Software Factory
Feb 5, 2007 at 5:22 PM
Good Afternoon,

I need to execute code inside the HttpApplication.AcquireRequestState Event. How do I do this with the WCSF. It appears I cannot use the global.asax for this event.

Any help would be appreciated.

Thanks in advance.
Feb 5, 2007 at 6:20 PM
Hi

First a web application based on this factory is not an HttpApplication, its a Microsoft.Practices.CompositeWeb.WebClientApplication, but this class inherits from the HttpApplication clas.

To do what you want, you must update the source code of the WebClientApplication class in the CompositeWeb project included with this factory. just modify the constructor like this:
public WebClientApplication()
{
this.AcquireRequestState += new EventHandler(WebClientApplication_AcquireRequestState);
}
add the code you need to the WebClientApplication_AcquireRequestState method and rebuild the project. If you like me have used the prebuilt version of the Microsoft.Practices.CompositeWeb.dll you must now replace the old version with your modifyed one.
Then you should be ready to go.

TAG
Coordinator
Feb 5, 2007 at 8:39 PM
Another option, to avoid changing the App Block would be to do what we do in the Reference Implementaion:
1. Derive your own class from WebClientApplication in the App_Code folder of your web site
2. Add the event handlers you need in the constructor
3. Edit the gloabal.asax to point at your derived class

I hope that helps.