I hit my 5000 page view today.
Also I will be posting some of this to the new and upcoming HarborObjects.com site.
Here you will find my notes, comments, rants, unrelated topics. Don't expect me to always stay on topic, and expect grammar/spelling errors.
Thursday, December 28, 2006
URL Rewrite for virtual paths
Labels:
.NET
Most .NET examples for URL rewriting use HTTPModules or HTTPHandlers rather than actual ISAPI filters. (Yes, there is still a diffrence.)
The big problem with this is the fact that the URL calls for the rewrites have to trigger a .NET call to the ASP.NET ISAPI filter to even have your HTTPModule or HTTPHandler to be launched.
That means that your URL file extension needs to be .aspx, .asmx, .asax, .ascx, .ashx, .axd. But what if you want a redirect based on .gif, .swf, .xml? Sorry you are out of luck. But not realy.
If your rewrite code is generic enough, you can rewrite these too by telling IIS to use the ASP.NET Isapi filter on these files.
Step by step below:
The big problem with this is the fact that the URL calls for the rewrites have to trigger a .NET call to the ASP.NET ISAPI filter to even have your HTTPModule or HTTPHandler to be launched.
That means that your URL file extension needs to be .aspx, .asmx, .asax, .ascx, .ashx, .axd. But what if you want a redirect based on .gif, .swf, .xml? Sorry you are out of luck. But not realy.
If your rewrite code is generic enough, you can rewrite these too by telling IIS to use the ASP.NET Isapi filter on these files.
Step by step below:
- From IIS console, go to your application directory and open the properties window.
- Go to the "Home Directory" tab
- Click on "Configuration" Button
- On the "Mappings" tab you will set your Isapi filters.
- We will now map SWF to the ASP.NET Isapi filter.
- Click Add
- Enter "c:\winnt\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" into the executable path. (This is for the 2.0 framework.)
- Type your extension like ".swf". No leading wild cards. Do not forget to put in the leading period before the actual extension.
- Leave script engine checked.
- Uncheck "Verify if file exists"
- As a minimum, verb should be get, but with static items, I may put all, and use the rewriter to block writes. Then I can control posting by user rights.
That is it. It only took me too many hours in one day to discover all of this.
Note: This was ASP.NET 2.0 and IIS 6.0. I have not tried this on the 3.0 framework or on any pre-releases of the IIS 7.0.
Wednesday, December 20, 2006
Happy Holidays
Labels:
Personal
Ok, for those of you who are sick of being PC... Merry Christmas and Happy New Year.
This will be the closest thing we get to a December blog.
I know that I have been slacking off on my technical stuff. End of year comes with a penalty.
This will be the closest thing we get to a December blog.
I know that I have been slacking off on my technical stuff. End of year comes with a penalty.
Subscribe to:
Posts (Atom)