Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / _NetRes.cs / 1 / _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; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HybridDictionary.cs
- File.cs
- DataGridBeginningEditEventArgs.cs
- Update.cs
- DownloadProgressEventArgs.cs
- DoubleAnimationUsingKeyFrames.cs
- BitmapData.cs
- Constraint.cs
- EncodingNLS.cs
- StateMachineDesignerPaint.cs
- KeyFrames.cs
- CommonDialog.cs
- InstallerTypeAttribute.cs
- ImageDrawing.cs
- Storyboard.cs
- HttpApplicationFactory.cs
- Transform3D.cs
- ToolStripContainer.cs
- Propagator.cs
- DataBoundLiteralControl.cs
- _Win32.cs
- Win32Exception.cs
- Label.cs
- TreeView.cs
- CredentialCache.cs
- RestHandler.cs
- ImageConverter.cs
- XmlAttributeOverrides.cs
- AsmxEndpointPickerExtension.cs
- StringDictionary.cs
- LinkDesigner.cs
- XmlTextAttribute.cs
- DbProviderFactories.cs
- StreamAsIStream.cs
- TableNameAttribute.cs
- PropVariant.cs
- UriTemplateClientFormatter.cs
- OleDbCommandBuilder.cs
- Win32.cs
- Compiler.cs
- ScriptResourceAttribute.cs
- WorkerRequest.cs
- ItemCollection.cs
- CroppedBitmap.cs
- Adorner.cs
- Base64Encoding.cs
- ChineseLunisolarCalendar.cs
- FixedSOMPageConstructor.cs
- StorageBasedPackageProperties.cs
- AuthenticationManager.cs
- UserValidatedEventArgs.cs
- ManipulationVelocities.cs
- RecommendedAsConfigurableAttribute.cs
- PersistStreamTypeWrapper.cs
- ProxyWebPart.cs
- ScrollBarRenderer.cs
- CaseInsensitiveHashCodeProvider.cs
- InternalsVisibleToAttribute.cs
- SqlDataSourceWizardForm.cs
- AttachedProperty.cs
- DesignSurface.cs
- LocalBuilder.cs
- DuplexChannelBinder.cs
- Rule.cs
- RedirectionProxy.cs
- HtmlInputFile.cs
- TextEvent.cs
- DataSourceDescriptorCollection.cs
- GraphicsContext.cs
- StandardBindingReliableSessionElement.cs
- CodeDomSerializer.cs
- ThreadStartException.cs
- WebPartZone.cs
- FacetEnabledSchemaElement.cs
- StrongNameMembershipCondition.cs
- SchemaType.cs
- OdbcHandle.cs
- CachedRequestParams.cs
- SqlBuffer.cs
- PkcsUtils.cs
- KeyValueConfigurationCollection.cs
- AesManaged.cs
- ItemsPanelTemplate.cs
- HandlerBase.cs
- CodeBlockBuilder.cs
- FastEncoderStatics.cs
- HwndSourceParameters.cs
- IndexOutOfRangeException.cs
- ScriptControlManager.cs
- LayoutTable.cs
- SqlLiftWhereClauses.cs
- MulticastIPAddressInformationCollection.cs
- InnerItemCollectionView.cs
- JoinTreeSlot.cs
- WebPartConnectionsConnectVerb.cs
- HttpConfigurationContext.cs
- XmlLoader.cs
- DriveInfo.cs
- DataGridViewRowCollection.cs
- localization.cs