Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 自定义404 w/参考URL_C#_Asp.net_Vb.net - Fatal编程技术网

C# 自定义404 w/参考URL

C# 自定义404 w/参考URL,c#,asp.net,vb.net,C#,Asp.net,Vb.net,NET用于将用户发送到我的自定义404页面的重定向,清除了referringURL <customErrors defaultRedirect="Error.aspx" mode="RemoteOnly"> <error statusCode="404" redirect="Error404.aspx"/> </customErrors> 在我当前的配置中,Error.aspx确实收到aspxerrorpath查询字符串。但是,我在Error404

NET用于将用户发送到我的自定义404页面的重定向,清除了referringURL

<customErrors defaultRedirect="Error.aspx" mode="RemoteOnly">
     <error statusCode="404" redirect="Error404.aspx"/>
</customErrors>
在我当前的配置中,Error.aspx确实收到aspxerrorpath查询字符串。但是,我在Error404.aspx上没有参考URL

其目的是在Google Analytics内部进行报告


提前谢谢

我还将尝试使用


我见过这样的例子。customErrors和httpErrors errorMode=Custom之间有什么区别?我不太记得了,因为我已经从我们现有的一个应用程序中取出了这个部分,但是如果我没记错的话,这两个部分都必须存在,才能在IIS上工作。很少有应用严重依赖这种机制,IIS会重定向到ErrorHandler.aspx?404;http://referringUrlHere.The 应用程序在web.config中已经有了httpErrors errorMode=Custom,谢谢Wiktor!看一看。你可以超载一个错误。
/Error404.aspx?referrer=/referringURLhere.aspx
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <httpErrors errorMode="Custom">
        <remove statusCode="404" subStatusCode="-1"/>
        <error statusCode="404" prefixLanguageFilePath="" path="/Error.aspx" responseMode="ExecuteURL"/>
        </httpErrors>
    </system.webServer>