Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- VersionPair.cs
- DataGridPagerStyle.cs
- NativeMethodsCLR.cs
- HtmlValidationSummaryAdapter.cs
- _NetRes.cs
- DataSetMappper.cs
- GeneratedCodeAttribute.cs
- RequestStatusBarUpdateEventArgs.cs
- DataGridViewCellMouseEventArgs.cs
- EmptyImpersonationContext.cs
- MethodExpression.cs
- WindowsListViewScroll.cs
- JoinGraph.cs
- LightweightCodeGenerator.cs
- DigitShape.cs
- InputDevice.cs
- DataGridViewCellValueEventArgs.cs
- FunctionQuery.cs
- CapabilitiesAssignment.cs
- CodeTypeDeclarationCollection.cs
- Substitution.cs
- WebPartTracker.cs
- TypeName.cs
- CustomGrammar.cs
- CryptoKeySecurity.cs
- XPathSelfQuery.cs
- XmlDataSourceNodeDescriptor.cs
- SingleKeyFrameCollection.cs
- HttpServerProtocol.cs
- AlgoModule.cs
- SwitchAttribute.cs
- WorkflowViewManager.cs
- WindowsSolidBrush.cs
- EventProperty.cs
- TextFormatterImp.cs
- RecordsAffectedEventArgs.cs
- Version.cs
- XmlAttributeCollection.cs
- SqlDataSourceFilteringEventArgs.cs
- PrinterSettings.cs
- PenLineCapValidation.cs
- ExportOptions.cs
- MappingException.cs
- CmsInterop.cs
- SafeEventLogWriteHandle.cs
- SapiAttributeParser.cs
- EncoderParameter.cs
- EditBehavior.cs
- AffineTransform3D.cs
- BitmapFrameEncode.cs
- XmlSchemaComplexContent.cs
- OracleConnectionStringBuilder.cs
- Policy.cs
- ConnectionInterfaceCollection.cs
- AssociationSet.cs
- ProcessModule.cs
- GenericUriParser.cs
- SrgsItemList.cs
- ConnectionStringsExpressionEditor.cs
- Constant.cs
- HorizontalAlignConverter.cs
- HiddenFieldPageStatePersister.cs
- ConnectionPointCookie.cs
- DbConnectionInternal.cs
- FileDialog_Vista_Interop.cs
- WindowsSolidBrush.cs
- FlowLayoutPanel.cs
- HwndSubclass.cs
- ValidationSummary.cs
- RSAOAEPKeyExchangeFormatter.cs
- ErrorInfoXmlDocument.cs
- TraceContext.cs
- DescriptionAttribute.cs
- ConfigXmlWhitespace.cs
- WebPartActionVerb.cs
- HandlerFactoryCache.cs
- FontStyle.cs
- WebEventTraceProvider.cs
- TextTreeInsertUndoUnit.cs
- ITextView.cs
- BindingBase.cs
- ScriptHandlerFactory.cs
- _Connection.cs
- SafeHandle.cs
- LinearGradientBrush.cs
- NotSupportedException.cs
- X509CertificateEndpointIdentity.cs
- ZoneMembershipCondition.cs
- ToolStripPanel.cs
- XmlSchemaRedefine.cs
- GridViewColumn.cs
- ScriptMethodAttribute.cs
- ReplyChannelBinder.cs
- ColumnMapProcessor.cs
- DataBindingsDialog.cs
- Serializer.cs
- ControllableStoryboardAction.cs
- EarlyBoundInfo.cs
- WindowInteractionStateTracker.cs
- CustomErrorsSection.cs