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
- SoapReflectionImporter.cs
- DataControlButton.cs
- XmlDeclaration.cs
- InputLanguageCollection.cs
- NativeMethods.cs
- IListConverters.cs
- ExpressionBuilderContext.cs
- UnsafeNativeMethodsCLR.cs
- CodeRemoveEventStatement.cs
- FormatVersion.cs
- LinkedList.cs
- DbConvert.cs
- XmlDataDocument.cs
- ValidationContext.cs
- HTTPNotFoundHandler.cs
- XmlDigitalSignatureProcessor.cs
- XmlChildNodes.cs
- SmtpMail.cs
- ServicePointManager.cs
- SmtpClient.cs
- CodeMemberMethod.cs
- ResourceSet.cs
- ScriptDescriptor.cs
- MoveSizeWinEventHandler.cs
- UrlMappingsSection.cs
- CompilationSection.cs
- ScriptControlDescriptor.cs
- StringTraceRecord.cs
- StreamWriter.cs
- NamedObject.cs
- InvalidComObjectException.cs
- OutputCacheSettingsSection.cs
- EventLogException.cs
- WizardDesigner.cs
- SystemIcmpV6Statistics.cs
- AutomationProperty.cs
- DataKeyCollection.cs
- FontStyleConverter.cs
- FileLogRecordEnumerator.cs
- PropertyContainer.cs
- Splitter.cs
- BufferedGraphicsContext.cs
- RecordManager.cs
- FontStyle.cs
- ListViewAutomationPeer.cs
- ObjectConverter.cs
- DbQueryCommandTree.cs
- TCPClient.cs
- odbcmetadatacollectionnames.cs
- EdmError.cs
- RequestQueue.cs
- FormViewCommandEventArgs.cs
- HttpCookie.cs
- DatePicker.cs
- TemplatedAdorner.cs
- DataGrid.cs
- FlowDocumentFormatter.cs
- WizardPanel.cs
- EntityClassGenerator.cs
- ProcessMessagesAsyncResult.cs
- DictionaryBase.cs
- ProxyGenerator.cs
- InputMethodStateChangeEventArgs.cs
- PointCollection.cs
- XmlAnyElementAttribute.cs
- IdnElement.cs
- BookmarkScope.cs
- NavigationWindow.cs
- ReaderContextStackData.cs
- Input.cs
- DrawingState.cs
- StringInfo.cs
- TargetInvocationException.cs
- HierarchicalDataBoundControl.cs
- HMACMD5.cs
- Storyboard.cs
- AtomMaterializerLog.cs
- XmlSchemaExporter.cs
- NavigatorInput.cs
- PerformanceCounterPermissionEntry.cs
- ConstrainedDataObject.cs
- MemoryFailPoint.cs
- Metadata.cs
- ApplicationDirectory.cs
- ExpandoClass.cs
- XmlAttributeAttribute.cs
- Point3DAnimationUsingKeyFrames.cs
- ScriptDescriptor.cs
- PEFileEvidenceFactory.cs
- InkCanvasAutomationPeer.cs
- MembershipValidatePasswordEventArgs.cs
- PerspectiveCamera.cs
- OdbcEnvironmentHandle.cs
- ReservationCollection.cs
- DependencyObjectProvider.cs
- ParallelEnumerable.cs
- EncodingStreamWrapper.cs
- BodyGlyph.cs
- ListViewSelectEventArgs.cs
- MainMenu.cs