一个郁闷的问题
比如我的文章页面要载入的是Article.ascx
产品页面载入的是Product.asxc
但是只要在PageTemplate里载入了Article.ascx,换了条件之后载入的还是Article.ascx
换了条件也是,大家有没有遇到过这个情况 除非重新编译,或者重新启动IIS,它在短时间内就是不载入Product.ascx,这是怎么回事呢 重启IIS或者重新编译就解决问题,但一旦载入了Product.ascx在载入Article.ascx就是问题了 关键问题在于不重新或者不重启IIS,它一旦载入了一个控件之后就不会再载入其他空间,换了页面也是代码如下:
string myControl="/Skins/" + UserConfig.Temp.Folder + this.GetControl(menu.Type);
this.Controls.AddAt(0,LoadControl(myControl));
其中:UserConfig.Temp.Folder是控件所在文件夹
GetControl(menu.Type)
是根据menu.Type的不同判断要加载那个判断,menu.Type是个枚举,返回的是控件的名
代码如下
private string GetControl(WebMenuType type)
{
string myControl = string.Empty;
switch(type)
{
case WebMenuType.Article:
myControl=this.GetArticleControl();
break;
case WebMenuType.GuestBook:
myControl="/MenuGuestBook.ascx";
break;
case WebMenuType.Photo:
myControl=this.GetAlbumControl();
break;
case WebMenuType.Product:
myControl=this.GetProductControl();
break;
case WebMenuType.TieBa:
myControl=this.GetTopicControl();
break;
default:
myControl="/MenuNormal.ascx";
break;
}
return myControl;
}
比如我的文章页面要载入的是Article.ascx
产品页面载入的是Product.asxc
但是只要在PageTemplate里载入了Article.ascx,换了条件之后载入的还是Article.ascx
换了条件也是,大家有没有遇到过这个情况 除非重新编译,或者重新启动IIS,它在短时间内就是不载入Product.ascx,这是怎么回事呢 重启IIS或者重新编译就解决问题,但一旦载入了Product.ascx在载入Article.ascx就是问题了 关键问题在于不重新或者不重启IIS,它一旦载入了一个控件之后就不会再载入其他空间,换了页面也是代码如下:
string myControl="/Skins/" + UserConfig.Temp.Folder + this.GetControl(menu.Type);
this.Controls.AddAt(0,LoadControl(myControl));
其中:UserConfig.Temp.Folder是控件所在文件夹
GetControl(menu.Type)
是根据menu.Type的不同判断要加载那个判断,menu.Type是个枚举,返回的是控件的名
代码如下
private string GetControl(WebMenuType type)
{
string myControl = string.Empty;
switch(type)
{
case WebMenuType.Article:
myControl=this.GetArticleControl();
break;
case WebMenuType.GuestBook:
myControl="/MenuGuestBook.ascx";
break;
case WebMenuType.Photo:
myControl=this.GetAlbumControl();
break;
case WebMenuType.Product:
myControl=this.GetProductControl();
break;
case WebMenuType.TieBa:
myControl=this.GetTopicControl();
break;
default:
myControl="/MenuNormal.ascx";
break;
}
return myControl;
}
this.Controls.AddAt(0,LoadControl(myControl));
string myControl="/Skins/" + UserConfig.Temp.Folder + this.GetControl(menu.Type);
this.Controls.Clear();
this.Controls.AddAt(0,LoadControl(myControl));
2 断点 跟踪myControl的值是否有变化
如果没有打上UserID=xxx,提示出错,以后就是再打上UserID=xxx也没有出来页面了,应该不是IE的问题,我把IE的缓存,都清空了无效