1

Is there possibility to find user name and IP who wants to calls WCF service? (but he/she is never authenticated).

I have:

System.Threading.Thread.CurrentPrincipal.Identity.Name; System.ServiceModel.ServiceSecurityContext.Current.PrimaryIdentity.Name;

but this contains logged in users.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Mark
  • 71
  • 1
  • 4

1 Answers1

2

No, it isn't. Either you are authenticated and have an identity on the server or you are not logged in and are anonymous.

You can also look at it from a privacy perspective: Do you want every single site that you visit on the Internet to be able to get your username?

The IP address is of course something else as it is needed for communication. There is another SO post on that issue:

Obtaining client IP address in WCF 3.0

Community
  • 1
  • 1
Anders Abel
  • 67,989
  • 17
  • 150
  • 217
  • I mean username that is sent to service to log in. So web service must have username to try to authenticate. – Mark Nov 15 '11 at 09:54
  • So you want the username that was sent, even though authentication was unsuccessful? If you are hosting in IIS you can probably write your own Membership provider that somehow catches the user name even if it is not authenticated. – Anders Abel Nov 15 '11 at 09:59
  • Yes, I want username that authentication was unsuccessful – Mark Nov 15 '11 at 10:24