Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UrlMappingsModule.cs / 1 / UrlMappingsModule.cs
namespace System.Web { using System; using System.Web; using System.Web.Util; using System.Web.Configuration; // // Module that implements the UrlMappings functionality // on IIS 7 in integrated mode, this takes the place of // the UrlMappings execution step and is listed insealed internal class UrlMappingsModule : IHttpModule { internal UrlMappingsModule() {} public void Init(HttpApplication application) { bool urlMappingsEnabled = false; UrlMappingsSection urlMappings = RuntimeConfig.GetConfig().UrlMappings; urlMappingsEnabled = urlMappings.IsEnabled && ( urlMappings.UrlMappings.Count > 0 ); if (urlMappingsEnabled) { application.BeginRequest += new EventHandler(OnEnter); } } public void Dispose() {} internal void OnEnter(Object source, EventArgs eventArgs) { HttpApplication app = (HttpApplication) source; UrlMappingsSection urlMappings = RuntimeConfig.GetAppConfig().UrlMappings; // First check RawUrl string mappedUrl = urlMappings.HttpResolveMapping(app.Request.RawUrl); // Check Path if not found if (mappedUrl == null) mappedUrl = urlMappings.HttpResolveMapping(app.Request.Path); if (!string.IsNullOrEmpty(mappedUrl)) //&& IsDifferentFromCurrentUrl(mappedUrl, app.Context)) app.Context.RewritePath(mappedUrl, false); } // private static bool IsDifferentFromCurrentUrl(string url, HttpContext context) // { // Uri absUri; // if (!Uri.TryCreate(url, UriKind.Absolute, out absUri)) // { // if (url.StartsWith("~/")) // url = UrlPath.Combine(context.Request.Path, url.Substring(2)); // if (!Uri.TryCreate(context.Request.Url, url, out absUri)) // return true; // } // return Uri.Compare(absUri, context.Request.Url, UriComponents.AbsoluteUri, UriFormat.UriEscaped, StringComparison.OrdinalIgnoreCase) != 0; // } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TrackBar.cs
- Vector3DIndependentAnimationStorage.cs
- ListSortDescription.cs
- StringUtil.cs
- WebSysDescriptionAttribute.cs
- EntityViewGenerationConstants.cs
- PageParserFilter.cs
- Errors.cs
- propertyentry.cs
- CommonDialog.cs
- SelectionChangedEventArgs.cs
- TrackPointCollection.cs
- HelpEvent.cs
- XmlMtomReader.cs
- CompilationPass2TaskInternal.cs
- DoubleAnimationUsingPath.cs
- IdentityHolder.cs
- RepeatButtonAutomationPeer.cs
- SecureUICommand.cs
- SmiEventStream.cs
- SessionStateModule.cs
- XmlConverter.cs
- BuildDependencySet.cs
- MethodCallTranslator.cs
- SQLDoubleStorage.cs
- FormatPage.cs
- Switch.cs
- EditorPartChrome.cs
- LocatorBase.cs
- FocusWithinProperty.cs
- DataControlPagerLinkButton.cs
- EventPrivateKey.cs
- SortAction.cs
- CatalogPartChrome.cs
- GlobalItem.cs
- ModuleBuilderData.cs
- ErrorWrapper.cs
- TypedAsyncResult.cs
- ListItem.cs
- SqlErrorCollection.cs
- BaseProcessor.cs
- BooleanExpr.cs
- ExceptionRoutedEventArgs.cs
- TypeUtils.cs
- CommonBehaviorsSection.cs
- ReadOnlyHierarchicalDataSource.cs
- TcpStreams.cs
- PatternMatcher.cs
- Vector3DAnimationUsingKeyFrames.cs
- basenumberconverter.cs
- GeneratedView.cs
- ServiceDebugBehavior.cs
- DefaultBindingPropertyAttribute.cs
- BuildManager.cs
- ResXBuildProvider.cs
- PointAnimationUsingKeyFrames.cs
- WsatRegistrationHeader.cs
- LogicalMethodInfo.cs
- ParentUndoUnit.cs
- Assembly.cs
- WebRequestModulesSection.cs
- WindowsStatusBar.cs
- XmlUnspecifiedAttribute.cs
- ExtentKey.cs
- ISessionStateStore.cs
- FillRuleValidation.cs
- AssemblyCacheEntry.cs
- TableLayoutCellPaintEventArgs.cs
- TiffBitmapEncoder.cs
- StylusPointCollection.cs
- Oid.cs
- HtmlMeta.cs
- ByteAnimationBase.cs
- RtfControls.cs
- ClientSettingsStore.cs
- ResourceContainer.cs
- XamlParser.cs
- AttachedPropertyBrowsableAttribute.cs
- LambdaCompiler.cs
- SqlCharStream.cs
- QuadraticBezierSegment.cs
- BitmapSource.cs
- ToolStripItemRenderEventArgs.cs
- WebSysDisplayNameAttribute.cs
- Matrix.cs
- LinkLabel.cs
- webbrowsersite.cs
- OutputCacheProfileCollection.cs
- RepeatButtonAutomationPeer.cs
- XmlSchemaSimpleTypeRestriction.cs
- FamilyMap.cs
- SQLConvert.cs
- TextDecoration.cs
- XPathAncestorQuery.cs
- LinkGrep.cs
- NamespaceMapping.cs
- SmiRecordBuffer.cs
- TableItemProviderWrapper.cs
- Renderer.cs
- OrderByQueryOptionExpression.cs