Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Configuration / UrlMapping.cs / 2 / UrlMapping.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.Globalization; using System.IO; using System.Text; using System.ComponentModel; using System.Web.Util; using System.Diagnostics; using System.Security.Permissions; [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class UrlMapping : ConfigurationElement { private static ConfigurationPropertyCollection _properties; #region Property Declarations private static readonly ConfigurationProperty _propUrl = new ConfigurationProperty("url", typeof(string), null, StdValidatorsAndConverters.WhiteSpaceTrimStringConverter, new CallbackValidator(typeof(string), ValidateUrl), ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); private static readonly ConfigurationProperty _propMappedUrl = new ConfigurationProperty("mappedUrl", typeof(string), null, StdValidatorsAndConverters.WhiteSpaceTrimStringConverter, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired); #endregion static UrlMapping() { // Property initialization _properties = new ConfigurationPropertyCollection(); _properties.Add(_propUrl); _properties.Add(_propMappedUrl); } internal UrlMapping() { } public UrlMapping(string url, string mappedUrl) { base[_propUrl] = url; base[_propMappedUrl] = mappedUrl; } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("url", IsRequired = true, IsKey = true)] public string Url { get { return (string)base[_propUrl]; } } [ConfigurationProperty("mappedUrl", IsRequired = true)] public string MappedUrl { get { return (string)base[_propMappedUrl]; } } static private void ValidateUrl(object value) { // The Url cannot be an empty string. Use the std validator for that StdValidatorsAndConverters.NonEmptyStringValidator.Validate(value); string url = (string)value; if (!UrlPath.IsAppRelativePath(url)) { throw new ConfigurationErrorsException(SR.GetString(SR.UrlMappings_only_app_relative_url_allowed, url)); } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpWrapper.cs
- CommonObjectSecurity.cs
- ProcessHostMapPath.cs
- DocumentViewerBaseAutomationPeer.cs
- UMPAttributes.cs
- ConnectionInterfaceCollection.cs
- URIFormatException.cs
- Descriptor.cs
- SafeLibraryHandle.cs
- TextDecorationCollection.cs
- TextEditorParagraphs.cs
- Stack.cs
- BulletDecorator.cs
- LayoutTable.cs
- MappingSource.cs
- PeerContact.cs
- XmlSchemaRedefine.cs
- SystemInfo.cs
- SelectionEditor.cs
- URI.cs
- NamedObjectList.cs
- ClientTargetCollection.cs
- TabControl.cs
- Selector.cs
- PriorityBinding.cs
- DataGridViewButtonColumn.cs
- AutomationPatternInfo.cs
- BrowserCapabilitiesCompiler.cs
- SharedUtils.cs
- LongMinMaxAggregationOperator.cs
- MonthChangedEventArgs.cs
- Single.cs
- UniqueIdentifierService.cs
- PackagePart.cs
- ProcessHostServerConfig.cs
- SqlDataSourceView.cs
- RecipientServiceModelSecurityTokenRequirement.cs
- ModulesEntry.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TabControlDesigner.cs
- BooleanExpr.cs
- DocumentProperties.cs
- XPathNodeInfoAtom.cs
- XamlFigureLengthSerializer.cs
- NavigatorInput.cs
- CommunicationObjectManager.cs
- XmlSchemaElement.cs
- OneToOneMappingSerializer.cs
- embossbitmapeffect.cs
- SchemaTableColumn.cs
- SecurityIdentifierElementCollection.cs
- TypedTableBaseExtensions.cs
- DesignerDataRelationship.cs
- FrameworkTextComposition.cs
- RegexGroup.cs
- WorkflowOperationAsyncResult.cs
- SoapObjectWriter.cs
- ProxyWebPartConnectionCollection.cs
- Splitter.cs
- VisualTarget.cs
- TypeSystem.cs
- OleAutBinder.cs
- ReaderOutput.cs
- XPathPatternParser.cs
- WsatConfiguration.cs
- DataFormats.cs
- PenContexts.cs
- CachedBitmap.cs
- _IPv4Address.cs
- CancellationTokenSource.cs
- PasswordBox.cs
- SqlWebEventProvider.cs
- BindingOperations.cs
- CheckoutException.cs
- ScrollEventArgs.cs
- DesignerAttribute.cs
- SqlNamer.cs
- ThrowHelper.cs
- RoutedUICommand.cs
- GeneralTransform3DTo2D.cs
- ExcludePathInfo.cs
- TextSelectionHighlightLayer.cs
- ModuleConfigurationInfo.cs
- ListViewDeletedEventArgs.cs
- CodeConstructor.cs
- CustomErrorsSection.cs
- AuthenticationSection.cs
- WriterOutput.cs
- ListViewInsertionMark.cs
- TimelineCollection.cs
- PowerModeChangedEventArgs.cs
- ExceptionValidationRule.cs
- ApplicationServiceHelper.cs
- ListBox.cs
- InternalCache.cs
- versioninfo.cs
- ServicesUtilities.cs
- BitmapEffect.cs
- ValueSerializerAttribute.cs
- PreservationFileReader.cs