PostBack Url in Rewriting Url using UrlRewriting.Net

痴心易碎 提交于 2019-12-12 01:04:26

问题


Please help me a bit code. When i using UrlRewriting.Net to Rewrite URL in my app it works fine but i got this error:

<asp:LinkButton ID="LinkButton1" runat="server"
 PostBackUrl="Product/1/book.aspx">Item 1</asp:LinkButton>

the url is: http://localhost/Product/1/book.aspx and when i click back to home page the url is like this: http://localhost/**Product/1**/Home.aspx

this is my web.config

<configuration>
<configSections>
<section name="rewriter"
requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,  Intelligencia.UrlRewriter" />
</configSections>
...................
<system.web>
<httpModules>
  <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,  Intelligencia.UrlRewriter" />
</httpModules>
.....
 </system.web>

<rewriter>
<rewrite url="~/Home.aspx" to="~/vi/Default.aspx"/>
<rewrite url="~/Product/(.*)/(.*).aspx" to="~/ProductsPage.aspx?catID=$1&amp;title=$2"/>
</rewriter>
</configuration>

Thanks.......


回答1:


Not sure why you have the ASPX in the URI any more. The idea behind routing is you take a friendly URI:

 http://localhost/Product/1

And the routing engine routes to book.aspx. The fact your URI looks like:

http://localhost/Product/1/book.aspx 

indicates you are not routing properly.



来源:https://stackoverflow.com/questions/6497096/postback-url-in-rewriting-url-using-urlrewriting-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!