views:

208

answers:

7

I have created C# application, which creates a image file on Desktop. It works fine on XP and Vista (admin account) but it fails to create image file on Desktop in Vista (standard account).

Whether i have to include manifest file to the application to work properly? If i add manifest, will it work on XP without any problems?

Sorry if it is lame question. Thanks in advance.

A: 

To answer your first question, in the absence of any details about the code and errors generated it sounds like the standard account doesn't have the permissions to create a file on the desktop.

Can you do it manually when logged in using the standard account? I've not got Vista installed so I can't check myself.

ChrisF
I can create the file manually on Desktop but file creation through program fails.
Mahesh
You'll need to give us more information about exactly which line fails and how
ChrisF
A: 

You should have no problems creating a file on the desktop. However, that desktop might now have a different location. Are you actually trying to create a file on the Vista desktop, or are you accidentily still trying to create a file using paths from XP? Can you distill your code to a 20 line example?

MSalters
+1  A: 

Which folder are you trying to create the file in? The shared desktop folder or the user's desktop folder? Ordinary users cannot create shared desktop files.

You should be writing to the folder specified by the following Registry value:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop
Dave Webb
+4  A: 

Make sure you're using the System.Environment.SpecialFolder class to tell you where your user's Desktop really is.

Martin
A: 

I bet it's the access rights. The Vista UAC thing that comes up and asks for permission would probably be a good thing there.

Check this link for how to get UAC access:

Demand UAC elevation for an application

Wolf5
A: 

With in the directory of your App give permissions to Users to take ownership and delete. This involves clicking the Advanced button within the Security Tab. Once you apply the changes you File IO should work fine.

A: 

My suggestion is only needed if trying to do File IO within a system directory like C:\Program Files...