.NET Forum / ASP.NET / General / September 2007
httpModules in IIS 6?
|
|
Thread rating:  |
musosdev - 11 Sep 2007 12:40 GMT Hi
I've created a website in VS2005 with the in-built server, which uses an httpModule for UrlRewriting (using a hook into BeginRequest, doing everything by hand).
I've recently transfered the website to a production server (win2k3, iis6), and the UrlRewriting doesn't work.
Reading on the net, it seems IIS6 won't let you use httpModules. Is this correct?
What's the alternative for UrlRewriting? ISAPI filter? If so, how easy is it going to be to switch to that, and can I test that within the VS2005/Dev Server development environment??
Thanks,
Dan
musosdev - 11 Sep 2007 14:28 GMT Hi again,
Further investigation shows that it should be possible to add the UrlRewrite module and have it work in IIS6.
I'm wondering... I've read that you can put the .cs file in App_Code and it's dynamically compiled.
When moving to a production server, do I need to pre-compile the httpModule as a DLL file in order for it to work on IIS6?!
Thanks,
Dan
> Hi > [quoted text clipped - 15 lines] > > Dan Walter Wang [MSFT] - 12 Sep 2007 08:39 GMT Hi Dan,
Based on my understanding, the .cs file in App_Code should be able to work without pre-compiling it.
A quick guess on the issue is that the the URL you're trying to rewrite isn't passed from IIS to ASP.NET at all. Remember a resource must be mapped to be handled by aspnet_isapi.dll first, then ASP.NET could have a chance to process the request. Another thing to watch out is if IIS option "check for file exists" turned on or not: if it's turned on and the URL actually doesn't exist, the request will not also be passed to ASP.NET.
Regards, Walter Wang (wawang@online.microsoft.com, remove 'online.') Microsoft Online Community Support
================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
musosdev - 12 Sep 2007 08:50 GMT Hi Walter,
That thing about file exists checking sounds like a possibility. I'm using the UrlRewrite engine to allow me to give "friendly" URLs, and no... they don't exist.
I'll have a look and let you know,
Thanks
Dan
> Hi Dan, > [quoted text clipped - 18 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights. musosdev - 12 Sep 2007 10:02 GMT Walter,
I had a look in IIS6, but couldn't find the "file exists" option you describe - where do I find that?
However, I tried "Enable Parent Paths", and the URL rewrite seems to work!
Thanks, Again, I'll keep you updated as to the actual results when I know a bit more.
Cheers, Dan.
> Hi Dan, > [quoted text clipped - 18 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights. Walter Wang [MSFT] - 13 Sep 2007 04:52 GMT Hi Dan,
According to the help file:
-------------- Enable parent paths
Select to allow ASP pages to use relative paths to the parent directory of the current directory (paths using .. syntax).
If you enable this option, do not give parent directovies execute access because a script could execute an unauthorized program in a parent directory. -------------
I'm not sure why this option would have impact on your URL rewriting module.
For the "Verify that file exists" option:
In IIS manager:
1) Open properties dialog of your web application 2) on tab "Directory", click button "Configuration", this will bring up the "Application Configuration" dialog 3) Select the file extension that is handled by ASP.NET, for example, ".aspx", click button "Edit", this will bring up the "Add/Edit Application Extension Mapping" dialog 4) Uncheck the "Verify that file exists" checkbox
Regards, Walter Wang (wawang@online.microsoft.com, remove 'online.') Microsoft Online Community Support
================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
musosdev - 13 Sep 2007 12:50 GMT Hi again Walter
You're right, the "Enable Parent Paths" option didn't make any difference to the URL Rewriting - it must have been an anomaly. Very strange.
Unfortunately, I just had a look at IIS on the server, and "Verify file exists" is NOT checked for *.aspx - and yet it still doesn't work.
Is this something to do with me trying to pass a URL.. "http://website/ourwork/stories/my-story/" - the idea being that the url takes you to "http://website/story.aspx?id=xxx".
This works in the VS Devleopment Server perfectly, but I don't know how to make it work in IIS6?
Any ideas? Thanks again,
Dan
> Hi Dan, > [quoted text clipped - 35 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights. musosdev - 13 Sep 2007 15:24 GMT Hi Walter,
I've managed to get it working in a different way, using a Global.asax page, setting a .aspx page as the 404 to fire the aspnet engine.
Hopefully this will work when I move it to my web host!
Thanks for your help,
Dan
> Hi again Walter > [quoted text clipped - 54 lines] > > > > This posting is provided "AS IS" with no warranties, and confers no rights. Walter Wang [MSFT] - 14 Sep 2007 04:06 GMT Hi Dan,
The "verify file exists" option is set on each file extension mapping. For the url that is a directory, it will uses IIS's default document setting (such as Default.aspx, Default.htm, etc) to visit the document.
Anyway, since you're using url rewriting in ASP.NET, you might find following article useful:
#Tip/Trick: Url Rewriting with ASP.NET - ScottGu's Blog http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-wi th-asp-net.aspx
Regards, Walter Wang (wawang@online.microsoft.com, remove 'online.') Microsoft Online Community Support
================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|