会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
天道酬勤,厚德载物
博客园
::
首页
::
博问
::
闪存
::
新随笔
::
联系
::
订阅
::
管理
::
公告
?Personal Web Site--Security trimming using the menu controls
这个还没理解的,只找到相关的处理方法,但不知道为什么这么处理。
写在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
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部