how to reset page text boxes data after page post back?
my question seems simple and stupid but first read this, suppose you have a login form which take username and password and post back to controller if login successful then return Homepage(return View("HomePage")) View (not Redirect) then suppose i am Logged off and return Login (return View("Login")) View (again not Redirect) and n开发者_Go百科ow if i press Back button and Refresh the page then it will automatically get logged IN by using those username and password which i entered before. So can i make those password Null from Browser's Memory or where ever it is i don't know.
"i know that not redirecting (RedirectToAction("ViewName")) is causing the problem" But Why or May be i don't know any important concept
Some browsers, especially Firefox try to be helpful and 'remember' values you have input into text fields and checkboxes. in order to switch this off in a particular input add the following attribute
autocomplete="off"
Alternatively, using jQuery you can switch it off for a whole form:
$("form").attr("autocomplete", "off");
ModelState.Remove("key");
or
ModelState.Clear()
精彩评论