Uploading files Access Denied Error

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2006
Posts: 36
Reputation: web developer is an unknown quantity at this point 
Solved Threads: 0
web developer's Avatar
web developer web developer is offline Offline
Light Poster

Uploading files Access Denied Error

 
0
  #1
Apr 12th, 2006
Hi all,
I am very happpy to return back again to you.
This time i have a critical problem about uploading files on the server by asp.net.
I choosed the HTML control "File" and Make it run as server control , and got its file name by the statement
string fname=File1.PostedFile.FileName
then i want to save it on the server Hard Disk so i used the statement :

try
{
File1.PostedFile.SaveAs(Server.MapPath("Project\\"+ff));
}
catch
{
Directory.CreateDirectory(Server.MapPath("Project\\"+ff));
File1.PostedFile.SaveAs(Server.MapPath("Project\\"+ff));
}


When running the page the following exception occured
Access to the path "c:\inetpub\wwwroot\Cubicle\Project\MyFile.doc" is denied.
which "c:\inetpub\wwwroot\Cubicle\" is my project directory (my project name is Cubicle)
Note : i configured the IIS options to be write ,read, and Directory browsing . and the problem is still exist .
Can any one help me ?
Thank You.
Life Is A Big Code
Rushdy Ibrahim
Egypt
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Uploading files Access Denied Error

 
0
  #2
Apr 12th, 2006
try
  1. {
  2. File1.PostedFile.SaveAs(Server.MapPath("\\Project")+"\\" + ff);
  3. }
  4. catch
  5. {
  6. try
  7. {
  8. Directory.CreateDirectory(Server.MapPath("Project"));
  9. File1.PostedFile.SaveAs(Server.MapPath("Project")+"\\" + ff);
  10. }
  11. catch(Exception exp)
  12. {
  13. string message = exp.Message;
  14. }
  15. }
Last edited by campkev; Apr 12th, 2006 at 6:59 pm. Reason: added code tags
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 66
Reputation: silviuks is an unknown quantity at this point 
Solved Threads: 11
silviuks silviuks is offline Offline
Junior Poster in Training

Re: Uploading files Access Denied Error

 
0
  #3
Apr 13th, 2006
are u sure u entered in the form tag enctype="multipart/form-data"?
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 36
Reputation: web developer is an unknown quantity at this point 
Solved Threads: 0
web developer's Avatar
web developer web developer is offline Offline
Light Poster

Re: Uploading files Access Denied Error

 
0
  #4
Apr 13th, 2006
Thank you All
i have solved the problem from IIS Configuration by right click on the project name (from IIS window) and then All Tasks -> Permission Wizard and select read,write permissions.
it is solved now . and was no problem with the code .
Thank you again .
Life Is A Big Code
Rushdy Ibrahim
Egypt
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 1
Reputation: ab_dc is an unknown quantity at this point 
Solved Threads: 0
ab_dc ab_dc is offline Offline
Newbie Poster

Re: Uploading files Access Denied Error

 
0
  #5
Nov 29th, 2007
hello all, I'm new here
I try to follow everything in Google search to resolve my problem
but nothing done
I'm trying to upload file in asp.net
the same error of " Access to the path 'c:\inetpub\wwwroot\aa' is denied. " repeated every time I try to upload
so how to manage this problem ? I put all privileges to aspnet user and also to all user , but nothing changed
any help pleas , please
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 18
Reputation: shaulf is an unknown quantity at this point 
Solved Threads: 4
shaulf's Avatar
shaulf shaulf is offline Offline
Newbie Poster

Re: Uploading files Access Denied Error

 
0
  #6
Nov 29th, 2007
Originally Posted by ab_dc View Post
hello all, I'm new here
I try to follow everything in Google search to resolve my problem
but nothing done
I'm trying to upload file in asp.net
the same error of " Access to the path 'c:\inetpub\wwwroot\aa' is denied. " repeated every time I try to upload
so how to manage this problem ? I put all privileges to aspnet user and also to all user , but nothing changed
any help pleas , please
There are two places the permissions need to fixed at for upload to work:
1. IIS on the folder you want to upload you need to check the allow write check box
2. right click the actual folder in file explorer and allow everyone to write to this folder. Please remember the web user is a low permission user IIS_ somthing.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC