Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- VirtualDirectoryMapping.cs
- Transform.cs
- Ref.cs
- ToolStripItemRenderEventArgs.cs
- BamlLocalizabilityResolver.cs
- EndpointInstanceProvider.cs
- AddInEnvironment.cs
- FormClosedEvent.cs
- SerializationException.cs
- WebResourceUtil.cs
- SafeMILHandle.cs
- SourceFileBuildProvider.cs
- UnmanagedMemoryStream.cs
- EraserBehavior.cs
- XmlSchemaCollection.cs
- SelectiveScrollingGrid.cs
- FullTextLine.cs
- PathData.cs
- AppDomainProtocolHandler.cs
- CharAnimationUsingKeyFrames.cs
- ObjectAnimationUsingKeyFrames.cs
- SqlInfoMessageEvent.cs
- WindowsFormsSynchronizationContext.cs
- PlanCompiler.cs
- ActivitySurrogate.cs
- Asn1IntegerConverter.cs
- DataGridViewHitTestInfo.cs
- XsdValidatingReader.cs
- InvalidOleVariantTypeException.cs
- DrawingContextDrawingContextWalker.cs
- PeerResolverElement.cs
- RangeValueProviderWrapper.cs
- IncrementalReadDecoders.cs
- DataControlLinkButton.cs
- Operator.cs
- MediaContext.cs
- CellRelation.cs
- MailWebEventProvider.cs
- ProfilePropertySettingsCollection.cs
- OLEDB_Util.cs
- PolyQuadraticBezierSegment.cs
- WindowsToolbarAsMenu.cs
- MetroSerializationManager.cs
- _NtlmClient.cs
- DataGridViewColumnStateChangedEventArgs.cs
- TcpHostedTransportConfiguration.cs
- DigestComparer.cs
- TreeView.cs
- DocumentCollection.cs
- SqlProviderServices.cs
- GridEntry.cs
- MetaData.cs
- QilCloneVisitor.cs
- SchemaNamespaceManager.cs
- KnownTypes.cs
- Directory.cs
- ArrayElementGridEntry.cs
- HashCodeCombiner.cs
- TextSelection.cs
- TextEditorCopyPaste.cs
- StreamInfo.cs
- DiscoveryViaBehavior.cs
- Set.cs
- StringStorage.cs
- DataGridViewTextBoxCell.cs
- HttpConfigurationContext.cs
- UserThread.cs
- EntityViewGenerationConstants.cs
- ActiveXSite.cs
- TypeExtensionConverter.cs
- TextTreePropertyUndoUnit.cs
- EventLogSession.cs
- StringFreezingAttribute.cs
- ObjectStateManager.cs
- PingOptions.cs
- CompoundFileReference.cs
- SQLDouble.cs
- GeneratedContractType.cs
- FormsAuthentication.cs
- GetPolicyDetailsRequest.cs
- CodeTypeParameter.cs
- SapiRecognizer.cs
- TimeManager.cs
- RSAPKCS1SignatureFormatter.cs
- CollectionViewGroup.cs
- SerializationStore.cs
- PenCursorManager.cs
- SQLMoneyStorage.cs
- DataGridCellClipboardEventArgs.cs
- MeasureData.cs
- SwitchAttribute.cs
- AmbientLight.cs
- DateTimeValueSerializer.cs
- ObjectParameterCollection.cs
- X509SubjectKeyIdentifierClause.cs
- DelayedRegex.cs
- SchemaConstraints.cs
- Pair.cs
- PtsCache.cs
- DeploymentSection.cs