This post originated from an RSS feed registered with .NET Buzz
by Sudhakar Sadasivuni.
Original Post: Microsoft fixes Canonicalization issues with ASP.NET
Feed Title: {Sudhakar's .NET Dump Yard;}
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/ssadasivuni/rss.aspx
Feed Description: using Sudhakar.Dotnet.Blog.Main;
Microsoft has released tools & Code to check and fix the Canonicalization issue which I have mentioned in the previous post.
01. A code snippet to programmatically check for these issues in ASP.NET (To be added in Application_BeginRequest event handler of Global.asax file)
void Application_BeginRequest(object source, EventArgs e) { if (Request.Path.IndexOf('\\') >= 0 || System.IO.Path.GetFullPath(Request.PhysicalPath) != Request.PhysicalPath) { throw new HttpException(404, "not found"); } } 02. A HTTP Module to do this thing automatically for you..
The installer first extracts a file that is named Microsoft.Web.ValidatePathModule.dll. The installer then updates all the Machine.config files that exist on the system so that the files have an entry that looks like the following:
The installer then adds the Microsoft.Web.ValidatePathModule.dll file to the Global Assembly Cache (GAC).
Related KB Articles
887459 Programmatically check for canonicalization issues with ASP.NET 318785 Determine whether service packs are installed on the .NET Framework 887289 HTTP Module to check for canonicalization issues with ASP.NET