Dean,

Hopefully this will point you in the right direction (you write the xml
file to the WebRequest's RequestStream):

  string xml = myXmlTextReader.GetRemainder().ReadToEnd();

  //TODO: Consider UTF8 here instead of ASCII
  byte[] buffer = Encoding.ASCII.GetBytes(xml);

  myHttpWebRequest.GetRequestStream().Write(buffer, 0, buffer.Length);


Cheers,
Duncan Smart
==============


On Sat, 4 May 2002 11:18:29 +1200, Dean Cleaver <[EMAIL PROTECTED]> wrote:

>I have a project where I need to post XML files to a secured server.
>They provided a perl sample, which isn't much use to me, and also this
>HTML:
>
><FORM enctype="multipart/form-data" action="<sniped>" method="POST">
>  <p><INPUT type="file" name="p_xml_file"><BR>
>  <p><INPUT type="submit">
></FORM>
>
>That has been tested, and it works. Now, I have managed to communicate
>with the server correctly and get responses, I just don't know how to
>"insert" the file into the data stream. This is what I have now...
>
>// Create a new string object to POST data to the Url.
>string postData = "p_xml_file="+ myXmlTextReader.GetRemainder();
>ASCIIEncoding encoding=new ASCIIEncoding();
>byte[]  byte1=encoding.GetBytes(postData);
>// Set the content type of the data being posted.
>myHttpWebRequest.ContentType="form-data";
>// Set the content length of the string being posted.
>myHttpWebRequest.ContentLength=postData.Length;
>
>However that doesn't seem to be right... myXmlTextReader is a TextReader
>to the XML file.
>
>Can anyone point me in the right direction?
>
>TIA
>Dino
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.351 / Virus Database: 197 - Release Date: 19/04/2002
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to