Hi there,

is HttpWebRequest basic authentication supposed to work with Mono 0.28? I somehow don't get this working:
---snip---
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);


/* setup authentication */

request.PreAuthenticate = true;

      NetworkCredential creds = new NetworkCredential(
        "helge", "ultrasecret", "SKYRiX");
      request.Credentials = creds;

/* setup request paras */

      request.Method = "POST";
      request.ContentType = "text/xml";
      request.AllowWriteStreamBuffering = true;

/* send response */

      Stream stream = request.GetRequestStream();
      XmlTextWriter xWriter = new XmlTextWriter(stream, _encoding);

      xWriter.WriteStartDocument(true);
      xWriter.Flush();
      xWriter.Close();

/* receive response and parse */

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader input = new StreamReader(response.GetResponseStream());


      input.Close();
      response.Close();
---snap---

Does anyone has a small example which works with Mono and does authenticate against a webserver? Doesn't necessarily need to be PreAuthenticate, a 401/200 loop would be fine as well.

Thanks,
  Helge
--
OpenGroupware.org
http://www.opengroupware.org/

_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to