How to get the name of the logged in user

davidrobin

Active member
Joined
Jun 24, 2003
Messages
41
Im not sure if this is a deployment issue of actual progrmming issue.

In VB6 we used the GetUserName API call to get the id of the user logged in to the network.

The application lives on a network drive.

When I converted the application in VS.net 2003 and ran it I got a security error. Saying something about security permissions do not allow the action to take place.

When I moved the application to the local C drive the error did not appear.

The equivalent to GetUserName in .net is System.Security.Principal.WindowsIdentity.GetCurrent.Name. When I added this to a project I started getting different errors.

How can I have an application on a network drive and read the user id.
Is this going to be a big issue involving the IT dept.

Any help would be appreciated.
 
Applications running from a network drive have a restricted security policy. You can change this through the configuration tools under your administrative tools.
Search these forums and youll probably find more information on this.
 
Last edited by a moderator:
So am i going to have to change the security on every machine that uses my app? That sounds like a big job. 800+ staff.
 
Wouldnt Code Access Security (CAS) file designed by your network admins (or .Net admins) to control application permissions work for this? If they define some security levels to assign permission levels, then create some strong name key files to relate to these levels, they could digitally sign different assemblies before deployment. Once theyve send the CAS file out to all the clients (SMS job), each signed assembly will pick up the appropriate permissions.

From what I understand, this is what MS does in-house, and were exploring this option for a smart-client deployment in the future.
 
Back
Top