Code:
/ FX-1434 / FX-1434 / 1.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
- Rijndael.cs
- ObjectListSelectEventArgs.cs
- DragStartedEventArgs.cs
- FilterQueryOptionExpression.cs
- NetStream.cs
- ListBoxAutomationPeer.cs
- LinqDataSourceSelectEventArgs.cs
- DataGridViewControlCollection.cs
- Missing.cs
- COM2FontConverter.cs
- ObjectDataSource.cs
- ZipIOCentralDirectoryFileHeader.cs
- RedirectionProxy.cs
- DataSourceDesigner.cs
- TimeSpanSecondsConverter.cs
- Focus.cs
- XmlSerializerVersionAttribute.cs
- ProgressBarRenderer.cs
- WebZone.cs
- WebPartTransformer.cs
- SecurityKeyIdentifierClause.cs
- BookmarkUndoUnit.cs
- UnsafeNativeMethodsTablet.cs
- TreeBuilder.cs
- DesignerInterfaces.cs
- ThreadSafeList.cs
- AndCondition.cs
- BatchServiceHost.cs
- SchemaTableColumn.cs
- Ref.cs
- xml.cs
- Stackframe.cs
- StreamReader.cs
- ViewStateModeByIdAttribute.cs
- CryptographicAttribute.cs
- WindowPattern.cs
- MulticastDelegate.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- TextSearch.cs
- ScaleTransform.cs
- XmlSchemaImport.cs
- ReceiveActivityDesigner.cs
- PerformanceCounterCategory.cs
- UpdateException.cs
- Win32.cs
- NamedPipeTransportSecurityElement.cs
- Native.cs
- EntityContainer.cs
- ListViewItemMouseHoverEvent.cs
- CryptographicAttribute.cs
- ParserExtension.cs
- DataServiceException.cs
- mediaeventargs.cs
- MethodBuilderInstantiation.cs
- TextRangeSerialization.cs
- DataErrorValidationRule.cs
- TemplatedWizardStep.cs
- ErrorRuntimeConfig.cs
- VersionPair.cs
- TabControl.cs
- WebBrowserSiteBase.cs
- FieldMetadata.cs
- EntityException.cs
- PropertyCollection.cs
- FolderBrowserDialog.cs
- GlobalItem.cs
- Int64Storage.cs
- Walker.cs
- Quad.cs
- BindingSource.cs
- CodeStatement.cs
- EntityCommandDefinition.cs
- HandleRef.cs
- Attachment.cs
- ComContractElement.cs
- CommunicationException.cs
- ToolStripContentPanelDesigner.cs
- IdleTimeoutMonitor.cs
- WindowsListViewSubItem.cs
- SafeEventLogWriteHandle.cs
- X500Name.cs
- EmptyTextWriter.cs
- RootBrowserWindowProxy.cs
- StrongNameMembershipCondition.cs
- updateconfighost.cs
- WorkflowMarkupElementEventArgs.cs
- CodeLabeledStatement.cs
- ToolStripDropDownItem.cs
- PEFileReader.cs
- ContainerFilterService.cs
- Metadata.cs
- WebDescriptionAttribute.cs
- TypeSystem.cs
- _MultipleConnectAsync.cs
- followingquery.cs
- COM2IPerPropertyBrowsingHandler.cs
- _NegotiateClient.cs
- ExpressionNode.cs
- BamlStream.cs
- RuntimeWrappedException.cs