473,396 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Get Username around UAC

I have an application that needs to be elevated if being run by a standard user. My problem is that when I get the username it will get the Username of the admin who elevated the program. I can not seem to find a way around this, any ideas?
Jul 31 '09 #1
3 2837
Plater
7,872 Expert 4TB
What code are you using to get the username? There might be a different way.
Are you using WindowsPrincipal?
Jul 31 '09 #2
I have been using WindowsIdentity.GetCurrent().Name :)
Jul 31 '09 #3
Plater
7,872 Expert 4TB
@mikeymike
Hmm, thats the one I thought would have been the actual user.
So Environment.UserName probably has the wrong user as well?

You can try playing around with WMI (check out the WMICodeCreator).
Win32_LoggedOnUser might prove useful, or possibly even Win32_Desktop?

For my situation, the loggedonuser showed a number of users (myself, and various system accounts), when I check Win32_LogonSessionMappedDisk (since I have drives mapped) I find the mapped drives point to an ID number that points to my actual loggedonuser instance.
In Win32_LogonSession my loggedonuserid is the only one using kerberos authentication.

There is bound to be a way to get what you want out of some combination of those classes
Aug 3 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Candice | last post by:
Please somebody help! I've deleted my admin username and password which was initially set at test. Now I can't log into my website as the administrator. How do I put Username and Password back so...
3
by: red | last post by:
I know this is probably a faq but it is hard to search for this exact problem. When I put this on a php page: <? $link = mysql_connect("localhost", "cardini", "password") or die("Could not...
8
by: Chris Hall | last post by:
Hello, Any one got any good ideas or where to look for solutions how to stop multiple log ins with the same username? I am using mysql database if that makes a difference. Cheers Chris...
6
by: Bob Lin | last post by:
I would like to display the hostname (or computername) and username (or logonID) on our Intranet support page. I saved the following vbs code as asp file, but it doesn't display the username. No...
1
by: Hardy Wang | last post by:
Hi, I have my own user table with definition like UserID int not null primary key, Username varchar(50) not null, Password varchar(50) not null, Firstname varchar(50) not null, Lastname...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
15
by: Eugene Anthony | last post by:
Is this method of validation for password and username considered to be secured. In my previous post I was given a solution that uses command object and the values are parsed by parameters. But the...
2
by: M Cavanagh | last post by:
I need to reference each user's (many) home share on a network and tried using the Wndows %username% to do so but this did not work to reference the directory where my import tables will be using...
0
by: JL | last post by:
I am implementing a login page using ASP.NET 2.0 Login control. I'd like user use their email as user name, I have implemented my own Authenticate even handler, but I get a "LayoutTemplate does not...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.