在条件ASPX,ASP.Net上不进行文件夹更改的URL重写

问题描述 投票:0回答:1

[嗨,我需要在aspx中使用特定关键字更改所有URL,但不要更改文件夹结构。现在,我的带有条件的URL和文件夹结构如下所示:

在条件:isABC = false时,URL会像localhost55717/product/xyz.aspx一样出现,但在条件isABC = true时,URL应该像localhost55717/abc/product/xyz.aspx来一样>

我的文件夹结构是

project
  |_WEB
    |_Default.aspx
    |_ABC
      |_Default.aspx
    |_product
      |_xyz.aspx

请帮助。

[嗨,我需要在aspx中使用特定关键字更改所有URL,但不要更改文件夹结构。现在,我的带有条件的url和文件夹结构如下所示:on condition:...

c# asp.net web-config
1个回答
0
投票
<rule name="RewriteAllButElmahAxd" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{URL}" negate="true" pattern="\elmah.axd$" />
    </conditions>
    <action type="Rewrite" url="http://elmahio.github.io/blog/{R:1}" />
</rule>
© www.soinside.com 2019 - 2024. All rights reserved.