Kaizzum
31-10-2014, 06:30 PM
Hola a todos, tengo un problema que parece sencillo pero no entiendo el por qué no funciona. Quiero escribir en un archivo de texto en la carpeta Public de mi dropbox con VB.NET, para eso intento usar el StreamWriter.
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim sw As StreamWriter
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://dl.dropboxusercontent.com/u/45221426/pruebas.txt")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim receiveStream As Stream = response.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
sw = New StreamWriter(receiveStream, encode)
sw.WriteLine("nueva linea")
sw.Close()
End Sub
Me da error en tiempo de ejecución:
"Excepción no controlada del tipo 'System.ArgumentException' en mscorlib.dllInformación adicional: Stream was not writable."
Es en la linea: "sw = New StreamWriter(receiveStream, encode)"
No entiendo qué le pasa ni cómo solucionarlo. :404:
Gracias. :)
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim sw As StreamWriter
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://dl.dropboxusercontent.com/u/45221426/pruebas.txt")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim receiveStream As Stream = response.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
sw = New StreamWriter(receiveStream, encode)
sw.WriteLine("nueva linea")
sw.Close()
End Sub
Me da error en tiempo de ejecución:
"Excepción no controlada del tipo 'System.ArgumentException' en mscorlib.dllInformación adicional: Stream was not writable."
Es en la linea: "sw = New StreamWriter(receiveStream, encode)"
No entiendo qué le pasa ni cómo solucionarlo. :404:
Gracias. :)