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
- WebBrowserEvent.cs
- InvalidWMPVersionException.cs
- DrawingVisualDrawingContext.cs
- DoubleCollectionConverter.cs
- SimpleType.cs
- DataGridViewSelectedRowCollection.cs
- SizeF.cs
- MethodBuilder.cs
- Privilege.cs
- VisualCollection.cs
- QueryCacheEntry.cs
- _ListenerRequestStream.cs
- StrongNameIdentityPermission.cs
- MarkedHighlightComponent.cs
- RuntimeArgumentHandle.cs
- namescope.cs
- Control.cs
- ListViewItemMouseHoverEvent.cs
- HostSecurityManager.cs
- Collection.cs
- ClipboardProcessor.cs
- ApplicationInfo.cs
- Asn1IntegerConverter.cs
- CompilerInfo.cs
- SurrogateSelector.cs
- DataSetViewSchema.cs
- ThreadAttributes.cs
- TextBoxBase.cs
- MenuItem.cs
- StringAttributeCollection.cs
- DataGrid.cs
- XmlObjectSerializerReadContextComplexJson.cs
- HwndSourceParameters.cs
- UIElement3DAutomationPeer.cs
- Annotation.cs
- XhtmlTextWriter.cs
- ReadOnlyNameValueCollection.cs
- SplineKeyFrames.cs
- Registry.cs
- ListViewAutomationPeer.cs
- BlurEffect.cs
- HtmlElementErrorEventArgs.cs
- MulticastOption.cs
- ButtonRenderer.cs
- XMLSyntaxException.cs
- StandardRuntimeEnumValidator.cs
- InlineObject.cs
- WebProxyScriptElement.cs
- HostingEnvironmentException.cs
- CodeRemoveEventStatement.cs
- PropertyKey.cs
- Transform.cs
- TabControlAutomationPeer.cs
- PrivateFontCollection.cs
- ConstructorNeedsTagAttribute.cs
- BufferedWebEventProvider.cs
- DrawingImage.cs
- HostedNamedPipeTransportManager.cs
- SerialStream.cs
- Item.cs
- HTMLTextWriter.cs
- QueryLifecycle.cs
- Exception.cs
- EntityDataSourceWrapper.cs
- SharedStatics.cs
- SemanticResolver.cs
- DesignTimeVisibleAttribute.cs
- Regex.cs
- CapacityStreamGeometryContext.cs
- ContractCodeDomInfo.cs
- HtmlTableCell.cs
- XmlDataImplementation.cs
- EventLogEntry.cs
- MessageSecurityProtocol.cs
- ReadOnlyTernaryTree.cs
- FileBasedResourceGroveler.cs
- FormsAuthenticationModule.cs
- RefType.cs
- FilterQueryOptionExpression.cs
- ItemsPanelTemplate.cs
- DataFieldEditor.cs
- ChooseAction.cs
- Color.cs
- DataGridViewCellValidatingEventArgs.cs
- TabItemWrapperAutomationPeer.cs
- GeneralTransform3DTo2DTo3D.cs
- CaseStatementSlot.cs
- SubclassTypeValidatorAttribute.cs
- SecurityAlgorithmSuiteConverter.cs
- SecUtil.cs
- PassportPrincipal.cs
- DataGridRowHeaderAutomationPeer.cs
- SymbolMethod.cs
- DecimalConstantAttribute.cs
- ProxyWebPartManager.cs
- URL.cs
- LineInfo.cs
- ContextInformation.cs
- TranslateTransform.cs
- _HelperAsyncResults.cs