Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Backup database from code: Access denied on user specific directories

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robin - 31 May 2007 02:03 GMT
I want to backup a sql express database from my windows forms C# code. I can
do this by running a sql command "BACKUP DATABASE TO..."  (or using SMO) and
I can save the backup file to any subdirectories of C:. The problem I have
is that I want the user to be able to save the backup file to any location,
including C:\...documents and settingsm\my documents...

However, the file access for these directories (user specific) are more
limited and the BACKUP DATABASE command fails due to Access Denied.

Should I mess with the ACL to grant NETWORK SERVICE read/write permissions
on the directory they want to save to? I am not very comfortable doing this
as I don't like the idea of changing the ACL security on someone's system.

The simplest solution is for me to restrict where they can save the backup
file (to subdirectory of C:\), but if there are any other solutions, I'd
like to hear them.

Thanks.
Linda Liu [MSFT] - 31 May 2007 08:56 GMT
Hi Robin,

Could you tell me what the OS is on your machine?

In my opinion, it is not a good idea to grant NETWORK SERVICE read/write
permissions on the directory the user wants to save to, because it will
break the access security.

I think the simplest way is to use the try...catch structure to catch the
exception when the user attemps to save the file to a directory that he
doesn't has the corresponding permission.

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Robin - 01 Jun 2007 00:42 GMT
Development is being done on Windows XP. Application is recommended to run
on Windows XP also.

> Hi Robin,
>
[quoted text clipped - 34 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Linda Liu [MSFT] - 01 Jun 2007 10:50 GMT
Hi Robin,

Thank you for your response.

Then how about my suggestion? Is it appropriate to your practice?

If you need our further assistance, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.