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
- XmlSchemaInferenceException.cs
- MessageQueueAccessControlEntry.cs
- HttpListenerPrefixCollection.cs
- Literal.cs
- FilterEventArgs.cs
- BindingContext.cs
- CollectionView.cs
- ProviderCollection.cs
- EncodingDataItem.cs
- DrawingContext.cs
- WindowHideOrCloseTracker.cs
- XappLauncher.cs
- MetadataArtifactLoaderFile.cs
- NotSupportedException.cs
- RawStylusInput.cs
- CodeTypeOfExpression.cs
- ToolStripDropDownClosingEventArgs.cs
- FacetValueContainer.cs
- MimeWriter.cs
- DesignTimeTemplateParser.cs
- EntityObject.cs
- ReadOnlyObservableCollection.cs
- Array.cs
- DetailsViewInsertEventArgs.cs
- MiniModule.cs
- ClientConvert.cs
- MethodAccessException.cs
- ZipIOCentralDirectoryBlock.cs
- PriorityQueue.cs
- InstanceKeyView.cs
- OptionUsage.cs
- IdentityReference.cs
- DockAndAnchorLayout.cs
- storepermissionattribute.cs
- HttpFileCollection.cs
- TableAdapterManagerHelper.cs
- UnsafeNativeMethodsCLR.cs
- SafeArrayRankMismatchException.cs
- Renderer.cs
- RtfFormatStack.cs
- AsymmetricKeyExchangeDeformatter.cs
- TextureBrush.cs
- ControlCollection.cs
- HyperLink.cs
- PasswordTextNavigator.cs
- BoolExpressionVisitors.cs
- TCEAdapterGenerator.cs
- XmlSchemaChoice.cs
- ForAllOperator.cs
- PropertyGeneratedEventArgs.cs
- BackgroundFormatInfo.cs
- DataGridItemEventArgs.cs
- ScrollViewer.cs
- Assert.cs
- InstancePersistenceCommandException.cs
- ComplexLine.cs
- DocumentApplicationJournalEntry.cs
- Timer.cs
- TargetControlTypeAttribute.cs
- WrappedIUnknown.cs
- ObjectDataSourceWizardForm.cs
- XmlDsigSep2000.cs
- MarginCollapsingState.cs
- BaseAddressPrefixFilterElement.cs
- ValidationPropertyAttribute.cs
- _ScatterGatherBuffers.cs
- MetadataCache.cs
- RoleGroup.cs
- ToolStripDropDownButton.cs
- StringWriter.cs
- SQLInt16Storage.cs
- Pair.cs
- LogLogRecordHeader.cs
- MessageDecoder.cs
- ObjRef.cs
- BasicKeyConstraint.cs
- HandledEventArgs.cs
- SelectionBorderGlyph.cs
- PerfCounters.cs
- ToolStripLabel.cs
- CodeGotoStatement.cs
- PageOutputColor.cs
- UshortList2.cs
- ImageListImage.cs
- XmlValidatingReaderImpl.cs
- UpdatePanel.cs
- SharedDp.cs
- GridViewEditEventArgs.cs
- DllNotFoundException.cs
- UnicastIPAddressInformationCollection.cs
- AccessedThroughPropertyAttribute.cs
- Header.cs
- Point3D.cs
- DefaultMemberAttribute.cs
- SubclassTypeValidator.cs
- AmbientLight.cs
- UdpTransportSettings.cs
- DateBoldEvent.cs
- RequestUriProcessor.cs
- ListManagerBindingsCollection.cs