Try this (don't know if the username/password work - just guessing):
using System;
using System.Net;
using System.Text;
using System.IO;
using System.Xml;
class ClientGet
{
public static void Main(string[] args)
{
string UriString = "http://www.w3.org/";
Console.WriteLine("Reading XML from " + UriString);
Uri site = new Uri(UriString);
WebRequest wReq = WebRequest.Create(site);
wReq.Headers.Add("UserName","user");
wReq.Headers.Add("Password","test");
WebResponse wResp = wReq.GetResponse();
Stream respStream = wResp.GetResponseStream();
XmlDocument resultDoc = new XmlDocument();
resultDoc.Load(respStream);
Console.WriteLine(resultDoc.OuterXml);
Console.WriteLine("Press Enter to finish");
Console.ReadLine();
}
}
> -----Original Message-----
> From: Stuart Hunter [mailto:s.hunter@t...]
> Sent: Monday, August 20, 2001 9:22 PM
> To: ASPX_Professional
> Subject: [aspx_professional] Where is ServerXMLHTTP object in .NET?
>
>
> I have been using the MSXML2.ServerXMLHTTP object in ASP to
> allow me to
> read the XML response from a HTTP POST request.
>
> ASP Code...
> Set objProxy = Server.CreateObject("MSXML2.ServerXMLHTTP")
> objProxy.open "POST", "http://server/templates/login.xml"
> objProxy.send "UserName=user&Password=test"
> Set objXMLDoc = Server.CreateObject("MSXML2.DOMDocument")
> objXMLDoc.LoadXml objProxy.responseText
>
> Please could someone enlighten me as to where this object (or its
> replacement) exists in the .NET framework. I am currently
> using the MSXML2
> COM object from .NET via a callable wrapper but I'm sure that
> there must be
> a better solution.
>
> .NET Code...
> Dim objProxy As New MSXML2.ServerXMLHTTP()
> Dim objXMLDoc As New XmlDocument()
> objProxy .open("POST", "http://server/templates/login.xml")
> objProxy .send("UserName=user&Password=test")
> objXMLDoc.LoadXml(objProxy.responseText)
>
> Any ideas gratefully received!
>
> Thanks,
>
> Stu
>
> stuart.hunter@k...
>