原文发布时间为:2008-07-29 —— 来源于本人的百度文章 [由搬家工具导入]
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class sitemap : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SiteMap.SiteMapResolve+=new SiteMapResolveEventHandler(SiteMap_SiteMapResolve);
}
SiteMapNode SiteMap_SiteMapResolve(object sender,SiteMapResolveEventArgs e)
{
SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);
SiteMapNode tempNode=currentNode;
int id=nid();
int page=npage();
if (id > 0)
{
tempNode.Url = tempNode.Url + "?id=" + id.ToString();
}
if (id > 0 && page >= 0)
{
tempNode.Url = tempNode.Url + "&page=" + page.ToString();
}
else if (page >= 0)
{
tempNode.Url = tempNode.Url + "?page=" + page.ToString();
}
return tempNode;
}
private int nid()
{
return 2;
}
private int npage()
{
return 3;
}
}