473,289 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

HTTPModule not called for non-existant pages

I have earlier used an HttpModule that did URL rewrites on the BeginRequest
event.

Now I am trying to use the same module in a different application on a new
and upgraded machine (winxp sp2).

The Module is registered via Web.config. The registration is OK. When asking
for an existing .aspx page, the eventhandler is called as it should.

HOWEVER - if the request url is for a non-existant file, I get a 404 - file
not found error. The module is never called.
And if the url is only a path name e.g. http://server/some/path - and that
path does not allow browsing, then I get Directory Listing Denied error. If
browsing is allowed, I see the contents. The HttpModule BeginRequest method
is *not* called in these instances.

Any clues on what I may be missing here? or is this a change done through
sp2?

Thank you for your time!

-Inge
Nov 18 '05 #1
4 6170
Inge,
To do some work based on the requested page whether or not it exists, do
the work using the AuthorizeRequest event. I use this event to do URL
rewriting. Of course, there are still some restrictions. If you have the
default page set to default.aspx, and there is no default.aspx, then the
ASP.NET ISAPI won't ever be called from IIS. If you have a default page,
IIS handles translating a request to /subFolder/ into
/subFolder/default.aspx. Then the requested resource ends in .aspx and the
ASP.NET ISAPI takes over and will execute you code, so a situation may still
exist where IIS never calls ASP.NET.

Best regards,
Jeffrey Palermo

<in**@norway.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
I have earlier used an HttpModule that did URL rewrites on the BeginRequest event.

Now I am trying to use the same module in a different application on a new
and upgraded machine (winxp sp2).

The Module is registered via Web.config. The registration is OK. When asking for an existing .aspx page, the eventhandler is called as it should.

HOWEVER - if the request url is for a non-existant file, I get a 404 - file not found error. The module is never called.
And if the url is only a path name e.g. http://server/some/path - and that
path does not allow browsing, then I get Directory Listing Denied error. If browsing is allowed, I see the contents. The HttpModule BeginRequest method is *not* called in these instances.

Any clues on what I may be missing here? or is this a change done through
sp2?

Thank you for your time!

-Inge

Nov 18 '05 #2
Thank you for the reply.

If my memory is not failling me, I have had the handler be called for
nonexistant files, and also for folder names - without changing the default
document.

But what you say seems to be working - at least insofar as the HttpModule
being triggered when the request is for any kind of .aspx.

However, I have moved the default.aspx-file to the top of the
default-documents list (which *is* enabled). the handler is still not
executed if I only request http://myserver/mywebsite

If I put in a file of that name, it works (as expected) - but this requires
a default.aspx in every subfolder, in order to get the httpmodule to process
BeginRequest.

This is *not* the behaviour I experienced this spring :/

So I am still wondering that something might have changed e.g. with the
introduction of WinXP sp2

-Inge


"Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote in
message news:eu**************@TK2MSFTNGP15.phx.gbl...
Inge,
To do some work based on the requested page whether or not it exists,
do
the work using the AuthorizeRequest event. I use this event to do URL
rewriting. Of course, there are still some restrictions. If you have the
default page set to default.aspx, and there is no default.aspx, then the
ASP.NET ISAPI won't ever be called from IIS. If you have a default page,
IIS handles translating a request to /subFolder/ into
/subFolder/default.aspx. Then the requested resource ends in .aspx and
the
ASP.NET ISAPI takes over and will execute you code, so a situation may
still
exist where IIS never calls ASP.NET.

Best regards,
Jeffrey Palermo

<in**@norway.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
I have earlier used an HttpModule that did URL rewrites on the

BeginRequest
event.

Now I am trying to use the same module in a different application on a
new
and upgraded machine (winxp sp2).

The Module is registered via Web.config. The registration is OK. When

asking
for an existing .aspx page, the eventhandler is called as it should.

HOWEVER - if the request url is for a non-existant file, I get a 404 -

file
not found error. The module is never called.
And if the url is only a path name e.g. http://server/some/path - and
that
path does not allow browsing, then I get Directory Listing Denied error.

If
browsing is allowed, I see the contents. The HttpModule BeginRequest

method
is *not* called in these instances.

Any clues on what I may be missing here? or is this a change done through
sp2?

Thank you for your time!

-Inge


Nov 18 '05 #3
After looking at the behaviour of the old system running the code, the
behaviour is definitely different.

MSFT, can you look into this - it seems that there is a change in how
HttpModules are processed.

Old behaviour (WinXP, and W2K server w/IIS 5.0):
-registered an httpmodule in web.config
-the module implements BeginRequest
-the module rewrites any folder-only URLs (i.e. ending in / or without
an extension) to somepage.aspx
-default page for the virtual directory is (probably) set to
default.aspx

If I open http://myserver/, it is rewritten to http://myserver/somepage.aspx
If I open http://myserver/somesubdir, it is rewritten to
http://myserver/somesubdir/somepage.aspx
If I open http://myserver/someNonExistantSubDir, it is rewritten to
http://myserver/someNonExistantSubDir/somepage.aspx

This happens although there is no default.aspx page in any directories.

New behaviour (WinXP Sp2 IIS 5.1):
-registered an httpmodule in web.config
-the module implements BeginRequest
-the module rewrites any folder-only URLs (i.e. ending in / or without
an extension) to somepage.aspx
-default page for the virtual directory is set to default.aspx (or not,
behaviour is identical)

If I open http://myserver/, I get directory listing denied. id listing is
allowed, I get the contents. BeginRequest never called.
If I open http://myserver/somesubdir, I get directory listing denied.
BeginRequest never called.
If I open http://myserver/someNonExistantSubDir, I get 404 not found.
BeginRequest never called.

In this case, anything ending in .aspx is forwarded to the httpmodule - but
this is definitely different from my previously experienced behaviour.

So I am still wondering exactly what has happened, why - and if there is any
way to continue to rewrite non-.aspx (etc) urls in asp,net

Thank you!

-Inge
<in**@norway.net> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
Thank you for the reply.

If my memory is not failling me, I have had the handler be called for
nonexistant files, and also for folder names - without changing the
default document.

But what you say seems to be working - at least insofar as the HttpModule
being triggered when the request is for any kind of .aspx.

However, I have moved the default.aspx-file to the top of the
default-documents list (which *is* enabled). the handler is still not
executed if I only request http://myserver/mywebsite

If I put in a file of that name, it works (as expected) - but this
requires a default.aspx in every subfolder, in order to get the httpmodule
to process BeginRequest.

This is *not* the behaviour I experienced this spring :/

So I am still wondering that something might have changed e.g. with the
introduction of WinXP sp2

-Inge


"Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote
in message news:eu**************@TK2MSFTNGP15.phx.gbl...
Inge,
To do some work based on the requested page whether or not it exists,
do
the work using the AuthorizeRequest event. I use this event to do URL
rewriting. Of course, there are still some restrictions. If you have
the
default page set to default.aspx, and there is no default.aspx, then the
ASP.NET ISAPI won't ever be called from IIS. If you have a default page,
IIS handles translating a request to /subFolder/ into
/subFolder/default.aspx. Then the requested resource ends in .aspx and
the
ASP.NET ISAPI takes over and will execute you code, so a situation may
still
exist where IIS never calls ASP.NET.

Best regards,
Jeffrey Palermo

<in**@norway.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
I have earlier used an HttpModule that did URL rewrites on the

BeginRequest
event.

Now I am trying to use the same module in a different application on a
new
and upgraded machine (winxp sp2).

The Module is registered via Web.config. The registration is OK. When

asking
for an existing .aspx page, the eventhandler is called as it should.

HOWEVER - if the request url is for a non-existant file, I get a 404 -

file
not found error. The module is never called.
And if the url is only a path name e.g. http://server/some/path - and
that
path does not allow browsing, then I get Directory Listing Denied error.

If
browsing is allowed, I see the contents. The HttpModule BeginRequest

method
is *not* called in these instances.

Any clues on what I may be missing here? or is this a change done
through
sp2?

Thank you for your time!

-Inge



Nov 18 '05 #4
There was one (minor detail *cough* ) that has slipped my memory during the
months since I last did this -
I added an extension mapping for * to use the asp.net ISAPI filter. Thus I
was able to get my httpmodule to execute even though the document did not
exist etc..
Now, this is not possible on w2k3 server - but it can be done in a dedicated
box below - Wildcard Application Maps.

But in my current WinXP, I can't map * - neither is there a "Wildcard
Application maps".

It does however seem to work fine by specifying a map for ".*" - this is
accepted, and the httpModule is called.

So I guess there is no real change in behaviour (just a slight change in GUI
on the different OS's).

This also means that I just solved my problem - and that Jeffery is right in
stating that this shouldn't normally work. It works because I tell IIS to
shovel everything thrown at it, straight to asp.net for handling. This seems
to work, without hampering such things as serving of static content - but I
would be interested in hearing others opinions on sideeffects caused by this
kind of mapping :)

cheerio!

-Inge
<in**@norway.net> wrote in message
news:e1**************@TK2MSFTNGP11.phx.gbl...
After looking at the behaviour of the old system running the code, the
behaviour is definitely different.

MSFT, can you look into this - it seems that there is a change in how
HttpModules are processed.

Old behaviour (WinXP, and W2K server w/IIS 5.0):
-registered an httpmodule in web.config
-the module implements BeginRequest
-the module rewrites any folder-only URLs (i.e. ending in / or without
an extension) to somepage.aspx
-default page for the virtual directory is (probably) set to
default.aspx

If I open http://myserver/, it is rewritten to
http://myserver/somepage.aspx
If I open http://myserver/somesubdir, it is rewritten to
http://myserver/somesubdir/somepage.aspx
If I open http://myserver/someNonExistantSubDir, it is rewritten to
http://myserver/someNonExistantSubDir/somepage.aspx

This happens although there is no default.aspx page in any directories.

New behaviour (WinXP Sp2 IIS 5.1):
-registered an httpmodule in web.config
-the module implements BeginRequest
-the module rewrites any folder-only URLs (i.e. ending in / or without
an extension) to somepage.aspx
-default page for the virtual directory is set to default.aspx (or not,
behaviour is identical)

If I open http://myserver/, I get directory listing denied. id listing is
allowed, I get the contents. BeginRequest never called.
If I open http://myserver/somesubdir, I get directory listing denied.
BeginRequest never called.
If I open http://myserver/someNonExistantSubDir, I get 404 not found.
BeginRequest never called.

In this case, anything ending in .aspx is forwarded to the httpmodule -
but this is definitely different from my previously experienced behaviour.

So I am still wondering exactly what has happened, why - and if there is
any way to continue to rewrite non-.aspx (etc) urls in asp,net

Thank you!

-Inge
<in**@norway.net> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
Thank you for the reply.

If my memory is not failling me, I have had the handler be called for
nonexistant files, and also for folder names - without changing the
default document.

But what you say seems to be working - at least insofar as the HttpModule
being triggered when the request is for any kind of .aspx.

However, I have moved the default.aspx-file to the top of the
default-documents list (which *is* enabled). the handler is still not
executed if I only request http://myserver/mywebsite

If I put in a file of that name, it works (as expected) - but this
requires a default.aspx in every subfolder, in order to get the
httpmodule to process BeginRequest.

This is *not* the behaviour I experienced this spring :/

So I am still wondering that something might have changed e.g. with the
introduction of WinXP sp2

-Inge


"Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote
in message news:eu**************@TK2MSFTNGP15.phx.gbl...
Inge,
To do some work based on the requested page whether or not it exists,
do
the work using the AuthorizeRequest event. I use this event to do URL
rewriting. Of course, there are still some restrictions. If you have
the
default page set to default.aspx, and there is no default.aspx, then the
ASP.NET ISAPI won't ever be called from IIS. If you have a default
page,
IIS handles translating a request to /subFolder/ into
/subFolder/default.aspx. Then the requested resource ends in .aspx and
the
ASP.NET ISAPI takes over and will execute you code, so a situation may
still
exist where IIS never calls ASP.NET.

Best regards,
Jeffrey Palermo

<in**@norway.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
I have earlier used an HttpModule that did URL rewrites on the
BeginRequest
event.

Now I am trying to use the same module in a different application on a
new
and upgraded machine (winxp sp2).

The Module is registered via Web.config. The registration is OK. When
asking
for an existing .aspx page, the eventhandler is called as it should.

HOWEVER - if the request url is for a non-existant file, I get a 404 -
file
not found error. The module is never called.
And if the url is only a path name e.g. http://server/some/path - and
that
path does not allow browsing, then I get Directory Listing Denied
error.
If
browsing is allowed, I see the contents. The HttpModule BeginRequest
method
is *not* called in these instances.

Any clues on what I may be missing here? or is this a change done
through
sp2?

Thank you for your time!

-Inge



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve Donnelly | last post by:
I have an HttpModule that gets the SessionStateModule and registers for the Start and End events. Global receives both Start and End events (both timeout and when Session.Abandon() is called),...
1
by: Ryan Cromwell | last post by:
I have written an httpModule for use in our test environment. If a user goes to http://testserver/SomeApplication/MyPage.aspx it will resolve to the latest version of that application deployed:...
4
by: Chip Page | last post by:
Hello, In my top-level Web.config, I had added a number of httpModules. In a particular sub-directory in the application, I wish to prevent one of the HttpModules from executing. My attempts...
3
by: Adam | last post by:
Its my understanding that in asp.net 2.0 you can write an httpmodule that will acts as a wildcard handler and pass requests on to the proper engine, for instance, asp or perl for example, In the...
2
by: Simon-Pierre Jarry | last post by:
Hi, I created a custom HttpModule for managing the security of my application. in "Init" sub, I regsiter the events doing that : Public Sub Init(ByVal context As System.Web.HttpApplication)...
0
by: Mike Schilling | last post by:
(I've asked this on the C# newsgroup; I'm hoping someone over here might have an idea.) We have a C# application running under ASP.NET. It wasn't written using any VS.NET magic; all of the call...
0
by: Si | last post by:
I'm writing an HttpModule to intecept web method calls and retrieve custom authentication information from their SOAP headers. I have the httpModules tag in web.config and that appears to be...
2
by: walter | last post by:
Hi there, I know there is pool of HttpApplications, and for each request coming in, HttpRuntime will dedicate one from pool to serve the request. My questions are : 1. since HttpModule is plug...
0
by: Thomas | last post by:
in .net 1.1 we successfully use a HttpModule to catch 404 / 403.1 html errors. after migrating to .net 2.0, this modules is broken in a very, very strange way. we have defined a wildcard...
3
by: Dan Sikorsky | last post by:
I use an HttpModule that handles unhandled exceptions from an .aspx.cs page by logging to a text file, logging to the event viewer's app log, and sending out an email to the website developer and...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.