access HttpContext.Current from WCF Web Service

后端 未结 3 2039
遥遥无期
遥遥无期 2020-12-02 15:37

I just started using WCF Services with ASP.NET AJAX. I instantiate my WCF service from Javascript and then pass string variables as arguments to my WCF Service method (with

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 16:15

    You do not have a HttpContext by default but you have many of the same objects present in the OperationContext (which is always present) or the WebOperationContext (which is only available for certain bindings.

    You can access the OperationContext or WebOperationContext by using the static .Current property like so: WebOperationContext.Current

提交回复
热议问题