ForumsProgramming ForumFinding the identity of someone logged on a website through WCF

0 4744
gilbert211
offline
gilbert211
1 posts
Nomad

I have a website running with ASP.Net hosted in asphostportal.com, and it's working fine. I also have a WCF service running which is supposed to act as an API for applications implemented onto the website (in my case games). Now my problem is that I want my applications to be able to call the WCF and return the user currently logged onto the website through my database solution, and I can't find a way to do this for the life of me. I've tried using:

But this seems to not have a value (null) when it's called by a session logged in on the website. I want my WCF to be able to update things like highscores etc. based upon who is logged in while running the applications, and this is kinda impossible as far as I know if I can't grab the identity of the person who is logged in. This is how I tried to test this out:

web.config:

All information I seem to find on the subject is related to standard authentication of users where you provide the credentials, while my issue is finding the credentials of someone logged onto my website.

I was looking at the problem from the wrong angle. This is how I am trying to fix it currently: I am generating a SessionId when the user visits a page holding an application, which holds information about the application ID, the user ID visiting the page, and the expiration date of the session (current date + time). You can apparantly forward information directly to .swf files you host (i.e: http://helpx.adobe.com/flash/kb/pass-variables-swfs-flashvars.html), so I pass the sessionId of the user to the application, which the application dev can then use to access the name of the user in the database by passing the sessionId to a SQL query which returns the acquainted user ID (could make it return the name as well, but the ID is more useful in my case). I will update with an answer if I make this solution work.

OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name;
  • 0 Replies
Showing 1-0 of 0