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
- Helpers.cs
- ServiceRoute.cs
- Underline.cs
- TransactionInformation.cs
- DataBoundControl.cs
- DigestTraceRecordHelper.cs
- ObjectComplexPropertyMapping.cs
- EntitySet.cs
- CmsUtils.cs
- XmlQueryOutput.cs
- SystemIcons.cs
- cryptoapiTransform.cs
- Ray3DHitTestResult.cs
- EntityDataSourceContextDisposingEventArgs.cs
- ContextQuery.cs
- WebSysDefaultValueAttribute.cs
- WorkflowItemsPresenter.cs
- SecUtil.cs
- DataControlReference.cs
- FixedTextBuilder.cs
- ClientSession.cs
- EndPoint.cs
- DebugHandleTracker.cs
- MergePropertyDescriptor.cs
- RegionInfo.cs
- MouseActionValueSerializer.cs
- ObjectDesignerDataSourceView.cs
- MobileContainerDesigner.cs
- ObfuscateAssemblyAttribute.cs
- MoveSizeWinEventHandler.cs
- MediaContextNotificationWindow.cs
- UTF7Encoding.cs
- Evidence.cs
- StrongNameIdentityPermission.cs
- NameValueFileSectionHandler.cs
- LayoutDump.cs
- InheritablePropertyChangeInfo.cs
- MbpInfo.cs
- FrameDimension.cs
- PeerApplication.cs
- GeneralTransform.cs
- DesignerAutoFormat.cs
- MbpInfo.cs
- EmbeddedMailObject.cs
- X509Extension.cs
- DataSourceCache.cs
- EntityTemplateFactory.cs
- ITreeGenerator.cs
- SvcMapFileSerializer.cs
- PeerCollaborationPermission.cs
- XmlValidatingReader.cs
- SchemaAttDef.cs
- SqlDependency.cs
- PointHitTestResult.cs
- XpsFilter.cs
- CodeAccessPermission.cs
- TransactionInterop.cs
- ListenerElementsCollection.cs
- AppDomainFactory.cs
- RenderingBiasValidation.cs
- TypeNameConverter.cs
- SerializationStore.cs
- XmlHierarchicalDataSourceView.cs
- SmtpFailedRecipientsException.cs
- Int16Converter.cs
- DataGridViewCellConverter.cs
- SelectedCellsChangedEventArgs.cs
- SelectedPathEditor.cs
- Menu.cs
- ConfigurationSectionGroup.cs
- JoinCqlBlock.cs
- Enlistment.cs
- EmptyWorkItem.cs
- LoginView.cs
- WebBrowsableAttribute.cs
- MessageBox.cs
- TreeBuilder.cs
- ReadOnlyAttribute.cs
- ListView.cs
- PersistenceTypeAttribute.cs
- ChangeTracker.cs
- PropagatorResult.cs
- HtmlElementCollection.cs
- SRDisplayNameAttribute.cs
- DataGridDesigner.cs
- Input.cs
- figurelength.cs
- EventProxy.cs
- Profiler.cs
- MessageSecurityException.cs
- FirstMatchCodeGroup.cs
- ToolStripOverflow.cs
- HealthMonitoringSection.cs
- StrongNameIdentityPermission.cs
- Int32Storage.cs
- HMACSHA512.cs
- WebPartTransformerAttribute.cs
- ListViewItem.cs
- NullableIntSumAggregationOperator.cs
- Clipboard.cs