开发者

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

开发者 https://www.devze.com 2023-02-19 04:10 出处:网络
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.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消