Downloading Dynamic Excel

M

MRW

Hello!

I've been on this for hours with little progress, so any help would be
appreciated.

I'm trying to use ASP.NET (VB) to send two variables to a server (not
mine), which uses those variables to create an Excel file and sends it
back (in binary format).

Using WebClient, I've been able to send the information and receive a
reply. However, I can't seem to encode the "response" into proper
format to save it properly without corruption.

Here's the code I've used so far:

Dim myWebClient = New System.Net.WebClient
myWebClient.Headers.Add("Content-Type", "application/x-www-
form-urlencoded")
Dim toEF As String = "sort=1&clientID=845"
Dim bytes() As Byte = myWebClient.UploadData("https://
blah, blah, blah.php", "POST",
System.Text.Encoding.ASCII.GetBytes(toEF))
myWebClient = Nothing

x = System.Text.Encoding.ASCII.GetString(bytes)

Dim fp As StreamWriter

Try
fp = File.CreateText(Server.MapPath("\test\") &
"test.xls")
fp.WriteLine(x)
fp.Close()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top