Getting AD UserName

Getting AD UserName


I wish to add in the real user in a Domain who last accessed a record. I have tried to use a webservice to do this but have come unstuck with webreference authentication.

Is there a simple way to get the UserName of the person who is accessing the site and set this in a Session Variable.

I am using the Community Edition and NTLM.
My solution was to call the webservice using client side javascript.

First I check if the Session Variable 'User' has been set. If it is blank, I store the current URI the user is at with GetBookmarkableURL() then I redirect the user to a page which has the javascript which calls the webservice as an Webscreen Onload action.

The last command in the javascript is to call a web screen which has an input parameter using window.location = target.aspx?UserID=<value from service call>

On the Target webscreen I then store that input in a session variable called User and redirect the user to the page I stored the current URL at the start of the process.

I only do this because I trust the users of my system. It is very easy to override this by calling the target.aspx with any username.

 Hi Al,


Great you have found a solution! To create a more secure solution you could take advantage of Windows Integrated Authentication (Professional and Enterprise editions only) and you can use the IntegratedSecurityGetDetails built-in action to get the user name. To call a web service that requires authentication I would suggest you to use the Extension Enhanced Web References.



Tiago Simões