Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / HttpEncoderUtility.cs / 1305376 / HttpEncoderUtility.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * Helper class for common encoding routines * * Copyright (c) 2009 Microsoft Corporation */ namespace System.Web.Util { using System; using System.Web; internal static class HttpEncoderUtility { public static int HexToInt(char h) { return (h >= '0' && h <= '9') ? h - '0' : (h >= 'a' && h <= 'f') ? h - 'a' + 10 : (h >= 'A' && h <= 'F') ? h - 'A' + 10 : -1; } public static char IntToHex(int n) { Debug.Assert(n < 0x10); if (n <= 9) return (char)(n + (int)'0'); else return (char)(n - 10 + (int)'a'); } // Set of safe chars, from RFC 1738.4 minus '+' public static bool IsUrlSafeChar(char ch) { if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9') return true; switch (ch) { case '-': case '_': case '.': case '!': case '*': case '(': case ')': return true; } return false; } // Helper to encode spaces only internal static String UrlEncodeSpaces(string str) { if (str != null && str.IndexOf(' ') >= 0) str = str.Replace(" ", "%20"); return str; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MemberMaps.cs
- RegistrationServices.cs
- CommandBindingCollection.cs
- ConstructorNeedsTagAttribute.cs
- GridProviderWrapper.cs
- ErrorStyle.cs
- FormattedTextSymbols.cs
- DateTimeFormat.cs
- TryCatchDesigner.xaml.cs
- OdbcStatementHandle.cs
- QilName.cs
- DataPager.cs
- AttachmentService.cs
- SignerInfo.cs
- RuleConditionDialog.cs
- RunInstallerAttribute.cs
- glyphs.cs
- PerformanceCounter.cs
- MatrixAnimationUsingPath.cs
- CalendarButtonAutomationPeer.cs
- WizardSideBarListControlItem.cs
- Parser.cs
- Expr.cs
- RTLAwareMessageBox.cs
- ConnectorDragDropGlyph.cs
- BidPrivateBase.cs
- TextBox.cs
- XmlCharType.cs
- AdapterDictionary.cs
- NamespaceDisplay.xaml.cs
- ToolboxItemImageConverter.cs
- GlobalItem.cs
- ComboBoxAutomationPeer.cs
- DataGridView.cs
- WebPartConnectionsCancelVerb.cs
- GroupItem.cs
- NavigationEventArgs.cs
- AuthorizationPolicyTypeElementCollection.cs
- RowCache.cs
- RectConverter.cs
- ControlPaint.cs
- CultureInfoConverter.cs
- ComplexBindingPropertiesAttribute.cs
- AcceleratedTokenProvider.cs
- ColumnMapCopier.cs
- TextBlockAutomationPeer.cs
- UIAgentMonitor.cs
- DocumentCollection.cs
- OracleString.cs
- X509Certificate2.cs
- XPathNode.cs
- WorkflowApplicationTerminatedException.cs
- _IPv4Address.cs
- TreeView.cs
- ZipFileInfoCollection.cs
- MouseEventArgs.cs
- DeriveBytes.cs
- SetterBase.cs
- FixUpCollection.cs
- PenLineCapValidation.cs
- TextViewSelectionProcessor.cs
- OdbcTransaction.cs
- WasHttpHandlersInstallComponent.cs
- EditorPartCollection.cs
- OptimalTextSource.cs
- ReflectionServiceProvider.cs
- ToolStripItemClickedEventArgs.cs
- ContainerFilterService.cs
- InvalidOleVariantTypeException.cs
- X509CertificateValidator.cs
- CompressionTransform.cs
- DrawingContextWalker.cs
- PublisherIdentityPermission.cs
- ImageFormatConverter.cs
- GenericsInstances.cs
- ThreadSafeList.cs
- FacetDescription.cs
- PathStreamGeometryContext.cs
- RoleGroup.cs
- InternalCache.cs
- NullableFloatSumAggregationOperator.cs
- QueryParameter.cs
- HtmlUtf8RawTextWriter.cs
- DiagnosticTraceSource.cs
- RolePrincipal.cs
- TokenFactoryCredential.cs
- ExpressionDumper.cs
- LambdaCompiler.Address.cs
- TextUtf8RawTextWriter.cs
- MdiWindowListItemConverter.cs
- RelatedPropertyManager.cs
- IUnknownConstantAttribute.cs
- XmlILIndex.cs
- BuildManagerHost.cs
- XmlAggregates.cs
- OptimisticConcurrencyException.cs
- FormViewInsertedEventArgs.cs
- Trace.cs
- PathFigureCollectionConverter.cs
- SiteMapNodeItem.cs