Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / TransportContext.cs / 1305376 / TransportContext.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Net.Security; using System.Security.Authentication.ExtendedProtection; namespace System.Net { public abstract class TransportContext { public abstract ChannelBinding GetChannelBinding(ChannelBindingKind kind); } internal class ConnectStreamContext : TransportContext { internal ConnectStreamContext(ConnectStream connectStream) { GlobalLog.Assert(connectStream != null, "ConnectStreamContext..ctor(): Not expecting a null connectStream!"); this.connectStream = connectStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return connectStream.GetChannelBinding(kind); } private ConnectStream connectStream; } internal class SslStreamContext : TransportContext { internal SslStreamContext(SslStream sslStream) { GlobalLog.Assert(sslStream != null, "SslStreamContext..ctor(): Not expecting a null sslStream!"); this.sslStream = sslStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return sslStream.GetChannelBinding(kind); } private SslStream sslStream; } internal class HttpListenerRequestContext : TransportContext { internal HttpListenerRequestContext(HttpListenerRequest request) { GlobalLog.Assert(request != null, "HttpListenerRequestContext..ctor(): Not expecting a null request!"); this.request = request; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) { throw new NotSupportedException(SR.GetString( SR.net_listener_invalid_cbt_type, kind.ToString())); } return request.GetChannelBinding(); } private HttpListenerRequest request; } // Holds a cached Endpoint binding to be reused by HttpWebRequest preauthentication internal class CachedTransportContext : TransportContext { internal CachedTransportContext(ChannelBinding binding) { this.binding = binding; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) return null; return binding; } private ChannelBinding binding; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Net.Security; using System.Security.Authentication.ExtendedProtection; namespace System.Net { public abstract class TransportContext { public abstract ChannelBinding GetChannelBinding(ChannelBindingKind kind); } internal class ConnectStreamContext : TransportContext { internal ConnectStreamContext(ConnectStream connectStream) { GlobalLog.Assert(connectStream != null, "ConnectStreamContext..ctor(): Not expecting a null connectStream!"); this.connectStream = connectStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return connectStream.GetChannelBinding(kind); } private ConnectStream connectStream; } internal class SslStreamContext : TransportContext { internal SslStreamContext(SslStream sslStream) { GlobalLog.Assert(sslStream != null, "SslStreamContext..ctor(): Not expecting a null sslStream!"); this.sslStream = sslStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return sslStream.GetChannelBinding(kind); } private SslStream sslStream; } internal class HttpListenerRequestContext : TransportContext { internal HttpListenerRequestContext(HttpListenerRequest request) { GlobalLog.Assert(request != null, "HttpListenerRequestContext..ctor(): Not expecting a null request!"); this.request = request; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) { throw new NotSupportedException(SR.GetString( SR.net_listener_invalid_cbt_type, kind.ToString())); } return request.GetChannelBinding(); } private HttpListenerRequest request; } // Holds a cached Endpoint binding to be reused by HttpWebRequest preauthentication internal class CachedTransportContext : TransportContext { internal CachedTransportContext(ChannelBinding binding) { this.binding = binding; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) return null; return binding; } private ChannelBinding binding; } } // 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
- UInt32.cs
- OutputScopeManager.cs
- PropertyChangingEventArgs.cs
- IncrementalReadDecoders.cs
- ImmutablePropertyDescriptorGridEntry.cs
- FormViewUpdateEventArgs.cs
- HtmlInputReset.cs
- RSAOAEPKeyExchangeDeformatter.cs
- WebPageTraceListener.cs
- LOSFormatter.cs
- Decimal.cs
- QuaternionAnimationUsingKeyFrames.cs
- DesignerActionGlyph.cs
- DataGridViewLinkCell.cs
- CursorConverter.cs
- VisualStyleInformation.cs
- CryptoStream.cs
- OrderByBuilder.cs
- newinstructionaction.cs
- OdbcEnvironmentHandle.cs
- PersistenceProviderElement.cs
- TextContainerHelper.cs
- RequiredAttributeAttribute.cs
- Win32SafeHandles.cs
- AuthorizationRuleCollection.cs
- DbConnectionPoolOptions.cs
- BuildProvider.cs
- CodeAccessPermission.cs
- Section.cs
- DataPagerFieldItem.cs
- PasswordPropertyTextAttribute.cs
- CompiledQueryCacheEntry.cs
- DefaultEventAttribute.cs
- IImplicitResourceProvider.cs
- BlobPersonalizationState.cs
- ZipPackage.cs
- PathFigure.cs
- panel.cs
- DriveInfo.cs
- ImageUrlEditor.cs
- BaseResourcesBuildProvider.cs
- ZipIOExtraField.cs
- altserialization.cs
- BufferedConnection.cs
- URLIdentityPermission.cs
- FixedSOMFixedBlock.cs
- MimeTypeAttribute.cs
- TextAutomationPeer.cs
- ConfigurationValidatorAttribute.cs
- CustomAssemblyResolver.cs
- Parameter.cs
- AxisAngleRotation3D.cs
- ConfigXmlAttribute.cs
- XmlSchemaNotation.cs
- UriScheme.cs
- RowVisual.cs
- GroupDescription.cs
- ActivityMarkupSerializationProvider.cs
- Pts.cs
- ManipulationLogic.cs
- SmiGettersStream.cs
- RecipientInfo.cs
- CodeFieldReferenceExpression.cs
- IDispatchConstantAttribute.cs
- DataListItemCollection.cs
- ListGeneralPage.cs
- AttributeProviderAttribute.cs
- PeerCollaborationPermission.cs
- OpenFileDialog.cs
- RestHandler.cs
- ExpressionBindings.cs
- XamlTypeMapperSchemaContext.cs
- ErrorsHelper.cs
- ReferencedAssembly.cs
- ExpressionBuilderCollection.cs
- Misc.cs
- XpsFilter.cs
- ShaderRenderModeValidation.cs
- ItemCheckEvent.cs
- HtmlTitle.cs
- AsyncCompletedEventArgs.cs
- CircleHotSpot.cs
- FlowDocumentPaginator.cs
- UserControlAutomationPeer.cs
- WindowsTab.cs
- RangeValueProviderWrapper.cs
- PrivacyNoticeBindingElement.cs
- TypeToken.cs
- InputReport.cs
- CustomErrorCollection.cs
- AccessDataSourceView.cs
- DiagnosticTrace.cs
- ConfigurationLockCollection.cs
- TypeUnloadedException.cs
- PassportAuthenticationEventArgs.cs
- ResourceManager.cs
- UnsafeNativeMethods.cs
- TypeToken.cs
- DoubleStorage.cs
- FieldNameLookup.cs