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.
- maybe browser cookieless
- 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
Post a Comment