**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Web / Test / TestMonoWeb / AsyncModule.cs
blob839297b1c9e2a88df46db088c4f0ec9866dc1111
1 using System;
2 using System.Web;
4 namespace TestMonoWeb
6 /// <summary>
7 /// Summary description for AsyncModule.
8 /// </summary>
9 public class AsyncModule : IHttpModule
11 HttpApplication _app;
13 public void Init(HttpApplication app) {
14 app.AddOnPreRequestHandlerExecuteAsync(
15 new BeginEventHandler(this.BeginPreHandlerExecute),
16 new EndEventHandler(this.EndPreHandlerExecute));
18 _app = app;
21 IAsyncResult BeginPreHandlerExecute(Object source, EventArgs e, AsyncCallback cb, Object extraData) {
22 ((HttpApplication) source).Context.Response.Write("AsyncModule.BeginPreHandlerExecute()<br>\n");
24 AsynchOperation asynch = new AsynchOperation(cb, _app.Context, extraData);
25 asynch.StartAsyncWork();
26 return asynch;
29 void EndPreHandlerExecute(IAsyncResult ar) {
30 ((AsynchOperation) ar).Context.Response.Write("AsyncModule.EndPreHandlerExecute()<br>\n");
33 public void Dispose() {