if (filterContext.HttpContext.Session["UserName"] == null || filterContext.HttpContext.Session["UserName"].ToString() == "")
{
filterContext.Result = new RedirectResult("/Home/Login");
} else
{
filterContext.Result = new RedirectResult("");
}
代碼是這樣的,我驗證登錄后怎么獲得是哪個頁面驗證的。因為條件不滿足我需要飯回一個頁。
不回傳頁會報錯。
uj5u.com熱心網友回復:
我暈,之前不管一直報錯,現在居然不報錯了。if (filterContext.HttpContext.Session["UserName"] == null || filterContext.HttpContext.Session["UserName"].ToString() == "")
{
filterContext.Result = new RedirectResult("/Home/Login");
}
只要這樣就行
uj5u.com熱心網友回復:
現在又遇到個問題。return View("Index");
我在Login里回傳Index頁面,但它只執行了html。我要的是執行Index()。先執行Index的后端代碼在執行前端代碼
該怎么辦
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/244090.html
標籤:C#
上一篇:求大神電腦推薦
