0

I have wcf services. Some of them are one way, some are not. Those that are not one way work with forms authentication and i get HttpContext.Current.User. Those that are one way get a null in HttpContext.Current.User.

How to fix?

I am using ASP.NET Compatibility Mode

taminov
  • 591
  • 7
  • 23

1 Answers1

1

Via HttpContext.Current is null in my web service:

WCF Services and ASP.NET

Within an AppDomain, features implemented by the HTTP runtime apply to ASP.NET content but not to WCF. Many HTTP-specific features of the ASP.NET application platform do not apply to WCF Services hosted inside of an AppDomain that contains ASP.NET content. Examples of these features include the following:

HttpContext: Current is always null when accessed from within a WCF service. Use RequestContext instead.

[...]

HttpContext: WCF services running in ASP.NET Compatibility Mode can access Current and its associated state.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • you mean `OperationContext.Current.RequestContext1` ? this one is also null. Anyway I need to access to the 'HttpContext.Current.User' property. – taminov Mar 11 '13 at 11:35
  • _"Anyway I need to access to the 'HttpContext.Current.User' property."_ - no, you need to get the currently logged on user. If that is not in that property and that is documented, you need to look somewhere else. Also see edit, take a look at ASP.NET Compatibility Mode. – CodeCaster Mar 11 '13 at 11:44
  • 1
    Well perhaps then it's useful to edit your question with what you have tried and what your configuration is, if you don't want this to become a game of guess. – CodeCaster Mar 11 '13 at 11:49