Asp.net 如何创建以'#';

Asp.net 如何创建以'#';,asp.net,iis,Asp.net,Iis,我正在尝试在web.config文件中创建一个以“#”字符开头的重写规则 我有以下URL“www.example.com/#abcd=”。此URL需要重定向到“www.example.com/myfolder/mypage.html” 我尝试过以下规则,但似乎没有一个有效 <rule name="myRedirect" stopProcessing="true" patternSyntax="ExactMatch" > <match url="##abcd=http:/

我正在尝试在web.config文件中创建一个以“#”字符开头的重写规则

我有以下URL“www.example.com/#abcd=”。此URL需要重定向到“www.example.com/myfolder/mypage.html”

我尝试过以下规则,但似乎没有一个有效

<rule name="myRedirect" stopProcessing="true" patternSyntax="ExactMatch" >
    <match url="##abcd=http://www.example.com/myfolder/mypage" ignoreCase="false"/>
    <action type="Redirect" url="myfolder/mypage.html" appendQueryString="true" redirectType="Permanent" />
  </rule>

以及以下

<rule name="myNewRedirect" stopProcessing="true">
        <match url="(.*)"/>
        <conditions>
            <add input="{QUERY_STRING}" pattern="cbp=http://www.example.com/myfolder/mypage" />
        </conditions>
        <action type="Redirect" url="/myfolder/mypage.html" redirectType="SeeOther"/>
      </rule>


但是上述所有操作都不起作用。

不可能基于哈希字符串执行重定向。浏览器不会将该部分(哈希后的所有内容)传输到服务器

<rule name="myRedirect" stopProcessing="true" patternSyntax="ExactMatch" >
    <match url="##abcd=http://www.example.com/myfolder/mypage" ignoreCase="false"/>
    <action type="Redirect" url="myfolder/mypage.html" appendQueryString="true" redirectType="Permanent" />
  </rule>
它被称为片段标识符,仅为客户端。这在任何语言中都是不可能的,除非您使用某种浏览器实现(或软件)将URL的这一部分发送到服务器。参考: