I can't upload a file

s3ad2002

Member
Joined
Feb 27, 2006
Messages
6
Programming Experience
1-3
Hi everybody

I had been trying too develop a programe using asp.net with vb to upload a file but when I ran the program this error message appeared "Access to C:\......... is denied "and I'm using XP pro. I tried to grant writing Acess by Adding the Asp.net account to the folder's users after I removed the simple sharing property but the problem still presist

Can any body help me Plz ?????

Many thanks
 

If you get an "access denied" error when trying to save files directly to your Web application folder, go check your permissions. Ensure that your virtual directory in IIS has read and write permissions. (Change this through IIS.) You may also want to ensure that your ASPNET, guest, or impersonated accounts have appropriate permissions, both for computer access and for the actual folder itself. (To change this, right-click on the folder, select Sharing and Security, and then select the Security tab.)
 
Thank you for your response , I tried what you have said to me but no change the problem still presist. for more explination this is my code maybe somthing wrong with it
dim len As Integer = 0
Dim myfile As HttpPostedFile
Dim newfile As System.IO.FileStream
myfile = fileMyFile.PostedFile
len = myfile.ContentLength
Dim mydata(len) As Byte
myfile.InputStream.Read(mydata, 0, len)
newfile = New System.IO.FileStream("C:\Inetpub\wwwroot\WebApplication1", IO.FileMode.Create)
newfile.Write(mydata, 0, mydata.Length)
newfile.Close()

which is filemyfile is the html control for uploading the file

an the error meesage is
Access to the path "C:\Inetpub\wwwroot\WebApplication1" is denied.

please help

regards
 
Back
Top