c# - Value of TempData becomes null after "Redirect" -


i facing issues tempdata after redirect.

public actionresult logincredentials() {     // calling "seterror()" in catch(), if password mismatch.                             try{}      catch()     {       return seterror();     }    }  public actionresult seterror() {     // set value of tempdata "true"                             tempdata["error"] = true;     return redirect("/login");                 }   public actionresult index() {     viewdata["useerror"]= tempdata["error"]; // @ point tempdata["error"] null.     ... } 

in seterror() value of tempdata set true, issue takes place after "redirect", value becomes "null" , can't use anymore.

  1. maybe browser cookieless
  2. the data in tempdatadictionary object persists 1 request next, unless mark 1 or more keys retention using keep method, accoding code, if redirect login page, , redirect index, value null. can read @ login page.

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -