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
- NetworkInformationPermission.cs
- ServiceContractListItemList.cs
- XamlDesignerSerializationManager.cs
- OledbConnectionStringbuilder.cs
- IgnoreFlushAndCloseStream.cs
- TypeDelegator.cs
- ErrorInfoXmlDocument.cs
- KeyValuePairs.cs
- DigitShape.cs
- PageParser.cs
- ZipIOCentralDirectoryFileHeader.cs
- NameValueSectionHandler.cs
- SafeMemoryMappedViewHandle.cs
- DataSourceHelper.cs
- httpapplicationstate.cs
- ComplexLine.cs
- Codec.cs
- IPEndPointCollection.cs
- XmlHelper.cs
- InvalidProgramException.cs
- TimeoutTimer.cs
- BindToObject.cs
- SevenBitStream.cs
- DataGridViewRowPostPaintEventArgs.cs
- Compress.cs
- SqlWorkflowInstanceStoreLock.cs
- ImageMetadata.cs
- TextBoxBase.cs
- InternalPolicyElement.cs
- TextStore.cs
- NativeMethods.cs
- DataGridViewCellConverter.cs
- EditorZoneBase.cs
- AncillaryOps.cs
- PropertyFilterAttribute.cs
- InkPresenter.cs
- TextSpan.cs
- FormsAuthenticationUser.cs
- TextTreeTextElementNode.cs
- InternalSafeNativeMethods.cs
- TextInfo.cs
- BaseCodeDomTreeGenerator.cs
- RolePrincipal.cs
- GacUtil.cs
- ProfileManager.cs
- _NtlmClient.cs
- DetailsViewAutoFormat.cs
- CallInfo.cs
- StreamGeometry.cs
- ControlBindingsCollection.cs
- ControlDesigner.cs
- ToggleButtonAutomationPeer.cs
- ThreadStaticAttribute.cs
- SelectingProviderEventArgs.cs
- DispatcherExceptionEventArgs.cs
- SRGSCompiler.cs
- Geometry3D.cs
- ComboBoxRenderer.cs
- CookielessHelper.cs
- ToolStripItemClickedEventArgs.cs
- MetadataCollection.cs
- Matrix.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- X509SecurityTokenProvider.cs
- Thumb.cs
- InstanceOwner.cs
- UnmanagedBitmapWrapper.cs
- RectValueSerializer.cs
- SystemPens.cs
- StringAnimationUsingKeyFrames.cs
- MenuItemBinding.cs
- WindowPattern.cs
- WindowsPrincipal.cs
- ItemCollection.cs
- Serializer.cs
- MemberCollection.cs
- FontResourceCache.cs
- Trigger.cs
- ProcessModelInfo.cs
- ProjectionQueryOptionExpression.cs
- X509Utils.cs
- DataObjectFieldAttribute.cs
- DocumentXPathNavigator.cs
- Condition.cs
- KeyInterop.cs
- HttpAsyncResult.cs
- DataControlPagerLinkButton.cs
- GridItemPatternIdentifiers.cs
- SafeProcessHandle.cs
- _AutoWebProxyScriptWrapper.cs
- Header.cs
- ValidationRuleCollection.cs
- ReferenceConverter.cs
- DataBindEngine.cs
- Parser.cs
- UriParserTemplates.cs
- CompiledELinqQueryState.cs
- RequestCachingSection.cs
- HostExecutionContextManager.cs
- sqlnorm.cs