C# Application - Permissions

I have a C# application that creates a file in a particular folder (For example: C:\Test) and a shortcut in the All Users/Desktop and All Users/Start Menu. When I run this program as an administrative user it works fine but when I try to run as a normal user it gives me an exception to create a shortcut in the All Users folder. I think it has to do with permissions, but how should it be modified? The shotcut link is created using windows shell in the C# application. What I want is that if any user creates a file it should be available read/write for all users in that PC.
sreenathsAsked:
Who is Participating?
 
daniel_ballaCommented:
0
 
daniel_ballaCommented:
Hi sreenaths,
members of Everyone do not have write permissions by default on all users directory. so I doubt you will make it write that shortcut from under a non-admin user.

Cheers!
0
 
PockyMasterCommented:
You can try impersonation while writing the shortcut.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
daniel_ballaCommented:
Yes, but that supposes you have the administrator credentials on machine, which will not always be the case
0
 
sreenathsAuthor Commented:
Suppose User A (normal user) creates a file: C:\Test\trial.txt using a C# application, is it possible to make that file read/write for all users (admin and non-admin) in that PC.
Since members of Everyone do not have permissions is it possible to make it prompt for Admin user and password?
0
 
daniel_ballaCommented:
Yes and Yes. You can either prompt for admin user and impersonate, or even better, you can let the users know that an admin has to install this software and they can start it as an admin using run as.
0
 
sreenathsAuthor Commented:
How do I assign full control to the text file for all users in that PC?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.