Typical problem, but I've done everything I can possibly think of to get this to work. I set the NETWORK SERVICE and ASPNET accounts to FULL CONTROL on my PC. I'm using the built-in Cassini web server to test my application, with no luck. I even tried to make a folder outside of the APP_DATA folder, and is still says Access is Denied.
Anyone have any ideas?
CODE EXAMPLE:
Dim uploadedFile As HttpPostedFile = Request.Files(0)
Dim len As Integer = uploadedFile.ContentLength
Dim fn As String = Path.GetFileName(uploadedFile.FileName)
Dim SaveLocation As String = Server.MapPath("~/Help")
Dim MyStream As Stream = uploadedFile.InputStream
Dim input(len) As Byte
MyStream = uploadedFile.InputStream
MyStream.Read(input, 0, len)
Try
Dim newFile As FileStream = New FileStream(SaveLocation, FileMode.Create)
newFile.Write(input, 0, input.Length)
newFile.Close()
'Dim writer As Stream = New FileStream(SaveLocation, FileMode.Create)
'writer.Read()
'writer.Close()
'uploadedFile.SaveAs(SaveLocation)
Catch ex As Exception
End Try
Alright, I figured it out. I needed to have the filename in the SaveLocation. Completely missed that.