Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Web / IncomingWebResponseContext.cs / 1 / IncomingWebResponseContext.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
#pragma warning disable 1634, 1691
namespace System.ServiceModel.Web
{
using System;
using System.Globalization;
using System.Diagnostics.CodeAnalysis;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Net;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
public class IncomingWebResponseContext
{
OperationContext operationContext;
internal IncomingWebResponseContext(OperationContext operationContext)
{
Fx.Assert(operationContext != null, "operationContext is null");
this.operationContext = operationContext;
}
public long ContentLength
{ get { return long.Parse(EnsureMessageProperty().Headers[HttpResponseHeader.ContentLength], CultureInfo.InvariantCulture); } }
public string ContentType
{ get { return EnsureMessageProperty().Headers[HttpResponseHeader.ContentType]; } }
public string ETag
{ get { return EnsureMessageProperty().Headers[HttpResponseHeader.ETag]; } }
public WebHeaderCollection Headers
{ get { return EnsureMessageProperty().Headers; } }
public string Location
{ get { return EnsureMessageProperty().Headers[HttpResponseHeader.Location]; } }
public HttpStatusCode StatusCode
{ get { return this.EnsureMessageProperty().StatusCode; } }
public string StatusDescription
{ get { return this.EnsureMessageProperty().StatusDescription; } }
HttpResponseMessageProperty MessageProperty
{ get
{
if (operationContext.IncomingMessageProperties == null)
{
return null;
}
if (!operationContext.IncomingMessageProperties.ContainsKey(HttpResponseMessageProperty.Name))
{
return null;
}
return operationContext.IncomingMessageProperties[HttpResponseMessageProperty.Name] as HttpResponseMessageProperty;
}
}
HttpResponseMessageProperty EnsureMessageProperty()
{
if (this.MessageProperty == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
SR2.GetString(SR2.HttpContextNoIncomingMessageProperty, typeof(HttpResponseMessageProperty).Name)));
}
return this.MessageProperty;
}
}
}
// 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
- xmlsaver.cs
- TypeSystemProvider.cs
- NavigationWindow.cs
- LinqDataSourceContextEventArgs.cs
- DocumentGridPage.cs
- DefaultEventAttribute.cs
- LinqDataSourceValidationException.cs
- DoWorkEventArgs.cs
- RowUpdatingEventArgs.cs
- CurrentChangingEventManager.cs
- KeyedHashAlgorithm.cs
- OdbcCommandBuilder.cs
- RequiredFieldValidator.cs
- AgileSafeNativeMemoryHandle.cs
- ReadOnlyCollection.cs
- JsonUriDataContract.cs
- ListView.cs
- AssociationEndMember.cs
- PenContexts.cs
- RawTextInputReport.cs
- CommandConverter.cs
- PageAdapter.cs
- ExpressionBuilderCollection.cs
- Model3DCollection.cs
- QueryExpression.cs
- JavaScriptString.cs
- WebPermission.cs
- _UncName.cs
- KoreanLunisolarCalendar.cs
- DateTimeConstantAttribute.cs
- Util.cs
- SizeAnimationUsingKeyFrames.cs
- InfoCardXmlSerializer.cs
- ConfigurationPropertyAttribute.cs
- SqlXmlStorage.cs
- ProfilePropertySettings.cs
- HttpContextServiceHost.cs
- PolyLineSegment.cs
- mediapermission.cs
- DllNotFoundException.cs
- TreeNode.cs
- DataControlPagerLinkButton.cs
- AttachedProperty.cs
- SqlConnectionHelper.cs
- OdbcConnectionStringbuilder.cs
- SQLConvert.cs
- RestHandlerFactory.cs
- WindowsFormsEditorServiceHelper.cs
- FontCacheUtil.cs
- Clipboard.cs
- PageHandlerFactory.cs
- BitmapVisualManager.cs
- Italic.cs
- SecurityRuntime.cs
- CodeDomExtensionMethods.cs
- X509Chain.cs
- DocumentPageView.cs
- OdbcEnvironment.cs
- RijndaelManaged.cs
- Point.cs
- VarRefManager.cs
- _DomainName.cs
- CustomDictionarySources.cs
- ReliableOutputConnection.cs
- StylusPointPropertyInfo.cs
- ReadOnlyState.cs
- IntSecurity.cs
- RightsDocument.cs
- HttpHandler.cs
- EditorAttribute.cs
- PermissionSetTriple.cs
- Crc32.cs
- DataGridHeaderBorder.cs
- BrowserCapabilitiesFactory.cs
- ConstantProjectedSlot.cs
- _SslState.cs
- TreeViewCancelEvent.cs
- WebBrowsableAttribute.cs
- RowUpdatedEventArgs.cs
- HttpProfileGroupBase.cs
- SuppressIldasmAttribute.cs
- EventSetterHandlerConverter.cs
- MDIControlStrip.cs
- StatusCommandUI.cs
- Rectangle.cs
- ValidationContext.cs
- GetWinFXPath.cs
- ReadOnlyTernaryTree.cs
- precedingquery.cs
- CounterCreationData.cs
- ChunkedMemoryStream.cs
- CapabilitiesAssignment.cs
- ContentPlaceHolderDesigner.cs
- DocumentReference.cs
- LineGeometry.cs
- CollaborationHelperFunctions.cs
- SecureEnvironment.cs
- HttpStreamXmlDictionaryReader.cs
- OleDbDataReader.cs
- TabPanel.cs