动态修改页面导航的问题!(sitemappath + web.sitemap)

我做了一个用户控件,此用户控件中只有一个控件(SiteMapPath)
并将此用户控件放在母版页中,
在运行时出现如题的提示!
用户控件中的代码如下:

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);

        int albumCategoryid;
        if (Request.QueryString["cid"] != null)
        {
            albumCategoryid = Convert.ToInt32(Request.QueryString["cid"]);
        }
        else
        {
            albumCategoryid = 0;
        }

        if (albumCategoryid != 0)
        {
            currentNode.Url = currentNode.Url + "?cid=" + albumCategoryid.ToString();
            currentNode.Title = "动态生成";
        }

        return currentNode;
    }


提示说,Request.QueryString["cid"]这行有问题,不知为什么?
我现在想主要解决的问题是:
如何能够修改页面导航的地址及名称
我用的是SiteMapPath控件和web.sitemap
但是这不能满足我的要求,因为有些地址是动态,比如
www.hxling.com/album/albums.aspx?cid=1
www.hxling.com/album/albums.aspx?cid=1&aid=1
这样地址
在网上搜索了很多,看了天轰穿的动态修改内存中的地址,有点不好使!

我的站点地图文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/default.aspx" title="首页"  description="">
      <siteMapNode url="~/album/default.aspx" title="我的相册"  description="我的相册" >
          <siteMapNode url="~/album/albums.aspx" title="相册类别" description="相册类别">
                <siteMapNode url="~/album/photos.aspx" title="相册名称" description="相册名称"></siteMapNode>
          </siteMapNode>
      </siteMapNode>
   
      <siteMapNode url="~/article/default.aspx" title="技术文章"  description="技术文章" />
      <siteMapNode url="~/login.aspx" title="用户登录"  description="用户登录" />
      <siteMapNode url="~/register.aspx" title="新用户注册"  description="新用户注册" />
      <siteMapNode url="~/error.aspx" title="系统提示"  description="系统提示" />
    </siteMapNode>
</siteMap>

希望各位能解答一下,为什么会出现如题的提示,或者能够解决我的问题,
其实我也想过不用ASP。NET2.0的站点导航,可以自己实现而且比较简单
即然微软出了这么个东东,我就想用这个实现!呵呵,学习学习,以后可以不用,但不可以不会用!

原文地址:https://www.cnblogs.com/hxling/p/642731.html