我为该urlrewritingnet DLL编写了25个Url Rewrite网址。
如何将其转换为IIS 7.5的Url Rewritting。
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="Page.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<add name="RewriteLogin" virtualUrl="^~/Login/" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Login.aspx" ignoreCase="true"/>
<add name="RewriteMembership" virtualUrl="^~/Memberships.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Memberships/Default.aspx" ignoreCase="true"/>
<add name="RewriteMembershipPage" virtualUrl="^~/Pages/Memberships.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Memberships/Default.aspx" ignoreCase="true"/>
<add name="RewriteGalleryMainA" virtualUrl="^~/Pages/Gallery.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Gallery/Default.aspx" ignoreCase="true"/>
<add name="RewriteDonation" virtualUrl="^~/Donations.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Donations/Default.aspx" ignoreCase="true"/>
<add name="RewriteDonationPage" virtualUrl="^~/Pages/Donations.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Donations/Default.aspx" ignoreCase="true"/>
<add name="RewriteShow" virtualUrl="^~/Show/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ShowDetails.aspx?PageName=$1" ignoreCase="true"/>
<add name="RewriteEvent" virtualUrl="^~/Event/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/EventDetails.aspx?PageName=$1" ignoreCase="true"/>
<add name="RewriteShowTime" virtualUrl="^~/ShowTime/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ShowTime.aspx?id=$1" ignoreCase="true"/>
<add name="RewriteProd" virtualUrl="^~/Product/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ProductDetails.aspx?PageName=$1" ignoreCase="true"/>
<add name="RewriteNews" virtualUrl="^~/News/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Article.aspx?PageName=$1" ignoreCase="true"/>
<add name="RewritePage1" virtualUrl="^~/Pages/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Page.aspx?pageName=$1" ignoreCase="true"/>
<add name="RewriteArticle" virtualUrl="^~/Articles/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Page.aspx?pageName=$1" ignoreCase="true"/>
<add name="RewriteVenue" virtualUrl="^~/Venue/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Venue/Default.aspx?id=$1" ignoreCase="true"/>
<add name="RewriteEventTime" virtualUrl="^~/EventTime/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/EventTime.aspx?id=$1" ignoreCase="true"/>
<add name="RewriteShowTimeChart" virtualUrl="^~/ShowTimeChart/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ShowTimeSeatingChart.aspx?showtime=$1" ignoreCase="true"/>
<add name="RewriteCategory" virtualUrl="^~/Category/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ShowsPerCategory.aspx?Category=$1" ignoreCase="true"/>
<add name="RewriteShowTimeChart" virtualUrl="^~/ShowTimeChart/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ShowTimeSeatingChart.aspx?showtime=$1" ignoreCase="true"/>
<add name="RewriteGalleryView" virtualUrl="^~/Gallery/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Gallery/View.aspx?id=$1" ignoreCase="true"/>
<add name="RewriteGalleryMainB" virtualUrl="^~/Gallery.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Gallery/Default.aspx" ignoreCase="true"/>
<add name="RewriteNewsCategory" virtualUrl="^~/News/Category/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ArticlesPerCategory.aspx?Category=$1" ignoreCase="true"/>
<add name="RewriteBlogCategory" virtualUrl="^~/Blog/Category/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ArticlesPerCategory.aspx?Category=$1" ignoreCase="true"/>
<add name="RewriteMobileShow" virtualUrl="^~/mobile/Show/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/mobile/ShowDetails.aspx?PageName=$1" ignoreCase="true"/>
<add name="RewriteMobileEvent" virtualUrl="^~/mobile/Event/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/mobile/ShowDetails.aspx?PageName=$1" ignoreCase="true"/>
<add name="RewriteMobileEventTime" virtualUrl="^~/mobile/EventTime/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/mobile/EventTime.aspx?id=$1" ignoreCase="true"/>
</rewrites>
</urlrewritingnet>
答案 0 :(得分:1)
您需要以下配置:
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteLogin" stopProcessing="true"><match url="Login/" /><action type="Rewrite" url="/Login.aspx" /></rule>
<rule name="RewriteMembership" stopProcessing="true"><match url="Memberships.aspx" /><action type="Rewrite" url="/Memberships/Default.aspx" /></rule>
<rule name="RewriteMembershipPage" stopProcessing="true"><match url="Pages/Memberships.aspx" /><action type="Rewrite" url="/Memberships/Default.aspx" /></rule>
<rule name="RewriteGalleryMainA" stopProcessing="true"><match url="Pages/Gallery.aspx" /><action type="Rewrite" url="/Gallery/Default.aspx" /></rule>
<rule name="RewriteDonation" stopProcessing="true"><match url="Donations.aspx" /><action type="Rewrite" url="/Donations/Default.aspx" /></rule>
<rule name="RewriteDonationPage" stopProcessing="true"><match url="Pages/Donations.aspx" /><action type="Rewrite" url="/Donations/Default.aspx" /></rule>
<rule name="RewriteShow" stopProcessing="true"><match url="Show/(.*).aspx" /><action type="Rewrite" url="/ShowDetails.aspx?PageName={R:1}" /></rule>
<rule name="RewriteEvent" stopProcessing="true"><match url="Event/(.*).aspx" /><action type="Rewrite" url="/EventDetails.aspx?PageName={R:1}" /></rule>
<rule name="RewriteShowTime" stopProcessing="true"><match url="ShowTime/(.*).aspx" /><action type="Rewrite" url="/ShowTime.aspx?id={R:1}" /></rule>
<rule name="RewriteProd" stopProcessing="true"><match url="Product/(.*).aspx" /><action type="Rewrite" url="/ProductDetails.aspx?PageName={R:1}" /></rule>
<rule name="RewriteNews" stopProcessing="true"><match url="News/(.*).aspx" /><action type="Rewrite" url="/Article.aspx?PageName={R:1}" /></rule>
<rule name="RewritePage1" stopProcessing="true"><match url="Pages/(.*).aspx" /><action type="Rewrite" url="/Page.aspx?pageName={R:1}" /></rule>
<rule name="RewriteArticle" stopProcessing="true"><match url="Articles/(.*).aspx" /><action type="Rewrite" url="/Page.aspx?pageName={R:1}" /></rule>
<rule name="RewriteVenue" stopProcessing="true"><match url="Venue/(.*).aspx" /><action type="Rewrite" url="/Venue/Default.aspx?id={R:1}" /></rule>
<rule name="RewriteEventTime" stopProcessing="true"><match url="EventTime/(.*).aspx" /><action type="Rewrite" url="/EventTime.aspx?id={R:1}" /></rule>
<rule name="RewriteShowTimeChart" stopProcessing="true"><match url="ShowTimeChart/(.*).aspx" /><action type="Rewrite" url="/ShowTimeSeatingChart.aspx?showtime={R:1}" /></rule>
<rule name="RewriteCategory" stopProcessing="true"><match url="Category/(.*).aspx" /><action type="Rewrite" url="/ShowsPerCategory.aspx?Category={R:1}" /></rule>
<rule name="RewriteShowTimeChart" stopProcessing="true"><match url="ShowTimeChart/(.*).aspx" /><action type="Rewrite" url="/ShowTimeSeatingChart.aspx?showtime={R:1}" /></rule>
<rule name="RewriteGalleryView" stopProcessing="true"><match url="Gallery/(.*).aspx" /><action type="Rewrite" url="/Gallery/View.aspx?id={R:1}" /></rule>
<rule name="RewriteGalleryMainB" stopProcessing="true"><match url="Gallery.aspx" /><action type="Rewrite" url="/Gallery/Default.aspx" /></rule>
<rule name="RewriteNewsCategory" stopProcessing="true"><match url="News/Category/(.*).aspx" /><action type="Rewrite" url="/ArticlesPerCategory.aspx?Category={R:1}" /></rule>
<rule name="RewriteBlogCategory" stopProcessing="true"><match url="Blog/Category/(.*).aspx" /><action type="Rewrite" url="/ArticlesPerCategory.aspx?Category={R:1}" /></rule>
<rule name="RewriteMobileShow" stopProcessing="true"><match url="mobile/Show/(.*).aspx" /><action type="Rewrite" url="/mobile/ShowDetails.aspx?PageName={R:1}" /></rule>
<rule name="RewriteMobileEvent" stopProcessing="true"><match url="mobile/Event/(.*).aspx" /><action type="Rewrite" url="/mobile/ShowDetails.aspx?PageName={R:1}" /></rule>
<rule name="RewriteMobileEventTime" stopProcessing="true"><match url="mobile/EventTime/(.*).aspx" /><action type="Rewrite" url="/mobile/EventTime.aspx?id={R:1}" /></rule>
</rules>
</rewrite>
</system.webServer>