using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;
namespace BasicCompent
{
public class MySitemapProvider:SiteMapProvider
{
string homePage;
string homeName;
string homeDesc;
public string GetTargetUrl(string url)
{
return string.Empty;
}
public override SiteMapNode FindSiteMapNode(string rawUrl)
{
SiteMapNode sm = null;
//--------------根据传入的参数生成SITEMAPNODE
//---------------将生成的URL改为静态的地址
string htm = GetTargetUrl(sm.Url);
return sm;
}
public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
{
return null;
}
public override SiteMapNode GetParentNode(SiteMapNode node)
{
if (node == null || string.IsNullOrEmpty(node["ParentUrl"]))
return GetRootNodeCore();
return FindSiteMapNode(node["ParentUrl"]);
}
protected override SiteMapNode GetRootNodeCore()
{
SiteMapNode sn = new SiteMapNode(this,
"0", homePage, homeName, homeDesc,
new string[] { "*" },
null, null, null);
sn.ParentNode = null;
return sn;
}
public override bool IsAccessibleToUser(System.Web.HttpContext context, System.Web.SiteMapNode node)
{
return true;
}
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection attributes)
{
base.Initialize(name, attributes);
}
}
}