简体   繁体   English

在ASP.NET中重写规则

[英]Rewrite Rule In ASP.NET

I use a rewrite rule in IIS in single page app and using angular ui router to serve my project but when I send request to api service it not call it and redirect to the page that I put in the action of the rule and the response return me with HTML page in string format that is the Single Page Body returned to me instead of the expected data that I want from consuming the service. 我在单页应用程序的IIS中使用重写规则,并使用angular ui路由器为我的项目提供服务,但是当我向api服务发送请求时,它不会调用它并重定向到我在规则操作和响应返回中放入的页面HTML格式的HTML页面(单页正文)返回给我,而不是我希望通过使用服务获得所需的数据。

<rule name="HomeRule" stopProcessing="true">
    <match url="po" ignoreCase="true" />  
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions> 
      <action type="Rewrite" url="/Pages/MasterPage.html" />
  </rule> 

please any one help to fix this issue thanks in advance 请任何人解决此问题,谢谢

Take a look at what this is saying. 看看这是什么意思。

<conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions> 

With MatchAll logical grouping, its saying only execute the rule if the filename is not a directory and not a filename . 使用MatchAll逻辑分组时,俗话说只有文件名不是directory ,也不是filename ,才执行规则。 Is that what you really want? 那是你真正想要的吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM