Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.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# 使用asp.net和c重写Url#_C#_Asp.net - Fatal编程技术网

C# 使用asp.net和c重写Url#

C# 使用asp.net和c重写Url#,c#,asp.net,C#,Asp.net,您正在查找的资源已被删除、名称已更改或暂时不可用。 我在web.config文件中重写url后出现此错误 <location path="Speakers.aspx"> <system.webServer> <httpRedirect enabled="true" destination="localhost/Speakers" httpResponseStatus="Permanent"> </httpRedirect> </s

您正在查找的资源已被删除、名称已更改或暂时不可用。

我在web.config文件中重写url后出现此错误

<location path="Speakers.aspx">
<system.webServer>
  <httpRedirect enabled="true" destination="localhost/Speakers" httpResponseStatus="Permanent">
    </httpRedirect>
</system.webServer>


您可以在
中使用重写规则,如:

<rewrite>
   <rules>        
        <rule name="MyPage" enabled="true">
            <match url="^MyPage/$" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
            <action type="Rewrite" url="/MyPage.html" />
        </rule>
  </rules>
</rewrite>


上面的示例显示了当用户有URL/MyPage/

时MyPage.html页面的内容,在我看来这不像是重写。看起来您正在将所有流量重定向到本地主机/扬声器。你想达到什么目的?我想从url中删除扩展名,这就是为什么使用这个。。。扩展名已删除,但页面未显示我已尝试此操作。它向我显示了主机上的内部服务器错误。您在web.config中将其放在哪里?你能看到实际的错误吗?另外,也许给我看看你输入的确切代码,以防有问题。也可以添加通配符或使用正则表达式进行匹配等。在开始时,您需要将其放入内部,如我上面所述:)我按原样做了,但它显示为:您正在查找的资源已被删除、名称已更改或暂时不可用。