Access denied to folder in ASP.NET project either though I have granted all users full permissions !!
-
Hello, i have made a very simple file upload app, that i want users to be able to upload images to a folder on my server, well localhost for the time being :laugh: here is the simple upload code...
protected void ButtonRegisterDetails\_Click(object sender, EventArgs e) { // display properties of the uploaded file String FileName = MyFile.PostedFile.FileName; String FileContent = MyFile.PostedFile.ContentType; int FileSize = MyFile.PostedFile.ContentLength; // get just the file name String justFileName = Path.GetFileName(FileName); try { MyFile.PostedFile.SaveAs(@"C:\\Downloads"); ProgressTextBox.Text = "uploaded ok.... i think"; } catch (Exception ex) { ProgressTextBox.Text = ex.Message.ToString(); } }
The code looks fine but the problem i have is that i keep getting an exception saying that the access to the destination folder is denied. Access to the path 'C:\Downloads' is denied. Ive been reading about granting permissions for 2 days now, and although im new to IIS i believe that because i have the NETWORK SERVICE but not ASPNET user available im using IIS 6. in a disparate attempt to try and solve this i created a new project using the same C# code as above and pointed the images to be saved in a new directory "C:\Downloads". i granted full access permissions to all the users that were listed when i right clicked on the C:\Downloads dir and selected.... Sharing and Security Security tab add Advanced Find Now The users that people have said should work "IUSR_mycomputer" and "NETWORK SERVICE" make no difference either, but even by giving all users, well over 60 of them full access permissions it makes no difference. :confused: could it be something to do with the way ASP.NET, or IIS is installed on my machine ?? Im using Windows XP pro 64bit and Visual studio 2008. basically my question is.... how can i grant write permissions to a folder in my asp.net app as changing permissions in the Sharing and Security properties has done nothing ?? :sigh: thank you for your time.... please help :(( Truegilly
-
Hello, i have made a very simple file upload app, that i want users to be able to upload images to a folder on my server, well localhost for the time being :laugh: here is the simple upload code...
protected void ButtonRegisterDetails\_Click(object sender, EventArgs e) { // display properties of the uploaded file String FileName = MyFile.PostedFile.FileName; String FileContent = MyFile.PostedFile.ContentType; int FileSize = MyFile.PostedFile.ContentLength; // get just the file name String justFileName = Path.GetFileName(FileName); try { MyFile.PostedFile.SaveAs(@"C:\\Downloads"); ProgressTextBox.Text = "uploaded ok.... i think"; } catch (Exception ex) { ProgressTextBox.Text = ex.Message.ToString(); } }
The code looks fine but the problem i have is that i keep getting an exception saying that the access to the destination folder is denied. Access to the path 'C:\Downloads' is denied. Ive been reading about granting permissions for 2 days now, and although im new to IIS i believe that because i have the NETWORK SERVICE but not ASPNET user available im using IIS 6. in a disparate attempt to try and solve this i created a new project using the same C# code as above and pointed the images to be saved in a new directory "C:\Downloads". i granted full access permissions to all the users that were listed when i right clicked on the C:\Downloads dir and selected.... Sharing and Security Security tab add Advanced Find Now The users that people have said should work "IUSR_mycomputer" and "NETWORK SERVICE" make no difference either, but even by giving all users, well over 60 of them full access permissions it makes no difference. :confused: could it be something to do with the way ASP.NET, or IIS is installed on my machine ?? Im using Windows XP pro 64bit and Visual studio 2008. basically my question is.... how can i grant write permissions to a folder in my asp.net app as changing permissions in the Sharing and Security properties has done nothing ?? :sigh: thank you for your time.... please help :(( Truegilly