In my code I want to upload a file to my project(named Musiker), under the folder music. Here is what I did so far, it's not working.
'to get the path where to upload it, I did the following
Dim strpath As String = Application.StartupPath
Dim num As Integer = strpath.IndexOf("Musiker")
strpath = strpath.Remove(num + 7) & "\music"
'now I want to upload a file
Dim clsRequest As System.Net.FileWebRequest = (System.Net.WebRequest.Create(strpath))
clsRequest.Method = System.Net.WebRequestMethods.File.UploadFile
' read in file...
Dim bFile() As Byte = System.IO.File.ReadAllBytes("pathofFile")
' upload file...
Dim clsStream As System.IO.Stream = clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
It gives me an error, access not allowed or something like that.