httpModules in IIS 6?

G

Guest

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
 
G

Guest

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
 
W

Walter Wang [MSFT]

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 ([email protected], 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.
 
G

Guest

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
 
G

Guest

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.
 
W

Walter Wang [MSFT]

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 ([email protected], 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.
 
G

Guest

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
 
G

Guest

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


musosdev said:
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

"Walter Wang [MSFT]" said:
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 ([email protected], 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.
 
W

Walter Wang [MSFT]

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 ([email protected], 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top