天道酬勤,厚德载物

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

这个还没理解的,只找到相关的处理方法,但不知道为什么这么处理。
写在Global.asax里面的。
具体方法是下面的AppendQueryString委托方法。

<%@ Application Language="C#" %>

<script runat="server">

    
void Application_Start(object sender, EventArgs e) {
        SiteMap.SiteMapResolve 
+= new SiteMapResolveEventHandler(AppendQueryString);
        
if (!Roles.RoleExists("Administrators")) Roles.CreateRole("Administrators");
        
if (!Roles.RoleExists("Friends")) Roles.CreateRole("Friends");
    }


    SiteMapNode AppendQueryString(
object o, SiteMapResolveEventArgs e) {
        
if (SiteMap.CurrentNode != null{
            SiteMapNode temp;
            temp 
= SiteMap.CurrentNode.Clone(true);
            Uri u 
= new Uri(e.Context.Request.Url.ToString());
            temp.Url 
+= u.Query;
            
if (temp.ParentNode != null{
                temp.ParentNode.Url 
+= u.Query;
            }

            
return temp;
        }
 else {
            
return null;
        }

    }

    
</script>
posted on 2006-09-06 22:27  cobbles  阅读(144)  评论(0编辑  收藏  举报