【发布时间】:2018-09-02 00:06:20
【问题描述】:
找不到资源。
Requested URL: /Home/Home/Signup_User
不过应该是/Home/Signup_User
其中 Home 是控制器,Signup_User 是 Home Controller 中的函数。我检查了拼写是否正确。
我的注册表如下。
<form action="~/Home/Signup_User" method="post" enctype="multipart/form-data">
@Html.AntiForgeryToken()
<div class="row">
<div class="large-6 columns">
<label>
Enter Name
@Html.EditorFor(model => model.username, new { htmlAttributes = new { @class = "form-control" } })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Age
@Html.EditorFor(model => model.age, new { htmlAttributes = new { @class = "form-control" } })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Email Address
@Html.TextBoxFor(model => model.email, new { @class = "large-12", placeholder = "xyz@gmail.com", type = "email" })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Password
@Html.PasswordFor(model => model.password, new { })
</label>
</div>
</div>
<br />
<hr />
<button type="submit" class="button tiny right" style="margin-left:5px;color:white;">Submit</button>
<a href="#" class="button secondary tiny right close-reveal-modal" style="position:relative; font-size: 0.6875rem;color:inherit;top:0;right:0; font-weight: 300;" aria-label="Close">Cancel</a> }
<a class="close-reveal-modal" aria-label="Close">×</a>
</form>
【问题讨论】:
-
如果你删除
~会发生什么? -
删除前导
~。删除它并使用Html.BeginForm()(或action = "Url.Action(...)"),以便始终正确生成您的网址 -
你在使用Areas吗
-
你为什么不使用 FormExtensions 任何背后的原因
标签: c# html asp.net-mvc asp.net-mvc-4