我正在尝试将消息传递给另一个视图(实际上是相同的控制器)我可以做得很好,但是对我来说有问题..
我是网络新手,看起来不太好..
这里是我的 c# 代码
if (createStatus == MembershipCreateStatus.Success)
{
string registrationMessage = "You have registered successfully";
return RedirectToAction("KurumsalGiris", new { message = registrationMessage });
}
[AllowAnonymous] //sonradan eklendi
public ActionResult KurumsalGiris(string message="")
{
if (User.Identity.IsAuthenticated)
return Content("Zaten giriş yapmışsınız");
ViewBag.RegistrationMessage = message;
return View();
}
这里是 html 方面
@model E_Cv.Models.LogOnModel
@{
ViewBag.Title = "Kurumsal Giriş";
}
<h2>Kurumsal Giriş</h2>
<h2>@ViewBag.RegistrationMessage</h2>
<p>
Please enter your user name and password.
@Html.ActionLink("Yeni Kurum Kaydı", "KurumsalKayit")
if you don't have an account.
</p>
所以我不知道如何以不同的方式将值传递给另一个视图。我不想在地址栏上显示这种消息并且用户必须更改它。
其次,我可以用“获取”方法吗?