Hey all,
I am writing a desktop app and an ASP page that will work together. The ASP page will run on my customer's server and the app will run their vendors' computers. The app will allow the vendor to see what work is coming in the near future.
When the app is run, I go through a series of login and authentication steps before the vendor gets to a list of part numbers and dates. When they click one of the part numbers, the app will send a post request to the ASP page which will then return the PDF drawing to the vendor. This all works fine except the PDF page is all black when I open in the default pdf viewer on the desktop machine.
When I run the ASP page in the debugger, the browser displays the PDF correctly, so I'm pretty sure the problem lies on the desktop side; probably in the decoding.
Here is the code I use to send the pdf from the ASP page (c#.. moved away from vb last year)....
ASP.Net Code:
Response.ContentType = "application/pdf"; Response.ContentEncoding = System.Text.Encoding.Default; Response.WriteFile(filePath);
and here is the code used in the desktop app to receive the response,
c# Code:
using (IO.Stream receiveStream = webResponse.GetResponseStream()) { IO.StreamReader readStream = new IO.StreamReader(receiveStream, System.Text.Encoding.Default); string returnString = readStream.ReadToEnd(); IO.File.WriteAllText(fileName, returnString); }
Any help would be greatly appreciated.
