Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Xml / System / Xml / XmlUrlResolver.cs / 1 / XmlUrlResolver.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml
{
using System;
using System.IO;
using System.Net;
using System.Threading;
using System.Security.Permissions;
using System.Security.Policy;
using System.Security;
///
///
/// Resolves external XML resources named by a
/// Uniform Resource Identifier (URI).
///
public class XmlUrlResolver : XmlResolver {
static object s_DownloadManager;
ICredentials _credentials;
static XmlDownloadManager DownloadManager {
get {
if ( s_DownloadManager == null ) {
object dm = new XmlDownloadManager();
Interlocked.CompareExchange( ref s_DownloadManager, dm, null );
}
return (XmlDownloadManager)s_DownloadManager;
}
}
// Construction
///
///
///
/// Creates a new instance of the XmlUrlResolver class.
///
///
public XmlUrlResolver() {
}
//UE attension
///
///
/// [To be supplied.]
///
public override ICredentials Credentials {
set { _credentials = value; }
}
// Resource resolution
///
///
/// Maps a
/// URI to an Object containing the actual resource.
///
public override Object GetEntity(Uri absoluteUri,
string role,
Type ofObjectToReturn) {
if (ofObjectToReturn == null || ofObjectToReturn == typeof(System.IO.Stream)) {
return DownloadManager.GetStream(absoluteUri, _credentials);
}
else {
throw new XmlException(Res.Xml_UnsupportedClass, string.Empty);
}
}
///
///
/// [To be supplied.]
///
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public override Uri ResolveUri(Uri baseUri, string relativeUri){
return base.ResolveUri(baseUri, relativeUri);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml
{
using System;
using System.IO;
using System.Net;
using System.Threading;
using System.Security.Permissions;
using System.Security.Policy;
using System.Security;
///
///
/// Resolves external XML resources named by a
/// Uniform Resource Identifier (URI).
///
public class XmlUrlResolver : XmlResolver {
static object s_DownloadManager;
ICredentials _credentials;
static XmlDownloadManager DownloadManager {
get {
if ( s_DownloadManager == null ) {
object dm = new XmlDownloadManager();
Interlocked.CompareExchange( ref s_DownloadManager, dm, null );
}
return (XmlDownloadManager)s_DownloadManager;
}
}
// Construction
///
///
///
/// Creates a new instance of the XmlUrlResolver class.
///
///
public XmlUrlResolver() {
}
//UE attension
///
///
/// [To be supplied.]
///
public override ICredentials Credentials {
set { _credentials = value; }
}
// Resource resolution
///
///
/// Maps a
/// URI to an Object containing the actual resource.
///
public override Object GetEntity(Uri absoluteUri,
string role,
Type ofObjectToReturn) {
if (ofObjectToReturn == null || ofObjectToReturn == typeof(System.IO.Stream)) {
return DownloadManager.GetStream(absoluteUri, _credentials);
}
else {
throw new XmlException(Res.Xml_UnsupportedClass, string.Empty);
}
}
///
///
/// [To be supplied.]
///
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public override Uri ResolveUri(Uri baseUri, string relativeUri){
return base.ResolveUri(baseUri, relativeUri);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RequiredAttributeAttribute.cs
- DbConnectionPoolGroup.cs
- LastQueryOperator.cs
- _FtpControlStream.cs
- TableItemStyle.cs
- SQLBinary.cs
- UIElementHelper.cs
- RenderOptions.cs
- SafeEventLogWriteHandle.cs
- ToolboxItemCollection.cs
- DataTableTypeConverter.cs
- OperationAbortedException.cs
- WmlCommandAdapter.cs
- EventDescriptorCollection.cs
- _NtlmClient.cs
- OdbcConnectionPoolProviderInfo.cs
- BasicViewGenerator.cs
- StorageScalarPropertyMapping.cs
- DeferredElementTreeState.cs
- XmlSchemaImport.cs
- Selector.cs
- X509Certificate.cs
- MissingManifestResourceException.cs
- WriteStateInfoBase.cs
- WorkflowValidationFailedException.cs
- XslCompiledTransform.cs
- DLinqDataModelProvider.cs
- SafeProcessHandle.cs
- EditorOptionAttribute.cs
- ADConnectionHelper.cs
- TextEditorDragDrop.cs
- QueueProcessor.cs
- RegexGroupCollection.cs
- Cursor.cs
- FormParameter.cs
- XmlSchemaValidator.cs
- SymbolPair.cs
- Expander.cs
- ResourcesGenerator.cs
- HttpsTransportElement.cs
- TransformationRules.cs
- XamlPoint3DCollectionSerializer.cs
- TextTreeInsertUndoUnit.cs
- WeakRefEnumerator.cs
- MemberInfoSerializationHolder.cs
- StoreContentChangedEventArgs.cs
- FieldTemplateFactory.cs
- DataControlField.cs
- CorePropertiesFilter.cs
- Version.cs
- StylusButtonEventArgs.cs
- ISFTagAndGuidCache.cs
- ClosableStream.cs
- WeakReadOnlyCollection.cs
- Wizard.cs
- TableNameAttribute.cs
- TextPattern.cs
- DataGridViewCellPaintingEventArgs.cs
- FontSizeConverter.cs
- ECDsaCng.cs
- HttpContext.cs
- OledbConnectionStringbuilder.cs
- VirtualPathUtility.cs
- HitTestParameters.cs
- Converter.cs
- StrokeCollection2.cs
- WsdlBuildProvider.cs
- XmlNamespaceMappingCollection.cs
- DesignerActionGlyph.cs
- FormViewInsertEventArgs.cs
- codemethodreferenceexpression.cs
- ContextMenuService.cs
- ObjectListSelectEventArgs.cs
- ConstantSlot.cs
- Vector.cs
- CriticalFinalizerObject.cs
- XhtmlTextWriter.cs
- XmlSchemaType.cs
- HwndAppCommandInputProvider.cs
- Byte.cs
- DocumentPaginator.cs
- TemplateControlCodeDomTreeGenerator.cs
- ComIntegrationManifestGenerator.cs
- SqlUtil.cs
- IdSpace.cs
- DataSourceControl.cs
- VirtualDirectoryMappingCollection.cs
- CodeCompiler.cs
- ExceptionHandlerDesigner.cs
- SqlBooleanMismatchVisitor.cs
- CollectionViewGroup.cs
- ValueChangedEventManager.cs
- TextServicesCompartmentContext.cs
- LambdaCompiler.Generated.cs
- ColorBlend.cs
- UnsafeNativeMethods.cs
- WebBrowserUriTypeConverter.cs
- CacheOutputQuery.cs
- SortQuery.cs
- VirtualPathProvider.cs