404 error page customization in Web Apps (Windows)

尚典 青村 1 Reputation point
2021-11-16T07:04:07.007+00:00

現在App Serviceを利用しており、エラーページ(404)をWebAppsの規定のコンテンツではなく、新規で作成したコンテンツを表示させたいと考えております。
作成した404コンテンツの配置場所、また指定したコンテンツを表示させるための設定等をご教示いただけますでしょうか。

"
I am currently using the App Service and would like to display the newly created content on the error page (404) instead of the specified content of WebApps.
Could you please tell me the location of the created 404 content and the settings for displaying the specified content?
"
Changed title from "Web Apps(Windows)での404エラーページカスタマイズ"
to " 404 error page customization in Web Apps (Windows)"

Edit:
Adding English translation/ to receive insights from the community

404 error page customization in Web Apps (Windows)

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,956 questions
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 22,521 Reputation points Microsoft Employee
    2021-11-16T14:11:46.17+00:00

    @尚典 青村 , Thanks for the great question.

    As mentioned in the UserVoice “This is something we would like to bring in the future, but we cannot provide a timeline at this time.”-You may upvote the post.

    For customization, you may edit web.config file located in D:\home\site\wwwroot folder.

    You may try this code (copied below), answer from a similar SO discussion thread.
    For more details on customErrors flag.

    <?xml version="1.0" encoding="UTF-8"?>  
    <configuration>  
        <system.webServer>  
            <httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">  
                <remove statusCode="404" subStatusCode="-1" />  
                <error statusCode="404" path="/404.asp" responseMode="ExecuteURL" />  
            </httpErrors>  
        </system.webServer>  
    </configuration>  
    

    If your requirement fits, you may use Application Gateway, which allows you to create custom error pages instead of displaying default error pages. You can use your own branding and layout using a custom error page. Checkout this doc ‘custom error’ section for more details.

    0 comments No comments

  2. sadomovalex 3,626 Reputation points
    2021-11-16T15:10:35.67+00:00

    if you created web app using ASP.Net runtime stack than you may do that in the same way as for regular ASP.Net application: Implementing a Custom Error page on an ASP.Net website.

    0 comments No comments