Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / _NetRes.cs / 1305376 / _NetRes.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net { using System.Diagnostics; using System.Globalization; internal class NetRes { /*++ Constructor This is the constructor, marked private because this class shouldn't be instantiated. --*/ private NetRes() { } /*++ GetWebStatusString - Get a WebExceptionStatus-specific resource string This method takes an input string and a WebExceptionStatus. We use the input string as a key to find a status message and the webStatus to produce a status-specific message, then we combine the two. Input: Res - Id for resource string. Status - The WebExceptionStatus to be formatted. Returns: string for localized message. --*/ public static string GetWebStatusString(string Res, WebExceptionStatus Status) { string Msg; string StatusMsg; StatusMsg = SR.GetString(WebExceptionMapping.GetWebStatusString(Status)); // Get the base status. Msg = SR.GetString(Res); // Format the status specific message into the base status and return // that return String.Format(CultureInfo.CurrentCulture, Msg, StatusMsg); } public static string GetWebStatusString(WebExceptionStatus Status) { return SR.GetString(WebExceptionMapping.GetWebStatusString(Status)); } /*++ GetWebStatusCodeString - Get a StatusCode-specific resource string This method is used to map a HTTP status code to a specific user readable error code. Input: statusCode - Id for resource string. Status - The WebExceptionStatus to be formatted. Returns: string for localized message. --*/ public static string GetWebStatusCodeString(HttpStatusCode statusCode, string statusDescription) { string webStatusCode = "(" + ((int)statusCode).ToString(NumberFormatInfo.InvariantInfo) + ")"; string statusMessage = null; // // Now combine the label with the base enum key and look up the status msg. // try { // // convert the HttpStatusCode to its label and look it up. // statusMessage = SR.GetString("net_httpstatuscode_" + statusCode.ToString(), null); } catch { } if (statusMessage!=null && statusMessage.Length>0) { webStatusCode += " " + statusMessage; } else { // // Otherwise try to map the base status. // if (statusDescription!=null && statusDescription.Length>0) { webStatusCode += " " + statusDescription; } } return webStatusCode; } public static string GetWebStatusCodeString(FtpStatusCode statusCode, string statusDescription) { string webStatusCode = "(" + ((int)statusCode).ToString(NumberFormatInfo.InvariantInfo) + ")"; string statusMessage = null; // // Now combine the label with the base enum key and look up the status msg. // try { // // convert the HttpStatusCode to its label and look it up. // statusMessage = SR.GetString("net_ftpstatuscode_" + statusCode.ToString(), null); } catch { } if (statusMessage!=null && statusMessage.Length>0) { webStatusCode += " " + statusMessage; } else { // // Otherwise try to map the base status. // if (statusDescription!=null && statusDescription.Length>0) { webStatusCode += " " + statusDescription; } } return webStatusCode; } } } // 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
- AssemblyFilter.cs
- RecordConverter.cs
- PersonalizationStateInfoCollection.cs
- StateRuntime.cs
- Int32CAMarshaler.cs
- AssociationTypeEmitter.cs
- FileDialogCustomPlacesCollection.cs
- ListBox.cs
- AppDomainManager.cs
- DNS.cs
- XmlChildEnumerator.cs
- ErrorsHelper.cs
- PeerNameRecordCollection.cs
- QueryOptionExpression.cs
- TypeLibConverter.cs
- StateBag.cs
- TdsParserStateObject.cs
- HostingEnvironmentWrapper.cs
- DataSourceCache.cs
- DebugHandleTracker.cs
- ClientUIRequest.cs
- nulltextnavigator.cs
- ConstantSlot.cs
- OdbcDataReader.cs
- DatatypeImplementation.cs
- SQLGuidStorage.cs
- BooleanAnimationBase.cs
- Win32SafeHandles.cs
- InputLangChangeEvent.cs
- AnnotationComponentManager.cs
- ListParagraph.cs
- TextTreeTextElementNode.cs
- DetailsViewCommandEventArgs.cs
- ShortcutKeysEditor.cs
- X509Certificate2.cs
- StringWriter.cs
- XmlSchemaSet.cs
- AuthenticationManager.cs
- RelationshipManager.cs
- StylusCollection.cs
- LinqDataSourceUpdateEventArgs.cs
- DataSourceCacheDurationConverter.cs
- NonVisualControlAttribute.cs
- CapabilitiesRule.cs
- Compensate.cs
- PipelineModuleStepContainer.cs
- TaskbarItemInfo.cs
- DataSet.cs
- IApplicationTrustManager.cs
- DataTableTypeConverter.cs
- ConfigurationValue.cs
- DiagnosticEventProvider.cs
- StorageInfo.cs
- ComponentCollection.cs
- BmpBitmapEncoder.cs
- TextUtf8RawTextWriter.cs
- SqlLiftWhereClauses.cs
- CmsUtils.cs
- UnicodeEncoding.cs
- ListBindableAttribute.cs
- UseAttributeSetsAction.cs
- AnnotationHelper.cs
- UrlMapping.cs
- IUnknownConstantAttribute.cs
- DataGridViewButtonCell.cs
- Scalars.cs
- CssStyleCollection.cs
- Roles.cs
- FlagPanel.cs
- Psha1DerivedKeyGenerator.cs
- ProfileService.cs
- RegularExpressionValidator.cs
- GenericEnumConverter.cs
- PropertyFilterAttribute.cs
- UdpDiscoveryMessageFilter.cs
- XmlEventCache.cs
- IgnoreFlushAndCloseStream.cs
- DataListItem.cs
- TextElementEditingBehaviorAttribute.cs
- Animatable.cs
- EntityDataSourceDesignerHelper.cs
- IDReferencePropertyAttribute.cs
- mediaeventargs.cs
- ExceptionUtil.cs
- ChtmlCalendarAdapter.cs
- ProfileGroupSettings.cs
- ItemContainerGenerator.cs
- PKCS1MaskGenerationMethod.cs
- RichTextBoxConstants.cs
- ImmComposition.cs
- BindingListCollectionView.cs
- ProjectionAnalyzer.cs
- SiteMapPath.cs
- XmlNodeReader.cs
- ArithmeticException.cs
- X509CertificateStore.cs
- GeneratedContractType.cs
- WsdlInspector.cs
- Resources.Designer.cs
- FieldMetadata.cs