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
- ListViewAutomationPeer.cs
- TypeGenericEnumerableViewSchema.cs
- Popup.cs
- ImportedPolicyConversionContext.cs
- NamedPipeTransportBindingElement.cs
- Action.cs
- StylusDevice.cs
- MediaContextNotificationWindow.cs
- InternalDispatchObject.cs
- XmlComment.cs
- BaseAddressElement.cs
- RtfToXamlLexer.cs
- HttpClientCertificate.cs
- AssemblyResourceLoader.cs
- IFormattable.cs
- DbBuffer.cs
- SystemIPv6InterfaceProperties.cs
- GcSettings.cs
- PageBreakRecord.cs
- CollectionViewSource.cs
- TdsParserHelperClasses.cs
- TypeUtil.cs
- RequiredFieldValidator.cs
- ButtonStandardAdapter.cs
- SqlDataSourceFilteringEventArgs.cs
- ExpressionReplacer.cs
- XmlEventCache.cs
- ClockController.cs
- GenericWebPart.cs
- Win32.cs
- QuaternionValueSerializer.cs
- RootAction.cs
- SyndicationContent.cs
- SecurityException.cs
- handlecollector.cs
- HtmlProps.cs
- WCFModelStrings.Designer.cs
- ImageField.cs
- DetailsViewPagerRow.cs
- MetadataItemCollectionFactory.cs
- EncryptedData.cs
- ControlFilterExpression.cs
- HierarchicalDataTemplate.cs
- WorkflowInlining.cs
- HttpCacheParams.cs
- ObjectMaterializedEventArgs.cs
- DrawingAttributeSerializer.cs
- XmlSchemaValidator.cs
- EditorZone.cs
- BlockUIContainer.cs
- ConditionBrowserDialog.cs
- Range.cs
- ContactManager.cs
- BasicDesignerLoader.cs
- TransactedReceiveScope.cs
- ChildrenQuery.cs
- X509Utils.cs
- InvalidPrinterException.cs
- ThreadSafeList.cs
- PropertyRef.cs
- Deserializer.cs
- SelectedCellsChangedEventArgs.cs
- WindowsRegion.cs
- ControlBindingsCollection.cs
- TdsParserSafeHandles.cs
- NameNode.cs
- AdornerLayer.cs
- WorkflowViewStateService.cs
- ThreadPoolTaskScheduler.cs
- ProcessProtocolHandler.cs
- DetailsViewCommandEventArgs.cs
- EntityModelSchemaGenerator.cs
- QilName.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- ScrollViewerAutomationPeer.cs
- SpecialNameAttribute.cs
- NonValidatingSecurityTokenAuthenticator.cs
- webclient.cs
- CaseStatement.cs
- OpenTypeLayout.cs
- MultiView.cs
- ConstructorExpr.cs
- FilterEventArgs.cs
- SynchronizedInputPattern.cs
- Baml2006ReaderFrame.cs
- COMException.cs
- Int32CAMarshaler.cs
- MailHeaderInfo.cs
- JournalEntryStack.cs
- ConfigurationManagerInternalFactory.cs
- BaseAddressPrefixFilterElement.cs
- ContextMenuStrip.cs
- EntityViewGenerator.cs
- PagerStyle.cs
- Int32KeyFrameCollection.cs
- unsafenativemethodsother.cs
- HwndSourceKeyboardInputSite.cs
- COM2ExtendedBrowsingHandler.cs
- Function.cs
- WindowsClaimSet.cs