Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / MS / Internal / Utility / ProtectedUri.cs / 2 / ProtectedUri.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2001 // // File: protecteduri.cs // // Description: Secure wrapper for URIs containing path information // // History: 12-02-04 - [....] - created //----------------------------------------------------------------------------- using System; using System.IO; using System.ComponentModel; using System.Windows; using System.Windows.Navigation; using System.Windows.Media; using System.Diagnostics; using System.Globalization; using System.Security.Permissions; using System.IO.Packaging; using MS.Internal.AppModel; using System.Windows.Controls; using MS.Internal ; using MS.Internal.PresentationFramework; // SecurityHelper using System.Security; namespace MS.Internal.Utility { ////// Wrapper class for URIs containing path information. /// internal class ProtectedUri { ////// Original URI which should *not* contain path information ever /// Uri _originalUri; ////// URI that may contain path information /// ////// Critical - may contain path information /// [SecurityCritical] Uri _value; ////// Determines if _value contains path information /// ////// Critical - determines if _value contains path information, which /// in turn determines if we demand a permission to get access /// to _value. /// [SecurityCritical] bool _containsPathInformation; ////// Creates a ProtectedUri that contains no path information /// /// Safe URI (generally provided from user code) ///Protected wrapper ////// Critical - because the caller of this API needs to ensure that [SecurityCritical] internal static ProtectedUri FromSafeUri(Uri value) { if (value == null) throw new ArgumentNullException("value"); ProtectedUri wrapper = new ProtectedUri(); wrapper._value = wrapper._originalUri = value; wrapper._containsPathInformation = false; return wrapper; } ////// contains no critical information, this API is critical. /// /// Returns the "full" URI (may contain path information> /// ////// There is currently no "safeUri" property on this class, /// however you could write one if there is a need. Look at SD history for an example. /// ////// Critical - deals with full URI /// TreatAsSafe - demands PathDiscovery if the URI is tagged as having path information /// internal Uri UnsafeUri { [SecurityCritical, SecurityTreatAsSafe] get { if (_containsPathInformation) { SecurityHelper.DemandPathDiscovery(_value.LocalPath); } return _value; } } ////// Returns the hashcode associated with the URI /// ///hashcode associated with the URI ////// Critical - access the full URI /// [SecurityCritical] public override int GetHashCode() { return _value.GetHashCode(); } ////// Determines if this wraps the same uri as another protected URI /// /// ProtectedURI to compare to. ////// true if the objects are equal/// Critical - access the full URI /// [SecurityCritical] public override bool Equals(object other) { ProtectedUri otherUri = other as ProtectedUri; return (otherUri != null) && (this._value.Equals(otherUri._value)) && (this._containsPathInformation.Equals(otherUri._containsPathInformation)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InkCanvasFeedbackAdorner.cs
- BuildProviderAppliesToAttribute.cs
- XmlSchemaParticle.cs
- figurelength.cs
- RowBinding.cs
- ServiceProviders.cs
- DateTimeOffset.cs
- HostingPreferredMapPath.cs
- XmlSchemaSimpleType.cs
- IImplicitResourceProvider.cs
- IpcChannel.cs
- ProfileService.cs
- SqlBooleanizer.cs
- BehaviorEditorPart.cs
- StackSpiller.cs
- connectionpool.cs
- SurrogateEncoder.cs
- ProfileInfo.cs
- Keyboard.cs
- PlaceHolder.cs
- SchemaCompiler.cs
- KeyConstraint.cs
- ToolStripPanelCell.cs
- CssStyleCollection.cs
- Point3DKeyFrameCollection.cs
- EventLogPermissionEntry.cs
- ToolStripManager.cs
- OdbcUtils.cs
- ZipIOExtraField.cs
- NGCPageContentCollectionSerializerAsync.cs
- MissingSatelliteAssemblyException.cs
- FixedLineResult.cs
- RotateTransform.cs
- PixelFormats.cs
- WhitespaceRuleReader.cs
- SqlCacheDependencySection.cs
- TrackingProvider.cs
- DataKeyArray.cs
- HandlerBase.cs
- GrammarBuilderBase.cs
- WindowCollection.cs
- KerberosSecurityTokenProvider.cs
- LambdaSerializationException.cs
- ReadContentAsBinaryHelper.cs
- NetworkInformationPermission.cs
- TextRunTypographyProperties.cs
- TypeHelpers.cs
- SettingsProviderCollection.cs
- CollectionViewGroupInternal.cs
- ChtmlImageAdapter.cs
- Comparer.cs
- ProcessModule.cs
- AddingNewEventArgs.cs
- StackOverflowException.cs
- TrustLevelCollection.cs
- Utils.cs
- EventLog.cs
- CustomSignedXml.cs
- BitmapScalingModeValidation.cs
- BrowserCapabilitiesCompiler.cs
- FixedSOMGroup.cs
- XmlHierarchicalEnumerable.cs
- ActiveXHelper.cs
- DesignerLabelAdapter.cs
- _RegBlobWebProxyDataBuilder.cs
- WmfPlaceableFileHeader.cs
- FtpCachePolicyElement.cs
- NavigationService.cs
- SecurityBindingElementImporter.cs
- CachedTypeface.cs
- InputScope.cs
- SqlStream.cs
- HandlerMappingMemo.cs
- AddingNewEventArgs.cs
- CharacterShapingProperties.cs
- CompiledRegexRunner.cs
- CustomLineCap.cs
- ObjectStorage.cs
- UrlUtility.cs
- AdapterDictionary.cs
- FormsAuthenticationEventArgs.cs
- IndependentAnimationStorage.cs
- UrlAuthFailedErrorFormatter.cs
- DbModificationClause.cs
- LongMinMaxAggregationOperator.cs
- WindowsGraphicsWrapper.cs
- Timer.cs
- TransformPattern.cs
- WsatRegistrationHeader.cs
- SplashScreenNativeMethods.cs
- GridSplitterAutomationPeer.cs
- AssemblyBuilder.cs
- EntityClassGenerator.cs
- BuildManager.cs
- LocalizableAttribute.cs
- BrowsableAttribute.cs
- FormParameter.cs
- DataServiceExpressionVisitor.cs
- LayoutEngine.cs
- ComboBox.cs