![](/img/trans.png)
[英]I am working on the ASP.NET with C# on the Web based project and I am having the compliation error
[英]I have an final year project based on Web based in C# ASP.net when i run it, it will show the error
Protected void Page_PreInit(object sender,Event args e)
{
this.Theme=Session["Theme name"].ToString();
}
用戶代碼無法處理空異常錯誤
看起來像:
Session["Theme name"]
一片空白。
您應該在上線之前對此進行測試。 就像是:
protected void Page_PreInit(object sender,Event args e)
{
if(Session["Theme name"] != null)
{
this.Theme=Session["Theme name"].ToString();
}
else
{
//use the default theme
}
}
我認為您的會話“ Session [“主題名稱”]“不包含任何主題名稱。 我認為您的會話返回null,因此在將值設置為page.theme之前首先檢查會話中是否存在值
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.