Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Web / OutgoingWebResponseContext.cs / 1 / OutgoingWebResponseContext.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 OutgoingWebResponseContext { OperationContext operationContext; internal OutgoingWebResponseContext(OperationContext operationContext) { Fx.Assert(operationContext != null, "operationContext is null"); this.operationContext = operationContext; } public long ContentLength { get { return long.Parse(this.MessageProperty.Headers[HttpResponseHeader.ContentLength], CultureInfo.InvariantCulture); } set { this.MessageProperty.Headers[HttpResponseHeader.ContentLength] = value.ToString(CultureInfo.InvariantCulture); } } public string ContentType { get { return this.MessageProperty.Headers[HttpResponseHeader.ContentType]; } set { this.MessageProperty.Headers[HttpResponseHeader.ContentType] = value; } } public string ETag { get { return this.MessageProperty.Headers[HttpResponseHeader.ETag]; } set { this.MessageProperty.Headers[HttpResponseHeader.ETag] = value; } } public WebHeaderCollection Headers { get { return this.MessageProperty.Headers; } } public DateTime LastModified { get { return DateTime.Parse(this.MessageProperty.Headers[HttpResponseHeader.LastModified], CultureInfo.InvariantCulture); } set { this.MessageProperty.Headers[HttpResponseHeader.LastModified] = (value.Kind == DateTimeKind.Utc ? value.ToString("R", CultureInfo.InvariantCulture) : value.ToUniversalTime().ToString("R", CultureInfo.InvariantCulture)); } } public string Location { get { return this.MessageProperty.Headers[HttpResponseHeader.Location]; } set { this.MessageProperty.Headers[HttpResponseHeader.Location] = value; } } public HttpStatusCode StatusCode { get {return this.MessageProperty.StatusCode; } set {this.MessageProperty.StatusCode = value; } } public string StatusDescription { get {return this.MessageProperty.StatusDescription; } set {this.MessageProperty.StatusDescription = value; } } public bool SuppressEntityBody { get { return this.MessageProperty.SuppressEntityBody; } set { this.MessageProperty.SuppressEntityBody = value; } } HttpResponseMessageProperty MessageProperty { get { if (!operationContext.OutgoingMessageProperties.ContainsKey(HttpResponseMessageProperty.Name)) { operationContext.OutgoingMessageProperties.Add(HttpResponseMessageProperty.Name, new HttpResponseMessageProperty()); } return operationContext.OutgoingMessageProperties[HttpResponseMessageProperty.Name] as HttpResponseMessageProperty; } } public void SetStatusAsCreated(Uri locationUri) { if (locationUri == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("locationUri"); } this.StatusCode = HttpStatusCode.Created; this.Location = locationUri.ToString(); } public void SetStatusAsNotFound() { this.StatusCode = HttpStatusCode.NotFound; } public void SetStatusAsNotFound(string description) { this.StatusCode = HttpStatusCode.NotFound; this.StatusDescription = description; } } } // 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
- AssemblyCache.cs
- DocumentOrderQuery.cs
- DataControlFieldCell.cs
- _SecureChannel.cs
- PasswordTextNavigator.cs
- UnsafeMethods.cs
- ConnectionStringSettings.cs
- NativeMethods.cs
- WebPartManagerInternals.cs
- ProfileParameter.cs
- ConnectionStringsExpressionEditor.cs
- Light.cs
- RtfNavigator.cs
- RectIndependentAnimationStorage.cs
- DataRowChangeEvent.cs
- LogEntrySerialization.cs
- WSDualHttpBindingCollectionElement.cs
- Point3DAnimation.cs
- CodeValidator.cs
- IUnknownConstantAttribute.cs
- EventLogInformation.cs
- X509Utils.cs
- QueryOperatorEnumerator.cs
- DebugControllerThread.cs
- CapabilitiesRule.cs
- ServicePointManager.cs
- ContextStack.cs
- ConfigurationStrings.cs
- CachedPathData.cs
- GeneralTransform3DGroup.cs
- DelegatedStream.cs
- HandlerWithFactory.cs
- Models.cs
- EntityProviderServices.cs
- HttpPostedFileWrapper.cs
- TrackingProfile.cs
- adornercollection.cs
- BooleanToVisibilityConverter.cs
- NaturalLanguageHyphenator.cs
- GatewayIPAddressInformationCollection.cs
- RecordConverter.cs
- ExeConfigurationFileMap.cs
- FileSystemWatcher.cs
- WebPartConnectionsEventArgs.cs
- ExtendedTransformFactory.cs
- RedistVersionInfo.cs
- WebServiceClientProxyGenerator.cs
- DictionaryKeyPropertyAttribute.cs
- RemoteWebConfigurationHostStream.cs
- ThemeDictionaryExtension.cs
- ValueOfAction.cs
- httpstaticobjectscollection.cs
- MULTI_QI.cs
- DataSourceCollectionBase.cs
- ServiceBehaviorElementCollection.cs
- FileLevelControlBuilderAttribute.cs
- Boolean.cs
- SessionSwitchEventArgs.cs
- SqlDataSourceCache.cs
- Panel.cs
- ItemsControlAutomationPeer.cs
- Win32.cs
- FontFamilyIdentifier.cs
- PerspectiveCamera.cs
- RuntimeVariableList.cs
- DataGridViewCellCollection.cs
- BamlLocalizabilityResolver.cs
- KoreanLunisolarCalendar.cs
- ActivityXamlServices.cs
- DataGridViewDataConnection.cs
- MembershipPasswordException.cs
- DropShadowBitmapEffect.cs
- ConstraintManager.cs
- DatatypeImplementation.cs
- DesignerOptionService.cs
- DropDownButton.cs
- XmlSchemaInclude.cs
- SqlWebEventProvider.cs
- XomlCompilerHelpers.cs
- SimpleFileLog.cs
- AsyncInvokeOperation.cs
- ComplexType.cs
- IInstanceContextProvider.cs
- PrinterUnitConvert.cs
- FragmentNavigationEventArgs.cs
- RadioButton.cs
- SecUtil.cs
- SamlAssertionDirectKeyIdentifierClause.cs
- NonBatchDirectoryCompiler.cs
- OutputCacheSettings.cs
- HtmlInputRadioButton.cs
- ExpandCollapseProviderWrapper.cs
- TagNameToTypeMapper.cs
- GZipStream.cs
- UnknownBitmapEncoder.cs
- SignatureToken.cs
- ExecutionEngineException.cs
- XmlSchemaCompilationSettings.cs
- Control.cs
- TwoPhaseCommit.cs