Solved

How to make .net windows application run under a different account (like impersonation)

Posted on 2014-07-21
5
272 Views
Last Modified: 2014-07-22
I am building an application where I will allow users to have do actions against files that they cannot do with their current permissions outside of the application. So I am thinking, is it possible to run the application under different serive account?. The application is a windows application (not web). Thanks
0
Comment
Question by:fmichail
  • 2
  • 2
5 Comments
 
LVL 40
ID: 40210564
Give a look at the following Process.Start overload: http://msdn.microsoft.com/en-us/library/vstudio/sxf2saat(v=vs.100).aspx
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40211509
0
 

Author Comment

by:fmichail
ID: 40211804
Hi CodeCruiser

From your solution, I understand that whenever the application needs to execute any set of secured commands (that are not permissted to the logged in user) I use the LogonUser, however, the logged in normal user is still being the user of the application for the remaining functionalities after CloseHandle statement. Is that correct?

Can the command that are executed be as well against data in SQL server, or just file system?

Hi JamesBurger,
Thanks for the reply, however, I do not want to start the full application instance as a specific domain user, I need to open the application as the "Normal me", however, some parts of the application (that I do not have permissions to perform) will be still done by me, but using the impersonated user. Thanks
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 40211914
>Can the command that are executed be as well against data in SQL server, or just file system?

Every action performed while the application is impersonating will be performed by using the security context of the impersonated user so yes this includes SQL server if you are using windows authentication.
0
 

Author Closing Comment

by:fmichail
ID: 40212096
Thanks CodeCruiser
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now