best way to do this

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

my vb.net program creates a file a the c:\root but when the users run it
they get denied. what are some different ways to resolve this authority issue?
what's the best way to do this?

thanks,
rodchar
 
rodchar,
The "best" way to resolve this is to stop creating files in the root folder!
:-|

I would recommend you create the file's in the user's profile, You can use
Environment.GetFolderPath to find the path to any number well known folders.

Normally I use SpecialFolder.Personal, which is the "My Documents" folder.

However! If the data needs to be shared among users within the application I
would recommend one of the SpecialFolder ApplicationData folders instead...

Be certain to read the online help on Environment.GetFolderPath & the
Environment.SpecialFolder enumeration.


Other ways to resolve this include, but are not limited to, giving users
authority to create files in the root folder... Of course giving users this
authority, *gives* users this authority to do it outside your program also!

Hope this helps
Jay
 
Don't put the data in a directory off root. Put it in
Application.UserAppDataPath or Application.CommonAppDataPath.

HTH,

Sam
 
It is not advisable to create your file in root. If you login as
Administrator you should not have any problem to create the file there.

chanmm
 
rodchar said:
but isn't there a way to temporarily grant a program to write where it's told?

Require your user to run the program as an Administrator.

LFS
 
rodchar,
but isn't there a way to temporarily grant a program to write where it's
told?
Yes there are!

There was a discussion earlier this week titled "File.copy as another user"
in this newsgroup that talked about it, and discussed a couple of possible
options.

However I question even the Administrator creating files in the C:\ (the
root) directory! Hence my answer. Or is "root" a specific folder in C:\?

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top