Halil Ibrahim
Halil Ibrahim

Reputation: 1369

Silverlight client computer name, user name or a unique key from client

I'm trying to get a unique key from client such username or computer name but on wcf side none of the following works for me:

HttpContext.Current.Request.LogonUserIdentity.Name // blank
Security.Principal.WindowsIdentity.GetCurrent().Name

I'm using Anonymous mode for security and user shouldn't be logged on anyway. How can I do this ?

Thanks.

Upvotes: 1

Views: 1871

Answers (2)

SliverNinja - MSFT
SliverNinja - MSFT

Reputation: 31651

If you can guarantee unique IP addresses (not likely, but possible):

You could try accessing the Request.ServerVariables to retrieve the consumers IP Address?

Here's a list of common Server Variable Keys.

If you cannot guarantee unique IP addresses:

This SL forum post suggests using a GUID kept in isolated storage that is sent back and forth for context.

Upvotes: 0

Magnus Johansson
Magnus Johansson

Reputation: 28325

If you are using anonymous authentication mode, then a blank Name is what you get. As the mode implies, the request is kind of.... anonymous.

If a unique identifier is what you need, I think your best bet in this scenario would be to add a custom header to your request containing a Guid created at first run and preserved in isolated storage.

Upvotes: 1

Related Questions