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
- AttachedAnnotation.cs
- SystemKeyConverter.cs
- CurrencyWrapper.cs
- KeysConverter.cs
- ImmutableCommunicationTimeouts.cs
- SqlConnectionFactory.cs
- ICollection.cs
- ToolBarButtonClickEvent.cs
- RectValueSerializer.cs
- AssemblySettingAttributes.cs
- DesignBindingEditor.cs
- LocatorPartList.cs
- WhitespaceRule.cs
- oledbconnectionstring.cs
- RelationshipEndCollection.cs
- ExtentCqlBlock.cs
- CodeParameterDeclarationExpressionCollection.cs
- DataTableClearEvent.cs
- formatstringdialog.cs
- CodeEntryPointMethod.cs
- NavigationWindowAutomationPeer.cs
- CategoriesDocumentFormatter.cs
- PathSegmentCollection.cs
- InternalRelationshipCollection.cs
- NullableDoubleMinMaxAggregationOperator.cs
- TogglePattern.cs
- IODescriptionAttribute.cs
- RtfControlWordInfo.cs
- DescendentsWalkerBase.cs
- ResXResourceSet.cs
- LineMetrics.cs
- AstTree.cs
- ObjectToken.cs
- UInt64.cs
- DataSourceGeneratorException.cs
- ClientRuntimeConfig.cs
- RelatedView.cs
- MimeMultiPart.cs
- XPathBinder.cs
- BoolExpr.cs
- UIElement3DAutomationPeer.cs
- Baml6Assembly.cs
- RetrieveVirtualItemEventArgs.cs
- HeaderLabel.cs
- MdImport.cs
- WindowsFont.cs
- NativeMethods.cs
- ContextQuery.cs
- WebPartMovingEventArgs.cs
- TypeEnumerableViewSchema.cs
- ChangeBlockUndoRecord.cs
- VectorCollection.cs
- UiaCoreTypesApi.cs
- ObsoleteAttribute.cs
- ServicePoint.cs
- TranslateTransform3D.cs
- Application.cs
- XomlCompilerResults.cs
- TabletDevice.cs
- MetaModel.cs
- TemplatePropertyEntry.cs
- OutOfMemoryException.cs
- VariantWrapper.cs
- RegexParser.cs
- BinaryObjectWriter.cs
- HwndTarget.cs
- DictionaryBase.cs
- GridLengthConverter.cs
- DataGridViewImageColumn.cs
- QuaternionAnimationBase.cs
- UnsafeNativeMethodsTablet.cs
- CharEnumerator.cs
- OdbcParameterCollection.cs
- ProxyWebPart.cs
- Win32SafeHandles.cs
- HtmlInputSubmit.cs
- GeometryCombineModeValidation.cs
- AdornedElementPlaceholder.cs
- DocumentReferenceCollection.cs
- SingleKeyFrameCollection.cs
- UInt32Converter.cs
- ProfileParameter.cs
- ObjectStateFormatter.cs
- HoistedLocals.cs
- ManagedWndProcTracker.cs
- FixUp.cs
- CodeIterationStatement.cs
- AuthenticationManager.cs
- SafeBitVector32.cs
- SafeSerializationManager.cs
- ComPersistableTypeElementCollection.cs
- Point3DCollection.cs
- HwndHostAutomationPeer.cs
- PropVariant.cs
- EntityStoreSchemaFilterEntry.cs
- Brush.cs
- SpecialFolderEnumConverter.cs
- SqlWorkflowInstanceStore.cs
- MailMessage.cs
- OdbcRowUpdatingEvent.cs