MVC重定向到另一页四秒的停顿后, [英] MVC redirect to another page after a four second pause

查看:109
本文介绍了MVC重定向到另一页四秒的停顿后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是比较新的MVC,但我有一个问题:

I'm relatively new to MVC, but I have a problem:

目前,当用户登录到我们的网站的第一次,他们将被重定向到一个修改密码的页面;他们必须改变自己的密码才可以访问的网站的主要功能的任何。之后,他们改变自己的密码成功,虽然,我想表明我的自定义密码修改成功更改密码页面上的信息;我目前做到这一点。之后,我改变我的密码,页面上显示我的自定义消息,我要等待几秒钟,然后将其重定向到主页。

Currently, when a user signs into our site for the first time, they are redirected to a change password page; they must change their password before they can access any of the main functionality of the site. After they change their password successfully though, I want to show my custom "Password successfully changed" message on the change password page; I currently do this. After I display my custom message on my change password page, I want to wait a few seconds and then redirect them to the home page.

我希望能够做这样的事:

I want to be able to do something like this:

//User successfully changes password on ChangePassword page

return View(); //This keeps them on the ChangePassword page and shows the success message

//Wait five seconds on ChangePassword page

//Redirecttoaction("Index", "Home");

谢谢!

推荐答案

您不会是能够做到这一点在服务器端,你将不得不使用JavaScript。您可以使用

You wont be able to do that on the server side, you'll have to use javascript. You can use

window.setTimeout(function(){
window.location.href='your URL';
}, 4000);

这篇关于MVC重定向到另一页四秒的停顿后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆