1

How can I get the username from the webservice my Webservice is configured under Enterprise sign on authentication.

I am using the below code for webapplication Request.ServerVariables("HTTP_CT_REMOTE_USER") and I need a equivalent for webservices

Context.Request.ServerVariables["HTTP_CT_REMOTE_USER"] 

returns null for me

SharpC
  • 6,974
  • 4
  • 45
  • 40
SSK
  • 783
  • 3
  • 18
  • 42
  • 2
    Whatq web service type are you using? ASMX web service or WCF service? How do your users authenticate against that webservice - integrated Windows Auth? Custom Auth? Forms Auth? You need to give us a bit more information here!! – marc_s Apr 19 '10 at 04:54

2 Answers2

1

This is working for me Context.Request.ServerVariables["LOGON_USER"]

Stu Thompson
  • 38,370
  • 19
  • 110
  • 156
SSK
  • 783
  • 3
  • 18
  • 42
0

This works with the later WCF services:

ServiceModel.ServiceSecurityContext.Current.WindowsIdentity.Name

It does NOT work with the classic ASMX services. For those use SSK's solution.

SharpC
  • 6,974
  • 4
  • 45
  • 40
Jeff
  • 8,020
  • 34
  • 99
  • 157