【发布时间】:2011-11-18 03:10:56
【问题描述】:
我只是想知道如何为asp.net mvc3应用程序实现通知系统,基本上当用户登录到系统时成功登录页面显示消息,如果不是错误消息。
我有一些方法可以解决上述问题,将属性值保留在 viewmodel 上,但是当我们将通知从一个控制器传递到另一个控制器或从一个动作传递到另一个动作时,我不知道如何实现。
比如当我们登录到系统登录成功消息时,从账户控制器到主控制器,并在主页用户登录成功时显示通知消息。
如果您能提供代码示例或解决上述问题的最佳方法,我会很方便。
感谢
附言
这是我正在尝试的一些代码 sn-p
public ActionResult Register(UserRegistrationViewModel registrationModel)
{
//some logic and when end of the code set the error message and
//redirect to separate action and after new action can read the message and show
if(success)
return RedirectToAction("Index","Home");
else
return RedirectToAction("Logon");
}
【问题讨论】:
标签: c# asp.net asp.net-mvc notifications messages