Communtiy Server论坛的帖子显示页面分页部分的Url Rewrite的构造方法

你可能会发现在Communtiy Server的论坛帖子列表页面

比如http://communityserver.org/forums/129/ShowForum.aspx

看下面分页处的连接使用的地址是类似ShowForum.aspx?PageIndex=2这样的地址
没有做到SearchFriendly,我们稍微改造一下代码就可以实现类似帖子显示页面内那样的地址
先在siteUrl.config内增加


<url name="forum_Paged" location = "forums" path = "{0}/{1}/ShowForum.aspx" pattern = "(\d+)/(\d+)/ShowForum.aspx" vanity="ShowForum.aspx?PageIndex=$1^ForumID=$2" />



然后siteUrl.cs内增加
 

public virtual string FormPagedFormat (int forumID)
{
 return urlData.FormatUrl("forum_Paged", "{0}", forumID.ToString(), forumID.ToString());
}
接着ThreadView.cs内paer数据绑定处增加
pager.UrlPattern = SiteUrls.Instance().FormPagedFormat(csContext.ForumID);

重新编译,OK,看看效果吧~~

http://www.3pub.com/bbs/3/default.aspx

posted on 2005-10-07 17:24  活靶子.Net  阅读(1463)  评论(1编辑  收藏  举报

导航