Hallo
Ich habe da ein kleines Problem mit meinem Webclient
Ich möchte also eine datei Hochladen aber er sagt mir ein anderer Process würde auf die Datei zugreifen (was nicht stimmt).
Hier ist mein code:
Imports:
Die Funktion mit dem Fehler:
Ich habe absolut keine Ahnung wo der Fehler liegt
Noch lieber wäre es mir wenn ich die Datei einfach auf dem FTP erstellen kann, weil
erstellt keine Datei bei mir.
Danke für Hilfe
Dustin~
Ich habe da ein kleines Problem mit meinem Webclient
Ich möchte also eine datei Hochladen aber er sagt mir ein anderer Process würde auf die Datei zugreifen (was nicht stimmt).
Hier ist mein code:
Imports:
Die Funktion mit dem Fehler:
VB.NET-Quellcode
- Public Shared Function UploadFile(ByVal username As String, ByVal stringtoupload As String, ByVal server As String, ByVal user As String, ByVal pass As String) As Boolean
- Using wc As New Net.WebClient
- wc.Credentials = New Net.NetworkCredential(username, pass)
- Dim uri As String = server & "/" & My.Settings.nickname & ".txt"
- MsgBox(uri)
- Try
- MsgBox("1")
- 'Dim fs As FileStream = File.Create(Application.StartupPath & "" & My.Settings.nickname & ".txt")
- 'fs.Close()
- 'fs.Dispose()
- MsgBox("2")
- wc.UploadFile(Application.StartupPath & "" & My.Settings.nickname & ".txt", My.Settings.nickname & ".txt")
- 'MsgBox(Application.StartupPath & "" & My.Settings.nickname & ".txt")
- wc.UploadStringAsync(New Uri(uri),stringtoupload)
- wc.Dispose()
- Return True
- Catch ex As Exception
- MsgBox("ERROR" & Environment.NewLine & ex.Message)
- Return False
- End Try
- End Using
- End Function
Ich habe absolut keine Ahnung wo der Fehler liegt
Noch lieber wäre es mir wenn ich die Datei einfach auf dem FTP erstellen kann, weil
erstellt keine Datei bei mir.
Danke für Hilfe
Dustin~
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Hansbald“ ()