Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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; } } } // 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
- ArrayTypeMismatchException.cs
- XmlSchema.cs
- StringBlob.cs
- ProviderCommandInfoUtils.cs
- TablePatternIdentifiers.cs
- ClientSettingsSection.cs
- Console.cs
- EditorZoneDesigner.cs
- ComponentCollection.cs
- DataRecordObjectView.cs
- OracleEncoding.cs
- TableLayoutPanelCellPosition.cs
- Parser.cs
- LoginView.cs
- UserPreferenceChangingEventArgs.cs
- SourceFileBuildProvider.cs
- BitmapPalettes.cs
- NumberFunctions.cs
- Setter.cs
- SettingsPropertyCollection.cs
- EncoderParameter.cs
- GroupBoxRenderer.cs
- DatatypeImplementation.cs
- BinaryOperationBinder.cs
- IntPtr.cs
- BrowserCapabilitiesFactory.cs
- PersonalizationAdministration.cs
- DataControlFieldCell.cs
- Themes.cs
- FixedSOMImage.cs
- ManagedIStream.cs
- AutomationElementCollection.cs
- Validator.cs
- ImageField.cs
- GridViewCellAutomationPeer.cs
- ListViewSortEventArgs.cs
- NetworkStream.cs
- RegexBoyerMoore.cs
- SiteMapProvider.cs
- ScriptIgnoreAttribute.cs
- XamlReaderHelper.cs
- HttpFormatExtensions.cs
- UserControl.cs
- SmtpFailedRecipientException.cs
- ChannelParameterCollection.cs
- Pair.cs
- EpmContentSerializer.cs
- TextPatternIdentifiers.cs
- FormViewDesigner.cs
- XmlFormatReaderGenerator.cs
- DeviceContext2.cs
- RC2CryptoServiceProvider.cs
- Input.cs
- TabletDevice.cs
- CodeConditionStatement.cs
- AudioLevelUpdatedEventArgs.cs
- XmlObjectSerializerReadContextComplexJson.cs
- Paragraph.cs
- CheckableControlBaseAdapter.cs
- PointF.cs
- ListViewInsertedEventArgs.cs
- ListViewDeletedEventArgs.cs
- ApplyTemplatesAction.cs
- Psha1DerivedKeyGenerator.cs
- DataSourceCache.cs
- BaseAsyncResult.cs
- PrintPreviewDialog.cs
- ExecutionContext.cs
- CalculatedColumn.cs
- CommandEventArgs.cs
- XPathNavigator.cs
- Trace.cs
- DashStyles.cs
- ActivityCodeDomSerializer.cs
- X509IssuerSerialKeyIdentifierClause.cs
- SwitchAttribute.cs
- AxHost.cs
- WSDualHttpSecurityElement.cs
- TimeZoneInfo.cs
- FormatException.cs
- LicenseContext.cs
- TrackingMemoryStreamFactory.cs
- EmbeddedMailObjectsCollection.cs
- Debug.cs
- TableLayoutCellPaintEventArgs.cs
- ColumnReorderedEventArgs.cs
- PeerName.cs
- LayoutTable.cs
- ToolStripCustomTypeDescriptor.cs
- PageThemeBuildProvider.cs
- LinqDataSourceContextEventArgs.cs
- PageStatePersister.cs
- ListBox.cs
- PersonalizableTypeEntry.cs
- GeometryModel3D.cs
- DataRelationPropertyDescriptor.cs
- DataGridHeaderBorder.cs
- CqlLexer.cs
- CompModSwitches.cs
- GrammarBuilderBase.cs