Sent date: 05/23/2008
From: Alphapage
Message:I want to process the following code in WCF:
using System;
using System.Web;
using System.Web.UI;
using System.Web.Services.Protocols;
using System.Web.SessionState;
public class AspCompatWebServiceHandler :
System.Web.UI.Page, IHttpAsyncHandler, IRequiresSessionState
{
protected override void OnInit(EventArgs e)
{
IHttpHandler handler =
new WebServiceHandlerFactory ().GetHandler(
this.Context,
this.Context.Request.HttpMethod,
this.Context.Request.FilePath,
this.Context.Request.PhysicalPath);
handler.ProcessRequest(this.Context);
this.Context.ApplicationInstance.CompleteRequest();
}
public IAsyncResult BeginProcessRequest(
HttpContext context, AsyncCallback cb, object extraData)
{
return this.AspCompatBeginProcessRequest(
context, cb, extraData);
}
public void EndProcessRequest(IAsyncResult result)
{
this.AspCompatEndProcessRequest(result);
}
}
In order for AspCompatWebServiceHandler to work its magic, it must be
registered as the HTTP handler for ASMX files. You can register it using this
web.config file:
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.asmx"
type="AspCompatWebServiceHandler, __code" />
</httpHandlers>
</system.web>
</configuration>
Thanks for your help.
Sent date: 05/23/2008
From: "Teemu Keiski" <(email address - cut out)>
Message:With compat mode you have access to HttpContext so you can use
HttpContext.Current.Handler, however you didn't tell too much about your
case, so I don't know is it adequate for your case...
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Alphapage" <(email address - cut out)> wrote in message
news:(email address - cut out)...
Show quoted text
> Hello,
>
> I want to get the IHttpHandler from a svc service.
> With old asmx webservices, I get it using
> WebServiceHandlerFactory.GetHandler .
>
> How can I get IHttpHandler in WCF running in serviceHostingEnvironment :
> aspNetCompatibilityEnabled="true" ?
>
> Thanks in advance for your help.