File Problem in VISTA
-
I want to move a file with the following function but i get UnathorizedAccessException thrown. What could be the problem. When i try to move it to My Documents, it works just fine, only when i move it to the C Drive it throws the Exception mentioned. I'm really stuck.
private void MoveFile()
{
string fileName = "myFile.txt";
FileInfo fInfo = new FileInfo(fileName);
fInfo.MoveTo(@"C:\"+fileName);
MessageBox.Show("Done");
}Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
I want to move a file with the following function but i get UnathorizedAccessException thrown. What could be the problem. When i try to move it to My Documents, it works just fine, only when i move it to the C Drive it throws the Exception mentioned. I'm really stuck.
private void MoveFile()
{
string fileName = "myFile.txt";
FileInfo fInfo = new FileInfo(fileName);
fInfo.MoveTo(@"C:\"+fileName);
MessageBox.Show("Done");
}Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
Have you got Admin rights on the box? Sounds pretty much to me like you don't have access to c:\ Can you manually move a file there in explorer?
Regards, Rob Philpott.
-
Have you got Admin rights on the box? Sounds pretty much to me like you don't have access to c:\ Can you manually move a file there in explorer?
Regards, Rob Philpott.
When i move a file in C, i get a pop up saying Destination Folder Access Denied, then asks me to provide administrators permission. I click on Continue to get permission. Then i get permission and the file is moved. Is there a way my program can make such permission requests? What is the best way to go about this?
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
When i move a file in C, i get a pop up saying Destination Folder Access Denied, then asks me to provide administrators permission. I click on Continue to get permission. Then i get permission and the file is moved. Is there a way my program can make such permission requests? What is the best way to go about this?
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
Well, security isn't really my thing, but your problem is clear enough. First off, can you move the file somewhere other than root? If not, you can fiddle around with the folder security on it and make sure the account you're using has full access to it. And, if its that stupid UAC vista thing, I'd consider turning it off completely if you can. It's most annoying.
Regards, Rob Philpott.
-
Well, security isn't really my thing, but your problem is clear enough. First off, can you move the file somewhere other than root? If not, you can fiddle around with the folder security on it and make sure the account you're using has full access to it. And, if its that stupid UAC vista thing, I'd consider turning it off completely if you can. It's most annoying.
Regards, Rob Philpott.
-
I want to move a file with the following function but i get UnathorizedAccessException thrown. What could be the problem. When i try to move it to My Documents, it works just fine, only when i move it to the C Drive it throws the Exception mentioned. I'm really stuck.
private void MoveFile()
{
string fileName = "myFile.txt";
FileInfo fInfo = new FileInfo(fileName);
fInfo.MoveTo(@"C:\"+fileName);
MessageBox.Show("Done");
}Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
You can't copy anything to the C drive unless it's to the application data folder.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
You can't copy anything to the C drive unless it's to the application data folder.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
Its all because of UAC, google to run application as Administrator, vista will ask for the permission. Actually, you are supposed to use the personal folder(My documents/App folder), in that case you will not face such problem.
I said that, but in a lot fewer words.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001