pro_vb_dotnet thread: Validating An XML Document The Hard Way.
Hi Steve,
Is it possible that the server with the schemas only allows Integrated
Security? If the web server is running IIS, go to the IIS MMC, open the
properties for your website, click on the Directory Security Tab and click
Edit. Make sure that both Basic and Integrated Security are on.
Basic authentication is a security mechanism where user names and passwords
are sent as clear text (more or less) over the wire. It' s used by all
browsers and therefore very convenient for the Internet. In Integrated
Security, not the password itself is transferred, but only a hash. There is
no way you can transform the hash in the password back again so this is
considered a pretty secure alternative.
The fact that your browser can see the schemas backs up this point. You are
logged on to your machine, so the hash of your user name and password is
sent silently behind the scenes to the remote host.
I suggest you read a bit about "basic authentication" Vs "Integrated
Windows Authentication" before you open your webserver to the Internet.
The following document shows some basic info about both security
mechanisms, but there is a lot more info available on MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnw2kmag00/html/iis5auth.asp
HtH
Imar
At 06:46 PM 12/3/2002 +0000, you wrote:
>I have this problem. We have some schemas on a server that are protected
>by a username and password. I can see them from IE on problem. When I try
>to validate an XML Document using the Schemas with an xmlValidatingReader
>I receive error "The remote server returned an error: (401) Unauthorized."
>So I tried a different approach using the code below.
>
>Imports System.Net
>Imports System.IO
>
>Module Module1
>
>Sub Main()
>
>Dim c As New CredentialCache()
>Dim x As HttpWebRequest
>Dim u As New Uri("http://OurSchemas.gov.uk/transactions/transactions.xsd")
>Dim s As Stream
>
>c.Add(u, "Basic", New System.Net.NetworkCredential("User", "Password"))
>
>x = WebRequest.Create(u)
>x.Credentials = c
>x.PreAuthenticate = True
>
>Dim resp As WebResponse
>resp = x.GetResponse()
>
>Console.ReadLine()
>
>End Sub
>
>End Module
>
>Again I received the same Error when I try to get a response. So my
>question is, has anyone else had this problem? And if so, How did you
>solve it?
>Also Does anyone know what Basic is in the above code.
>
>Thanks In advance
>
>Steve.