Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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
.net IIS7上的Url重写_.net_Url_Iis_Url Rewriting - Fatal编程技术网

.net IIS7上的Url重写

.net IIS7上的Url重写,.net,url,iis,url-rewriting,.net,Url,Iis,Url Rewriting,我正在尝试使用IIS上的入站规则将url重写为其他url。我试图做的基本上是任何像localhost/Membership/Login这样的请求都是localhost/handlers/mapper.ashx?url=Membership/Login。我所做的是创建一个如下所示的模式 (Membership\/)(.+) 重写url是 http://localhost/handlers/mapper.ashx?url={R:0} 其实这种方式并没有给我想要的解决方案。它保持正常工作,而不是发

我正在尝试使用IIS上的入站规则将url重写为其他url。我试图做的基本上是任何像
localhost/Membership/Login
这样的请求都是
localhost/handlers/mapper.ashx?url=Membership/Login
。我所做的是创建一个如下所示的模式

(Membership\/)(.+)
重写url是

http://localhost/handlers/mapper.ashx?url={R:0}
其实这种方式并没有给我想要的解决方案。它保持正常工作,而不是发送到mapper.ashx

有什么问题吗?这样做的正确方法是什么


提前感谢,

这并不能解释为什么要跳过映射,但您的示例和实际实现是不同的。您说您希望将请求映射到

localhost/handlers/mapper.ashx?methodname=登录

但是你的重写url的例子是

http://localhost/handlers/mapper.ashx?url={R:0}
url={R:0}


您的重写url中有url,而不是methodname,正如Dallas已经指出的,您要求的不是您自己的解决方案所建议的内容。但我会给你两种选择。首先,如果您只需要URL的
login
部分作为处理程序的
methodname
参数,则可以使用以下重写规则:

<rule name="Rewrite to handler" stopProcessing="true">
    <match url="^Membership/(.+)" />
    <action type="Rewrite" url="/handlers/mapper.ashx?methodname={UrlEncode:{R:1}}" appendQueryString="false" />
</rule>
<rule name="Rewrite to handler" stopProcessing="true">
    <match url="^Membership/(.+)" />
    <action type="Rewrite" url="/handlers/mapper.ashx?url={UrlEncode:{R:0}}" appendQueryString="false" />
</rule>