I have this model item to modify and save in MVC 5. (.NET Framework 4.6.1)
@using (Ajax.BeginForm("Edit", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "wrapperViews" }))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>EQUIPMENT - @ViewBag.EQP_ID</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.ID)
@Html.HiddenFor(model => model.OPERATIONID)
<div class="form-group">
@Html.LabelFor(model => model.DESCRIPTION, htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-8">
@Html.EditorFor(model => model.DESCRIPTION, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DESCRIPTION, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.TYPE, htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-8">
@Html.DropDownListFor(model => model.TYPE,
new SelectList(Model.EquipmentTypes, "CodeType", "DescriptionType"),"", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.TYPE, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div style="width:500px;margin-top:15px">
<div style="width:120px; float:left;margin-left:30px">
<input type="submit" value="Save" class="btn btn" />
</div>
<div style="width:120px; float:left;">
@Ajax.ActionLink("Back to the list", "Index", "Equipment", new { id = Model.OPERATIONID }, new AjaxOptions()
{
OnSuccess = "OpenEquipment"
})
</div>
</div>
</div>
</div>
The problem is that entity field to modify contains dot in the name, like that:
http://localhost:62396/controllername/Edit/SUPREP.ABL
When I submit the form, it comes error
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:62396/controller/Edit/SUPREP.ABL
Physical Path C:\projectname\controller\Edit\SUPREP.ABL
I tried anything I could but I didn't solved my trouble. Any help would be appreciated.
Just Solved. Need to add to RouteConfig.cs the following line:
routes.AppendTrailingSlash = true;
And everything works. Thank you.
The problem is with your URL. IIS thinks that you're requesting for a file with extension ".ABL". You can simply add a trailing / to make it act like a route.
e.g.: http://localhost:62396/controllername/Edit/SUPREP.ABL/
Also make sure you've enabled double escaping by adding this to web.config :
<security>
<requestFiltering allowDoubleEscaping="true"/>
</security>
User contributions licensed under CC BY-SA 3.0