Vilx-
Vilx-

Reputation: 106920

Can I set an image to be a 404 page for a specific folder in ASP.NET?

I have a folder on my webserver that contains images (filetype icons, actually). I would like to serve a default image (default filetype icon) whenever a nonexistent file is requested. My idea was to set up the default icon as a custom 404 page. Can this be done?

Upvotes: 0

Views: 91

Answers (1)

Furqan Hameedi
Furqan Hameedi

Reputation: 4400

Yes , put the config in that folder and provide appropriate entries in it.

    <customErrors mode="RemoteOnly">
        <error statusCode="404" redirect="/maintenance/Error404.html"/>
    </customErrors>

Error404.html should contain that image. Another way to achieve the same is to write a custom module for that.

Upvotes: 1

Related Questions