XmlSecureResolver::Credentials Property
.NET Framework (current version)
Sets credentials used to authenticate web requests.
Assembly: System.Xml (in System.Xml.dll)
public: property ICredentials^ Credentials { virtual void set(ICredentials^ value) override; }
Property Value
Type: System.Net::ICredentials^The credentials to be used to authenticate web requests. The XmlSecureResolver sets the given credentials on the underlying XmlResolver. If this property is not set, the value defaults to null; that is, the XmlSecureResolver has no user credentials.
The following example uses an XmlSecureResolver with default credentials to resolve and open network resources needed by the XmlTextReader.
#using <System.dll> #using <System.Xml.dll> using namespace System; using namespace System::IO; using namespace System::Xml; using namespace System::Net; int main() { // Create the reader. XmlTextReader^ reader = gcnew XmlTextReader( "http://myServer/data/books.xml" ); // Create a secure resolver with default credentials. XmlUrlResolver^ resolver = gcnew XmlUrlResolver; XmlSecureResolver^ sResolver = gcnew XmlSecureResolver( resolver,"http://myServer/data/" ); sResolver->Credentials = CredentialCache::DefaultCredentials; // Use the secure resolver to resolve resources. reader->XmlResolver = sResolver; // Parse the file. while ( reader->Read() ) { // Do any additional processing here. } // Close the reader. reader->Close(); }
.NET Framework
Available since 1.1
Available since 1.1
Show: