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

1.8k views Asked by At

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.

2

There are 2 answers

2
Magnus Johansson On

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.

2
SliverNinja - MSFT On

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.