473,837 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6207
Inge,
To do some work based on the requested page whether or not it exists, do
the work using the AuthorizeReques t 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.ne t> wrote in message
news:ep******** ******@TK2MSFTN GP12.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.c om/weblog/jpalermo> wrote in
message news:eu******** ******@TK2MSFTN GP15.phx.gbl...
Inge,
To do some work based on the requested page whether or not it exists,
do
the work using the AuthorizeReques t 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.ne t> wrote in message
news:ep******** ******@TK2MSFTN GP12.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.ne t> wrote in message
news:em******** ******@TK2MSFTN GP09.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.c om/weblog/jpalermo> wrote
in message news:eu******** ******@TK2MSFTN GP15.phx.gbl...
Inge,
To do some work based on the requested page whether or not it exists,
do
the work using the AuthorizeReques t 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.ne t> wrote in message
news:ep******** ******@TK2MSFTN GP12.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.ne t> wrote in message
news:e1******** ******@TK2MSFTN GP11.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.ne t> wrote in message
news:em******** ******@TK2MSFTN GP09.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.c om/weblog/jpalermo> wrote
in message news:eu******** ******@TK2MSFTN GP15.phx.gbl...
Inge,
To do some work based on the requested page whether or not it exists,
do
the work using the AuthorizeReques t 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.ne t> wrote in message
news:ep******** ******@TK2MSFTN GP12.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
1979
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), but my module receives only the Start event. SessionMode is InProc. Commenting out Global's Session_End() does not have any effect. Does anyone know why Session_End() is not called?
1
1658
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: http://testserver/SomeApplication.1.0.10.0/MyPage.aspx, for instance. Problem is, the httpModule doesn't get called because http://testserver/SomeApplication doesn't exist. I assume this is because IIS is spitting it back, but I am not sure. ...
4
1614
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 using the <remove> element to remove the HttpModule for a subdir have not worked. ---- My top-level Web.config contains :
3
2886
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 past I believe if it wasn't an aspx file, things didnt work right. Can anyone provide input if this really is the case now?
2
2146
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) Implements IHttpModule.Init httpApp = context
0
1015
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 the System.Web are made explicitly. It uses ..NET 1.1; no other version of the framework is present on the machine. There are two web.config files: the one at the top level specifies an HttpModule, one in a subdirectory specifies an HttpHandler....
0
2232
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 getting parsed okay. If I mangle the type attribute or try to add the module twice I get configuration errors as expected. So I "assume" that the module is getting loaded. Init() is not getting called, though, when I make a call to a web method...
2
4591
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 into the process, does each instance of HttpApplication keep its own set of HttpModule instance or HttpModules are shared among all HttpApplication instances? 2. In case of HttpApplication keep its own set of HttpModule, does the HttpModule...
0
1419
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 applicatio mapping to the .net 2.0 isapi dll: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll with "check if file exists" disabled. the HttpModule "RedirectMissing" is called upon every request to the
3
2246
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 any interested parties. Finally, a user friendly page (GenericError.aspx) is Redirected To. My Page_Load event has no code, so when the page is unavailable, (for instance, the website is down), an unhandled event is generated and my HttpModule...
0
9833
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10617
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10263
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6989
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5666
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4469
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.