I have an asp.net page with url rewriting rule. The rule shows below:
<rule name="DiscoverCategorySEO">
<match url="^Discover/([0-9]+)/"/>
<conditions>
<add input="{URL}" negate="true" pattern="\.axd$"/>
</conditions>
<action type="Rewrite" url="News/Discover.aspx?Section={R:1}" redirectType="Permanent" appendQueryString="false"/>
</rule>
I put a break point in the Page_Load method for debugging. Then I found when I visit ' http://[domain]/Discover/1/ '. The discover page will load twice. However, if I put ' http://[domain]/News/Discover.aspx?Section=1 ", the break point will only be hit once.
Does anyone know how can I keep url rewriting rule and meanwhile load page only once?
<rule name="DiscoverCategorySEO" enabled="true" stopProcessing="true">
<match url="^Discover/([0-9]+)/"/>
<conditions logicalGrouping="MatchAll">
<add input="{URL}" negate="true" pattern="\.axd$"/>
<add input="{PATH_INFO}" pattern="^Discover/([0-9]+)/" />
</conditions>
<action type="Rewrite" url="News/Discover.aspx?Section={R:1}" redirectType="Permanent" appendQueryString="false"/>
</rule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.