当我输入值时,发送错误无法找到资源
错误: '/'应用程序中的服务器错误。
如何解决这个问题 控制器
public ActionResult Registration_()
{
Registration Registration = new Registration();
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Registration_(Registration reg)
{
if (ModelState.IsValid)
{
DB.Registrations.Add(reg);
DB.SaveChanges();
}
return RedirectToAction("Index", "Home");
}
视图(错误在视图中)
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="col-md-6 account">
<h3>Login</h3>
<label for="">Username or email address *</label>
<div class="form-group">
@Html.EditorFor(model => model.RegEmail, new { htmlAttributes = new { @class = "form-control", placeholder = "Ex: Name" } })
</div>
<label for="">Password *</label>
<div class="form-group">
@Html.EditorFor(model => model.Passwords, new { htmlAttributes = new { @class = "form-control", placeholder = "Ex: Name" } })
</div>
<button>Login</button>     
<input type="checkbox" id="rememberme" value="forever"><span>Remember me</span>
<br /><br />
<a href="#">Forgot Password</a>
</div>
<div class="col-md-6 account">
<h3>Register</h3>
<label for=""> Email address *</label>
<div class="form-group">
@Html.EditorFor(model => model.RegEmail, new { htmlAttributes = new { @class = "form-control", placeholder = "Ex: Name" } })
</div>
<label for="">Password *</label>
<div class="form-group">
@Html.EditorFor(model => model.Passwords, new { htmlAttributes = new { @class = "form-control", placeholder = "Ex: Name" } })
</div>
<label for="">Register As *</label>
<div class="form-group">
@Html.DropDownList("dropRoles", new List<SelectListItem>()
{
new SelectListItem() { Text= "Register As", Selected = true },
new SelectListItem() { Text= "Employer", Value = "true" },
new SelectListItem() { Text= "Employee", Value = "false" }
})
@*<select class="form-control">
<option value="">Employer </option>
<option value="">Candidate </option>
</select>*@
</div>
<button>SignUp/Register</button>
</div>
}
我认为当我提交或注册时,他就没有办法了。 无论任何人都可以解释并解决它? 我将非常感激。