Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello friends,

I have used the following code to take backup of database through iis in my asp.net project in c#.


C#
SqlCommand cmd = new SqlCommand("backup database dbname to disk='D:backupdb\\dbname.Bak'", con);
                cmd.ExecuteNonQuery();



But after uploading the same project on domain i was getting error as Access Denied to the folder.

Please somebody help me
Posted

Um.
Does your production SQL server have a D: drive? Do you have any access to it?

The chances are that the answer to both questions is "no" unless you are doing your own hosting: if you use a hosting service, then it is very unlikely that you will have any access by default, and even less likely that the hosting company will be willing to give you access!

have a look at this: Backing up an SQL Database in C#[^]
It provides a way to get a backup onto your website PC, rather than the SQL sever itself (which is a good idea when you think about it!)
 
Share this answer
 
Hi there,

Have you try to give full permission to your folder? From the error above, it seems the permission problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900