javascript - how to create an alert prompt in the controller before redirecting to a new view? -
is possible create alert prompt in controller before redirecting new view? want make users acknowledge message in current view before directing them next view
using system.web.mvc; using system.web.security; using mvcapplication.models; [httppost] public actionresult login(loginmodel model, string returnurl) { if (!this.modelstate.isvalid) { return this.view(model); } if (membership.validateuser(model.username, model.password)) { formsauthentication.setauthcookie(model.username, model.rememberme); ***// here! create alert close button using javascript , make user acknowledge clicking button , closing alert before redirecting user*** if (this.url.islocalurl(returnurl) && returnurl.length > 1 && returnurl.startswith("/") && !returnurl.startswith("//") && !returnurl.startswith("/\\")) { return this.redirect(returnurl); } return this.redirecttoaction("index", "home"); } this.modelstate.addmodelerror(string.empty, "the user name or password provided incorrect."); return this.view(model); }
return method view message, link and/or auto-redirect.
it's not possible "pause" processing of controllers send messages user!!
Comments
Post a Comment