我正在使用asp.net mvc 4,这有一个奇怪的问题:
@using (Html.BeginForm("Login", "Home", FormMethod.Post, new { @class = "login-form" }))
{
<input type="submit" name="btnSubmit" value="Login" />
}
输出:
<form action="/" class="login-form" method="post">
<input type="submit" name="btnSubmit" value="Login" />
</form>
我在web.config中使用这些配置
<location path="">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
<location path="assets">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="views">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
答案 0 :(得分:0)
不应该发生,如果问题无法解决,请使用此方法.....
<form method="post" action="@Url.Action("Login", "Home")" class="login-form">
<input type="submit" name="btnSubmit" value="Login" />
</form>