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
- HtmlImageAdapter.cs
- SchemaMerger.cs
- ToolboxBitmapAttribute.cs
- AsyncWaitHandle.cs
- StylusButtonEventArgs.cs
- ParameterBuilder.cs
- ProcessHostFactoryHelper.cs
- MobilePage.cs
- LineServices.cs
- ValidatedControlConverter.cs
- ViewStateModeByIdAttribute.cs
- TcpStreams.cs
- BitmapEffectDrawing.cs
- ComponentResourceKeyConverter.cs
- ServiceContractListItem.cs
- Rect3D.cs
- Journaling.cs
- ExternalException.cs
- __TransparentProxy.cs
- ToolStripPanelRenderEventArgs.cs
- BuiltInPermissionSets.cs
- log.cs
- PackagePart.cs
- ClientRoleProvider.cs
- IndentTextWriter.cs
- TagPrefixAttribute.cs
- DbProviderServices.cs
- CompositeActivityCodeGenerator.cs
- ArraySubsetEnumerator.cs
- SoapRpcMethodAttribute.cs
- UIElementIsland.cs
- DbExpressionBuilder.cs
- CodeSubDirectoriesCollection.cs
- JavaScriptObjectDeserializer.cs
- ToolBarTray.cs
- TreeSet.cs
- ComplexPropertyEntry.cs
- EncryptedXml.cs
- isolationinterop.cs
- HttpHandlerAction.cs
- FigureHelper.cs
- InvalidEnumArgumentException.cs
- GrammarBuilderPhrase.cs
- ObjectParameter.cs
- ProxyAttribute.cs
- TextParagraphCache.cs
- COM2ExtendedTypeConverter.cs
- ResolvePPIDRequest.cs
- XmlNotation.cs
- XmlSchemaObjectCollection.cs
- EntityDataSourceContextCreatingEventArgs.cs
- RouteCollection.cs
- ThreadPool.cs
- CompiledRegexRunner.cs
- XmlDigitalSignatureProcessor.cs
- Point3DIndependentAnimationStorage.cs
- TabItemWrapperAutomationPeer.cs
- HierarchicalDataBoundControlAdapter.cs
- PageRequestManager.cs
- DataGridPageChangedEventArgs.cs
- QuotedStringWriteStateInfo.cs
- PlanCompilerUtil.cs
- PeerInvitationResponse.cs
- While.cs
- TextRangeEditTables.cs
- Preprocessor.cs
- ToolStripPanelCell.cs
- RefExpr.cs
- SoapHeaderAttribute.cs
- UntypedNullExpression.cs
- ControlBuilderAttribute.cs
- RowVisual.cs
- AutomationPropertyInfo.cs
- ArithmeticException.cs
- ConcurrentDictionary.cs
- InertiaTranslationBehavior.cs
- AdornerPresentationContext.cs
- CurrentChangedEventManager.cs
- ProfilePropertySettingsCollection.cs
- QuaternionRotation3D.cs
- PathGeometry.cs
- ECDiffieHellmanCng.cs
- GeneratedCodeAttribute.cs
- MailAddress.cs
- TcpConnectionPool.cs
- ISO2022Encoding.cs
- RemotingAttributes.cs
- CustomBindingCollectionElement.cs
- SpellerStatusTable.cs
- ListBoxChrome.cs
- ServiceModelDictionary.cs
- RegexBoyerMoore.cs
- SafeLibraryHandle.cs
- CodeAttributeDeclarationCollection.cs
- BitmapPalettes.cs
- SchemaNames.cs
- RunClient.cs
- TextWriterTraceListener.cs
- DbMetaDataFactory.cs
- HandleScope.cs