HttpModule not working to mimic subdirectories, what to do then ?

Posted on 2005-04-23
Last Modified: 2010-07-27

I'm writing an HttpModule in order to replace the parameters in the
aspx pages to look like subdirectories.

i.e. instead of having :
I want to have :

While I was testing the functionality of HttpModule I was redirecting
from an ".aspx" file and it all was working fine.
Now that I switched to the real functionality, it just don't hit the
I mean, the call to "" does not fire the
application request in my HttpModule.

Here is my code :

private void Application_BeginRequest(Object source,
EventArgs e)
        HttpApplication application = (HttpApplication)source;
        HttpContext context = application.Context;
        string myPath = context.Request.

        string[] strs = ExtractParams(myPath);
        string vendor="";
        string category="";
      if (strs.Length == 2)
                vendor = strs[0];
                category = strs[1];


Now, if I put a break in the first line I see that the code is not even
hit when I have something like "". It was
working if I have "".
I guess I need to configure something, somewhere to call this code when
calling an URL with directories.

Thanks in advance.
Question by:fischermx
    LVL 6

    Expert Comment

    Have you configured the IIS configuraion - deselect "Verify that file exists" for aspnet_isapi.dll?
    LVL 1

    Author Comment

    > Have you configured the IIS configuraion - deselect "Verify that file exists" for aspnet_isapi.dll?
    I don't know which "wilcard" would match a directory entry/call.
    I added a dot ".", because if I put a slash "/", the ok button gets disabled, like if it is invalid.

    I think I'll change my question : Is that supposed to work ?
    I mean, using a custom HttpModule, can I use it in a way to fake a directory (i.e. not a file) ?
    I have to ask this, because in all samples I've seen, they always manage to use a file, "anything.aspx", not a directory "/anything/".

    LVL 1

    Author Comment

    Both the "*" and the "/" are not accepted as "extension" in the IIS configuration.

    The link shown, has an example again using a file, with extension, not a directoy.
    I guess, it should be possible somehow, see, they don't have real subdirectories, they are doing something similar, but hey, they are using PHP or Perl.
    LVL 6

    Accepted Solution

    Here is an article in MSDN It has lots of stuff but also includes request mapping.
    LVL 1

    Author Comment

    I saw that articles and I've seen other similars. At the end, they mentioned about the "problem" of showing a directory. Their solution is to actually create the directory and put a default.aspx, even empty page, there. I don't like that solution at all, what I want is to avoid having physical files, that's why we're doing dinamic pages.
    As I told, I've seen solutions on *nix platforms doing this, I still thinking would be a tweak to make this in a more elegant and easy way.
    LVL 1

    Author Comment

    Any other input on this ?
    I can't believe this can't be done with IIS/Asp.Net, the Apache guys must be laughing at me (us microsoft's users).
    There are sites that have structures like this :

    They never show an extension, this is what I am trying to achieve.
    I already have like this :

    But that's not what I want, I want to take ride of the default page.

    Thanks in advance.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now