Virtual directory woes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    #1

    Virtual directory woes

    Hi all,

    Using C# .NET 1.1

    I am creating a CMS type of application. So far so good. I have a templating
    system in place that works fantastically. I can remap non-real files and
    folders and get the CMS system to handle it. This is working quite cool.

    I have a 404 handler in place which helps to manage the non-real files and
    folders. This is done at IIS level rather than .NET level. There is a reason
    for this, but that is of no consequence to my problem, but it is worth
    mentioning.

    In IIS, I have changed the default document to call default.aspx and removed
    all others. The idea being that the .NET processor should get called when I
    go into the cms folder...

    such like...
    http://localhost/cms-folder (note, cms-folder is the virtual directory
    mapped to a real directory)

    should call (due to IIS configuration)


    However, I don't want to have to have a default.aspx. The CMS should handle
    it like it does with subfolders. If I was to call for example
    http://localhost/cms-folder/subfolder then my CMS picks up on this and
    handles it correctly (using the 404 handler). However, if I just do
    http://localhost/cms-folder the .NET process is not even called, even though
    my default file is a .aspx page (even though it is non-existant)

    I currently get "Directory Listing Denied" and a 403 error in my log files.
    Do I need to map the 403:14 custom error in IIS to my ASPX processor?

    I will be unable to create any ISAPIs as the destination of this project
    will be on a shared host, where they do not allow ISAPIs to be installed,
    however, I can get certain other configuration changes within IIS done if I
    need them.

    How can I get this to work?

    Thanks.
    --
    Best regards,
    Dave Colliver.

    ~~
    http://www.FOCUSPortals.com - Local franchises available


  • Alexey Smirnov

    #2
    Re: Virtual directory woes

    On Mar 29, 12:00 pm, "David"
    <david.colliver .N...@revilloc. REMOVETHIS.comw rote:
    Hi all,
    >
    Using C# .NET 1.1
    >
    I am creating a CMS type of application. So far so good. I have a templating
    system in place that works fantastically. I can remap non-real files and
    folders and get the CMS system to handle it. This is working quite cool.
    >
    I have a 404 handler in place which helps to manage the non-real files and
    folders. This is done at IIS level rather than .NET level. There is a reason
    for this, but that is of no consequence to my problem, but it is worth
    mentioning.
    >
    In IIS, I have changed the default document to call default.aspx and removed
    all others. The idea being that the .NET processor should get called when I
    go into the cms folder...
    >
    such like...http://localhost/cms-folder(note, cms-folder is the virtual directory
    mapped to a real directory)
    >
    should call (due to IIS configuration)http://localhost/cms-folder/default.aspx
    >
    However, I don't want to have to have a default.aspx. The CMS should handle
    it like it does with subfolders. If I was to call for examplehttp://localhost/cms-folder/subfolderthen my CMS picks up on this and
    handles it correctly (using the 404 handler). However, if I just dohttp://localhost/cms-folderthe .NET process is not even called, even though
    my default file is a .aspx page (even though it is non-existant)
    >
    I currently get "Directory Listing Denied" and a 403 error in my log files.
    Do I need to map the 403:14 custom error in IIS to my ASPX processor?
    >
    I will be unable to create any ISAPIs as the destination of this project
    will be on a shared host, where they do not allow ISAPIs to be installed,
    however, I can get certain other configuration changes within IIS done if I
    need them.
    >
    How can I get this to work?
    >
    Thanks.
    --
    Best regards,
    Dave Colliver.http://www.AshfieldFOCUS.com
    ~~http://www.FOCUSPortals.com- Local franchises available
    Either you should add a custom handler for the 403-error

    <error statusCode="403 " redirect="/redirect.aspx" />
    <error statusCode="404 " redirect="/redirect.aspx" />

    or consider the URL Rewriting (but in your case, you need to be able
    to change IIS to pass all requests through to the ASP.NET - not sure
    if you can do it on a shared host)

    Comment

    • David

      #3
      Re: Virtual directory woes

      Thanks... but I don't think the error handlers would get called as it
      doesn't even appear to be calling the .NET process.

      I already have URL-Rewriting in place and that works great.

      I can get certain configurations changed in IIS on the shared host that I
      need, for example, I can get .html mapped to .net, I can get 404 mapped to a
      404 handler, but I cannot get isapi controls installed.

      If I need to make a change to IIS, what would I need to do? I will have a go
      at changing my 403:14 error code on my local machine to see what happens,
      but I would have thought that at least making the default page a .NET page
      would have kick started the .NET process.

      --
      Best regards,
      Dave Colliver.

      ~~
      http://www.FOCUSPortals.com - Local franchises available
      Either you should add a custom handler for the 403-error
      >
      <error statusCode="403 " redirect="/redirect.aspx" />
      <error statusCode="404 " redirect="/redirect.aspx" />
      >
      or consider the URL Rewriting (but in your case, you need to be able
      to change IIS to pass all requests through to the ASP.NET - not sure
      if you can do it on a shared host)
      >

      Comment

      • Alexey Smirnov

        #4
        Re: Virtual directory woes

        On Mar 29, 12:52 pm, "David"
        <david.colliver .N...@revilloc. REMOVETHIS.comw rote:
        Thanks... but I don't think the error handlers would get called as it
        doesn't even appear to be calling the .NET process.
        I didn't try it with 403, and according to Microsoft it should work


        I already have URL-Rewriting in place and that works great.
        This is not the URL-Rewriting I meant

        Look at the following article
        http://msdn2.microsoft.com/en-us/library/ms972974.aspx

        Comment

        • David

          #5
          Re: Virtual directory woes

          Changing the 403:14 to any .aspx page seems to handle it.

          However, with a combination of 403 to redirect to a non-existant page and a
          404 to handle non-existant pages (which works as I can see), I get in my log
          files...

          2007-03-29 11:10:38 127.0.0.1 - W3SVC1 DAVID 127.0.0.1 80 GET
          /cms/default.aspx 403;http://localhost/cms/ 200 0 4176 284

          (line edited for brevity)

          As you can see, default.aspx causes a 403, which causes a 404, which looks
          like it ultimately ends in a 200 being sent to the browser. Will a search
          engine like google be able to pick up on the hack and drop the listings? (It
          is not a hack to fool the search engine. It is purely so that the CMS will
          work without having to install isapi's on the shared host)

          --
          Best regards,
          Dave Colliver.

          ~~
          http://www.FOCUSPortals.com - Local franchises available
          "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
          news:ezsVoBfcHH A.3976@TK2MSFTN GP06.phx.gbl...
          Thanks... but I don't think the error handlers would get called as it
          doesn't even appear to be calling the .NET process.
          >
          I already have URL-Rewriting in place and that works great.
          >
          I can get certain configurations changed in IIS on the shared host that I
          need, for example, I can get .html mapped to .net, I can get 404 mapped to
          a 404 handler, but I cannot get isapi controls installed.
          >
          If I need to make a change to IIS, what would I need to do? I will have a
          go at changing my 403:14 error code on my local machine to see what
          happens, but I would have thought that at least making the default page a
          .NET page would have kick started the .NET process.
          >
          --
          Best regards,
          Dave Colliver.

          ~~
          http://www.FOCUSPortals.com - Local franchises available
          >
          >Either you should add a custom handler for the 403-error
          >>
          ><error statusCode="403 " redirect="/redirect.aspx" />
          ><error statusCode="404 " redirect="/redirect.aspx" />
          >>
          >or consider the URL Rewriting (but in your case, you need to be able
          >to change IIS to pass all requests through to the ASP.NET - not sure
          >if you can do it on a shared host)
          >>
          >
          >

          Comment

          • David

            #6
            Re: Virtual directory woes

            Looking at that page, the 403 that I was experiencing wasn't even getting to
            the .net handler, so the sample on gotdotnet will not work for that
            situation. I had to change IIS 403:14 handler to specifically call a .aspx
            page to get it into the .net handler. The situation of this problem is
            that...

            1. A real directory is mapped as the virtual directory in the IIS. The IIS
            has default page set to .NET page that doesn't actually exist. The .NET
            handler should be called but isn't.
            2. With URL rewriting and 404 handling, I can have non-existant sub folders
            under the real directory. This works brilliantly. I can do calls like
            http://localhost/cms/not-real-directory and get a return, even though I am
            not calling a .NET page. I would have thought with the same configuration,
            the non-existing default page would have worked.
            3. the non-existing default.aspx page in the root doesn't even fire the .net
            handler. It just returns a directory access forbidden error, which is a 403
            (specifically, 403:14).
            4. Had to trap that in IIS to point to a non-existing aspx page (which
            should have been handled in what I did in step 1, but didn't work).


            The URL rewriting article is similar to what I am doing. I have hackable
            URLs which I am handling a different way.

            All is working now. Maybe not the best way, but it works.

            Thanks.
            --
            Best regards,
            Dave Colliver.

            ~~
            http://www.FOCUSPortals.com - Local franchises available
            "Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
            news:1175166866 .248168.274110@ o5g2000hsb.goog legroups.com...
            On Mar 29, 12:52 pm, "David"
            <david.colliver .N...@revilloc. REMOVETHIS.comw rote:
            >Thanks... but I don't think the error handlers would get called as it
            >doesn't even appear to be calling the .NET process.
            >
            I didn't try it with 403, and according to Microsoft it should work

            >
            >
            >I already have URL-Rewriting in place and that works great.
            >
            This is not the URL-Rewriting I meant
            >
            Look at the following article
            http://msdn2.microsoft.com/en-us/library/ms972974.aspx
            >

            Comment

            • Alexey Smirnov

              #7
              Re: Virtual directory woes

              On Mar 29, 1:19 pm, "David"
              <david.colliver .N...@revilloc. REMOVETHIS.comw rote:
              As you can see, default.aspx causes a 403, which causes a 404, which looks
              like it ultimately ends in a 200 being sent to the browser. Will a search
              engine like google be able to pick up on the hack and drop the listings? (It
              is not a hack to fool the search engine. It is purely so that the CMS will
              work without having to install isapi's on the shared host)
              >
              I'm not sure how you do that (what means the "404 handler"?), but it
              seems that the client receives 200 response header only. Otherwise,
              you would get 403-error in your browser.

              To check the response headers I'm using FireFox with an additional
              plug-in (Web-developer Toolbar)

              Comment

              Working...