0

I have the following code to send a gz compressed file:

    byte[] gzFile = File.ReadAllBytes("gz file path here");

    WebRequest request = WebRequest.Create("webservice url here");
    request.Method = "POST";
    request.ContentLength = gzFile.Length;
    request.ContentType = "application/gzip";

    Stream stream = request.GetRequestStream();
    stream.Write(pdfFile, 0, gzfFile.Length);
    stream.Close();

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    StreamReader reader = new StreamReader(response.GetResponseStream());
    Console.WriteLine(reader.ReadToEnd());
    reader.Close();

But how do I specify the user and the pass requested by the REST webservice?

  • You need to also tell us which authentication method your rest webservice is using, but in general you probably want to check this https://stackoverflow.com/questions/4334521/httpwebrequest-using-basic-authentication – igor Mar 06 '20 at 18:53
  • Unfortunately I don't have much documentation about the web service rest that I have to use, but I'm going to prove your contribution, maybe I'm lucky. Thank you – Alejandro Sepúlveda Cuartas Mar 06 '20 at 19:16

0 Answers0