MVC 后台向前台传值,同一Controller下Action之间的传值,Controller与Controller之间的传值

时间:2021-02-24 20:36:10

@{
Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>登录</h2>

<p>
@using(Html.BeginForm("Login", "Login", FormMethod.Post)){
<p>
<br>用户:@Html.TextBox("username")
密码:@Html.TextBox("password")
<input id="Submit1" type="submit" value="登录" />
<a href="" class="btn btn-primary btn-lg">@TempData["Name"] &raquo;</a>
</p>
}
@Html.ActionLink("Action -> Action","Again",new { str = @TempData["Name"] })
@Html.ActionLink("Controller -> Controller", "Index","Home", new { str = @TempData["Name"] },null)
</p>
<p>
</p>