文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Substitution控件MethodName获取Session失败的解决

Substitution控件MethodName获取Session失败的解决

时间:2010-12-24  来源:秩名

substitution是对缓存页面实现动态显示部分内容的控件,使用方法:在后台页面添加静态方法,private static string methodname(httpcontext context),经典的用法是动态显示的是当前的登录用户名字(非登录用户显示其他的)。

 

private static string methodname(httpcontext context)

{

 return convert.tostring(context.session["username"]);

}
 

 

运行时会有异常。

 

解决方法:就像httphandler 不能取session的解决方法一样,将目标页面继承

system.web.sessionstate.irequiressessionstate

接口,解决!

 

 

标签分类:

相关阅读 更多 +
排行榜 更多 +
hacked

hacked

休闲益智 下载
佩科佩科的寿司手机版

佩科佩科的寿司手机版

休闲益智 下载
钓鱼好友

钓鱼好友

休闲益智 下载