L
Luismi
Hi everybody,
I've got a problem with a Web Service. I Call a method that must binary
send a file to the Internet Explorer but the code generates an exception
when I send the file. Here is the code:
Dim Content(-1) As Byte
Dim File As IO.FileStream =
IO.File.Open(Context.Request.ServerVariables("APPL_PHYSICAL_PATH") &
"test2.txt", IO.FileMode.Open)
ReDim Contenido(File.Length)
File.Read(Content, 0, File.Length)
File.Close()
Context.Response.Buffer = True
Context.Response.AddHeader("Content-Disposition",
"attachment;filename=test2.txt")
Context.Response.ContentType = ""
Context.Response.BinaryWrite(Content)
The code breaks in the line "Context.Response.BinaryWrite(Content)"
throwing the next exception:
The data at the root level is invalid. Line 1, position 1.
Can someone help me?
I've got a problem with a Web Service. I Call a method that must binary
send a file to the Internet Explorer but the code generates an exception
when I send the file. Here is the code:
Dim Content(-1) As Byte
Dim File As IO.FileStream =
IO.File.Open(Context.Request.ServerVariables("APPL_PHYSICAL_PATH") &
"test2.txt", IO.FileMode.Open)
ReDim Contenido(File.Length)
File.Read(Content, 0, File.Length)
File.Close()
Context.Response.Buffer = True
Context.Response.AddHeader("Content-Disposition",
"attachment;filename=test2.txt")
Context.Response.ContentType = ""
Context.Response.BinaryWrite(Content)
The code breaks in the line "Context.Response.BinaryWrite(Content)"
throwing the next exception:
The data at the root level is invalid. Line 1, position 1.
Can someone help me?