By configuring the virtual directory http://localhost/schemas to require Windows Authentication, every request to any files within that virtual directory will require proper user credentials, else you will get the 401 Unauthorized.
Looking at MSDN, under XmlSchemaSet.Add() topic there's the following comment:
Fully trusted code: A default XmlUrlResolver with no user credentials is used to resolve any external resources. The schemas for these other namespaces are loaded for validation purposes only. Unlike the original schema, these other schemas are not explicitly added to the schema collection. As a result, they are not accessible using any of the collection methods or properties. If these external resources are located on a network resource that requires authentication, use an overload that takes an XmlResolver as one of its arguments and specify an XmlResolver with the necessary credentials.
If you want to configure the virtual directory to require credentials, then use the XmlResolver overload instead of just specifying the URL as a string.
Jimmy
|