Asp.net 如何检测url,第一个包含带有查询字符串的目录,第二个包含带有查询字符串的simple.aspx文件

Asp.net 如何检测url,第一个包含带有查询字符串的目录,第二个包含带有查询字符串的simple.aspx文件,asp.net,url,iis,url-rewriting,iis-7.5,Asp.net,Url,Iis,Url Rewriting,Iis 7.5,我有两页网址 <rule name="RewriteUserFriendlyURL2" stopProcessing="true"> <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" /> <conditions> <add input="{REQUEST_FILENAME}" p

我有两页网址

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>
第一个是WWW.domain.com/test/page.aspx?id=2&URL=3 重新编写为WWW.domain.com/test/page/2/3/

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>
第二个是WWW.domain.com/page.aspx?id=1&URL=2&query=3 如WWW.domain.com/page/1/2/3那样重新编写/

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>
现在我如何区分这些URL,因为一般来说它们看起来都一样

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>
实际上,第一页在子目录中,另一页在根目录中

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>
我尝试了下面写的一个规则,但由于正则表达式模式匹配,它正在调用这两个URL

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>
有谁能帮我映射这些URL吗?我认为这两个URL应该根据不同的规则匹配

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>
如果你觉得理解上有困难,请告诉我。谢谢

<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" pattern="^([^/]+)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
                    </conditions>
                <action type="Rewrite" url="{R:1}/{R:2}.aspx?{R:3}={R:4}" />
            </rule>