зеркало из https://github.com/mono/mail-archives.git
104 строки
3.1 KiB
HTML
104 строки
3.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-list] Basic Authentication
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:helge.hess%40opengroupware.org">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="016672.html">
|
|
<LINK REL="Next" HREF="016682.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-list] Basic Authentication
|
|
</H1>
|
|
<B>Helge Hess
|
|
</B>
|
|
<A HREF="mailto:helge.hess%40opengroupware.org"
|
|
TITLE="[Mono-list] Basic Authentication">helge.hess@opengroupware.org
|
|
</A><BR>
|
|
<I>Fri, 31 Oct 2003 17:54:58 +0100</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="016672.html">[Mono-list] Determining the platform at compile and run time
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016682.html">[Mono-list] Gtk#+Combo+Entry+win32
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16680">[ date ]</a>
|
|
<a href="thread.html#16680">[ thread ]</a>
|
|
<a href="subject.html#16680">[ subject ]</a>
|
|
<a href="author.html#16680">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>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
|
|
<A HREF="http://www.opengroupware.org/">http://www.opengroupware.org/</A>
|
|
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="016672.html">[Mono-list] Determining the platform at compile and run time
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016682.html">[Mono-list] Gtk#+Combo+Entry+win32
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16680">[ date ]</a>
|
|
<a href="thread.html#16680">[ thread ]</a>
|
|
<a href="subject.html#16680">[ subject ]</a>
|
|
<a href="author.html#16680">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|