Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / StreamSecurityUpgradeAcceptorBase.cs / 1 / StreamSecurityUpgradeAcceptorBase.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Channels { using System.IO; using System.ServiceModel.Security; abstract class StreamSecurityUpgradeAcceptorBase : StreamSecurityUpgradeAcceptor { SecurityMessageProperty remoteSecurity; bool securityUpgraded; string upgradeString; protected StreamSecurityUpgradeAcceptorBase(string upgradeString) { this.upgradeString = upgradeString; } public override Stream AcceptUpgrade(Stream stream) { if (stream == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream"); } Stream result = this.OnAcceptUpgrade(stream, out this.remoteSecurity); this.securityUpgraded = true; return result; } public override IAsyncResult BeginAcceptUpgrade(Stream stream, AsyncCallback callback, object state) { if (stream == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream"); } return this.OnBeginAcceptUpgrade(stream, callback, state); } public override bool CanUpgrade(string contentType) { if (this.securityUpgraded) { return false; } return (contentType == this.upgradeString); } public override Stream EndAcceptUpgrade(IAsyncResult result) { if (result == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result"); } Stream retValue = this.OnEndAcceptUpgrade(result, out this.remoteSecurity); this.securityUpgraded = true; return retValue; } public override SecurityMessageProperty GetRemoteSecurity() { // this could be null if upgrade not completed. return this.remoteSecurity; } protected abstract Stream OnAcceptUpgrade(Stream stream, out SecurityMessageProperty remoteSecurity); protected abstract IAsyncResult OnBeginAcceptUpgrade(Stream stream, AsyncCallback callback, object state); protected abstract Stream OnEndAcceptUpgrade(IAsyncResult result, out SecurityMessageProperty remoteSecurity); } } // 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
- SafeTimerHandle.cs
- Margins.cs
- XpsSerializerFactory.cs
- SystemWebCachingSectionGroup.cs
- SQlBooleanStorage.cs
- ResourceDescriptionAttribute.cs
- SessionEndedEventArgs.cs
- XmlName.cs
- LineUtil.cs
- TableRowsCollectionEditor.cs
- SlotInfo.cs
- ControlHelper.cs
- PolicyException.cs
- ResourceDescriptionAttribute.cs
- FunctionMappingTranslator.cs
- PipeStream.cs
- DeclaredTypeElement.cs
- BuilderPropertyEntry.cs
- CustomCategoryAttribute.cs
- KeyGestureConverter.cs
- ObjectDataSourceEventArgs.cs
- DataBoundControlAdapter.cs
- SqlIdentifier.cs
- BitmapImage.cs
- MeasureItemEvent.cs
- DesignerCategoryAttribute.cs
- SQLSingle.cs
- securitycriticaldataformultiplegetandset.cs
- KnowledgeBase.cs
- GiveFeedbackEventArgs.cs
- CustomWebEventKey.cs
- BehaviorDragDropEventArgs.cs
- ExplicitDiscriminatorMap.cs
- StringSource.cs
- InterleavedZipPartStream.cs
- RawTextInputReport.cs
- Registry.cs
- Point4DConverter.cs
- TransactionProtocolConverter.cs
- MetadataUtilsSmi.cs
- LayoutTableCell.cs
- DataGridViewCellFormattingEventArgs.cs
- TreeViewImageKeyConverter.cs
- UrlUtility.cs
- ProcessInputEventArgs.cs
- FullTextState.cs
- httpapplicationstate.cs
- TargetControlTypeCache.cs
- HttpConfigurationContext.cs
- COAUTHIDENTITY.cs
- WinFormsSpinner.cs
- HttpModuleActionCollection.cs
- ReaderWriterLockWrapper.cs
- InvokePattern.cs
- DataRowView.cs
- NewItemsContextMenuStrip.cs
- CodeBinaryOperatorExpression.cs
- ServiceDescription.cs
- MessageDescriptionCollection.cs
- EncryptedKeyIdentifierClause.cs
- DataSourceControl.cs
- ComUdtElementCollection.cs
- DefinitionUpdate.cs
- ImageFormat.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- HeaderedItemsControl.cs
- SqlDependencyUtils.cs
- ArgumentException.cs
- StaticExtension.cs
- NumberSubstitution.cs
- UrlAuthorizationModule.cs
- diagnosticsswitches.cs
- DataGridViewSortCompareEventArgs.cs
- Stroke2.cs
- ProtocolElementCollection.cs
- MessageFilter.cs
- RenderDataDrawingContext.cs
- _WinHttpWebProxyDataBuilder.cs
- CodeNamespaceCollection.cs
- Screen.cs
- IriParsingElement.cs
- ScrollBar.cs
- BitmapMetadataEnumerator.cs
- SqlFlattener.cs
- ExpressionNode.cs
- PersonalizationStateQuery.cs
- SqlNamer.cs
- DebugInfoGenerator.cs
- OutputScope.cs
- TraceXPathNavigator.cs
- RelationshipNavigation.cs
- DiscoveryClientElement.cs
- RestHandler.cs
- MonikerBuilder.cs
- Listbox.cs
- BaseProcessor.cs
- NativeWindow.cs
- StructuralObject.cs
- ToolStripAdornerWindowService.cs
- UserCancellationException.cs