gpt4 book ai didi

iis-7 - 经典 ASP - 自定义错误页面

转载 作者:行者123 更新时间:2023-12-01 02:21:03 24 4
gpt4 key购买 nike

我使用 IIS7 全新安装了 Windows Server 2008。在那里,我安装了“Classic ASP”并将调试选项“Send Errors To Browser”更改为 True。

1.

我创建了一个包含 2 个文件的目录:

-- C:\inetpub\wwwroot\stadtbibliothek
- index.asp -> <% Response.Write "Hello World" %>
- 500-100.asp -> <% Response.Write "Error" %>

我将目录转换为应用程序并分配了我创建的应用程序池(.net 版本:无托管代码,管道代码:经典)。

然后我从远程客户端( http://svr-name.domain/stadtbibliothek/ )测试了页面,“Hello World”出现了。

2.

我在 index.asp 文件中添加了一个错误,在“stadtbibliothek”文件夹中添加了一个 web.config 文件(根目录中没有):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="index.asp" />
</files>
</defaultDocument>
<httpErrors>
<remove statusCode="500" subStatusCode="100" />
<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>

解决方案:

结果我只需要在路径中包含文件夹名称:
<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/stadtbibliothek/error.asp" responseMode="ExecuteURL" />
感谢您的建议!

最佳答案

来自 documentation :

path: Required string attribute.

Specifies the file path or URL that is served in response to the HTTP error specified by the statusCode and subStatusCode attributes. If you choose the File response mode, you specify the path of the custom error page. If you choose the ExecuteURL response mode, the path has to be a server relative URL (for example, /404.htm). If you choose the Redirect response mode, you have to enter an absolute URL (for example, www.contoso.com/404.htm).



尝试更改此行:
<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />

对此:
<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/stadtbibliothek/error.asp" responseMode="ExecuteURL" />

关于iis-7 - 经典 ASP - 自定义错误页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20466056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com