check file exists RRS feed

  • Question

  • User33581331 posted


    I would like to count the pictures that are downloaded from a spicific web directory, so I did one of many examples using an httpmodule to serve a picture other than the one asked by the client.

    It works fine, except from when browsing to a file that doesn't exist. Whatever file I browse to that exists it gives me back an image I have set up to in the httpmodule. But if I browse to a file (picture) that doesn't exist I get a resource not found error.

    I have mapped the .gif and .jpg to the asp_isapi dll for the spicific web directory and unchecked the "check if file exists" but still I get the error

    Is there anything else I am supposed to do except for the mapping?

    I am using IIS 6 on an Sql Server 2003

    Here are the three very simple lines in the httpmodule (it's a .dll created in VS 2005)

    Dim app As System.Web.HttpApplication = CType(sender, System.Web.HttpApplication)

    app.Response.ContentType = "image/gif"



    Thank you

    Tuesday, March 20, 2007 4:29 PM

All replies

  • User2111920582 posted
    If you navigate to a file that doesn't exist, shouldn't you get an error? I think you should.
    Wednesday, March 21, 2007 11:09 AM
  • User33581331 posted

    Since I write the file logo.gif to the http output first thing in the Init Sub, shouldn't I get the logo.gif file back whether the file I am accessing is there or not?


    Wednesday, March 21, 2007 4:41 PM