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# web.config正在将文件夹名重定向到文件名_C#_Asp.net_Web Config_Url Redirection - Fatal编程技术网

C# web.config正在将文件夹名重定向到文件名

C# web.config正在将文件夹名重定向到文件名,c#,asp.net,web-config,url-redirection,C#,Asp.net,Web Config,Url Redirection,我在windows server上托管了我的站点。当用户浏览sitename.com/foldername时,我试图将用户重定向到web服务器内的.html文件/ 我应该在web.config文件中添加或修改什么标记来实现这一点。我在linux主机服务器上工作时使用了.htaccess文件。首先必须为iis安装url重写扩展,然后在webconfig文件中使用此配置: <system.webServer> <rewrite> <rules> <

我在windows server上托管了我的站点。当用户浏览sitename.com/foldername时,我试图将用户重定向到web服务器内的.html文件/


我应该在web.config文件中添加或修改什么标记来实现这一点。我在linux主机服务器上工作时使用了.htaccess文件。

首先必须为iis安装url重写扩展,然后在webconfig文件中使用此配置:

<system.webServer>
<rewrite>
  <rules>
    <rule name="redirecting to html file" stopProcessing="true">
      <match url="sitename.com/foldername/" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="your html file address" />
    </rule>
  </rules>
</rewrite>


是否知道azure webapp默认安装了“用于iis的url重写扩展”?请转到此链接以在azure webapp中进行url重写。。