權限與靜態檔控制改進:

- 修正 admin 目錄預設頁路由,避免 403.14 與不必要的延遲重導
- 停用未使用的 Sites 多站點初始化,減少應用程式啟動成本
- 修正 Response.Redirect 後未 return 的流程,避免 1.8 分鐘超時
- 將資料庫 Connection Timeout 降為 10 秒,加速失敗回應
- 將 runAllManagedModulesForAllRequests 設為 false,讓 JS/CSS 等靜態檔案直接由 IIS 回應
This commit is contained in:
2025-11-12 20:45:34 +08:00
parent ae09a6f487
commit b04c07a5eb
8 changed files with 46 additions and 262 deletions

View File

@@ -34,11 +34,13 @@ namespace MyWeb
if (!admin.isLoign())
{
HttpContext.Current.Response.Redirect("~/admin/index.aspx?msg=A3");
return; // 立即終止,避免繼續執行後面的資料庫查詢
}
if (admin.info.login_ip != admin.MyIP)
{
HttpContext.Current.Response.Redirect("~/admin/index.aspx?msg=E");
return; // 立即終止
}
//檢查是否被停權
@@ -60,12 +62,13 @@ namespace MyWeb
{
sqlConn.Close(); sqlConn.Dispose();
HttpContext.Current.Response.Redirect("~/admin/index.aspx?msg=B");
//帳號停權
return; //帳號停權,立即終止
}
if (SingleIn == "Y" && dt.Rows[0]["login_code"].ToString() != admin.info.login_code)
{
sqlConn.Close(); sqlConn.Dispose();
HttpContext.Current.Response.Redirect("~/admin/index.aspx?msg=C"); //不允許同一個帳號多重登入
return; // 立即終止
}
}
else
@@ -73,6 +76,7 @@ namespace MyWeb
//帳號不存在
sqlConn.Close(); sqlConn.Dispose();
HttpContext.Current.Response.Redirect("~/admin/index.aspx?msg=D");
return; // 立即終止
}
}
catch (Exception ex)