首页 新闻 赞助 找找看

route地址重写

0
悬赏园豆:20 [已解决问题] 解决于 2010-12-02 17:20
<pre>这是我的某一个类型的列表地址,这个地址<a href="http://localhost:4040/Web/list/20.html" target="_blank">http://localhost:4040/Web/list/20.html</a>我是重写过了,</pre> <pre>真实的地址应该是<a href="http://localhost:4040/Web/list.aspx?id=20" target="_blank">http://localhost:4040/Web/list.aspx?id=20</a>,在这个页面我用了AspNetPager分页控件,</pre> <pre>当有下一页时地址为<a href="http://localhost:4040/Web/list/20.html?page=3" target="_blank">http://localhost:4040/Web/list/20.html?page=3</a>等. &nbsp;</pre> <pre> 现在的问题是,当我点击下一页时,我怎么把地址重写为<a href="http://localhost:4040/Web/list/20-3.html" target="_blank">http://localhost:4040/Web/list/20-3.html</a></pre> <pre><a href="http://localhost:4040/Web/list/20-3.html" target="_blank"></a>或者<a href="http://localhost:4040/Web/list/20/3.html" target="_blank">http://localhost:4040/Web/list/20/3.html</a>都可以. &nbsp;</pre> <pre>当我换另一个类型时,如果有下一页地址应该就是<a href="http://localhost:4040/Web/list/19-1.html" target="_blank">http://localhost:4040/Web/list/19-1.html</a></pre> <pre><a href="http://localhost:4040/Web/list/19-1.html" target="_blank"></a>或者<a href="http://localhost:4040/Web/list/18/3.html" target="_blank">http://localhost:4040/Web/list/18/3.html</a>意思就是list后面是两个变量,一个用来接收信息类型,</pre> <pre>一个用来表示分页数字。 &nbsp;</pre> <pre> 这个问题一直不知道怎么解决,要是哪位能帮解决</pre> <pre>.跟这类似的一个问题是,如果到了一个信息详细页面,<a href="http://localhost:4040/Web/info/80.html" target="_blank">http://localhost:4040/Web/info/80.html</a>,</pre> <pre>我以前是把所有内容全部取出来放一页显示,如果说文章内容过多,</pre> <pre>想分页显示,如<a href="http://localhost:4040/Web/info/80/1.html" target="_blank">http://localhost:4040/Web/info/80/1.html</a>,</pre> <pre><a href="http://localhost:4040/Web/info/80/2.html" target="_blank">http://localhost:4040/Web/info/80/2.html</a>要怎么办,</pre> <pre>另信息页面地址我也重写过了,真实的应该是<a href="http://localhost:4040/Web/info.aspx?id=80" target="_blank">http://localhost:4040/Web/info.aspx?id=80</a> &nbsp;</pre> <pre> 先谢了! </pre>
honghuhuang的主页 honghuhuang | 初学一级 | 园豆:180
提问于:2010-11-18 17:22
< >
分享
最佳答案
0

写个httpmodule类  预处理下

private void application_AuthorizeRequest(object sender, EventArgs e)
    {
        HttpApplication application = (HttpApplication)sender;
        string url = application.Context.Request.RawUrl.ToLower();
        string pageName=url.Substring(url.LastIndexOf('/')+1);
        string path = url.Substring(0, url.LastIndexOf('/') + 1);
        application.Context.RewritePath((path+pageName+".aspx"),false);
    }

收获园豆:20
Ivan333 | 菜鸟二级 |园豆:255 | 2010-11-18 17:51
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册