Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.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将url重定向到另一个url?_C#_Asp.net Mvc_Web Config - Fatal编程技术网

C# 如何使用web.config将url重定向到另一个url?

C# 如何使用web.config将url重定向到另一个url?,c#,asp.net-mvc,web-config,C#,Asp.net Mvc,Web Config,我想转到 我尝试了下面的方法,但没有成功 <rule name="Redirect 1" stopProcessing="true"> <match url="https://www.test.com/flights/economy-class-flights" /> <action type="Redirect" url="https://www.test.com/flight-types/economy-class" /></rule

我想转到

我尝试了下面的方法,但没有成功

<rule name="Redirect 1" stopProcessing="true">
    <match url="https://www.test.com/flights/economy-class-flights" />
    <action type="Redirect" url="https://www.test.com/flight-types/economy-class" /></rule>

这对我很有效

<rule name="redirect RedirectURL1" stopProcessing="true">
    <match url="^flights/economy-class-flights" ignoreCase="true" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^(www.)?test.com" />
    </conditions>
    <action type="Redirect" url="/flight-types/economy-class" redirectType="Permanent" />
</rule>