How can I allow multiple periods in a URL?
Sample URL:
http://mylocalhost:6968/MyHome/Edit/ABCD.Applications.ClinicalData%257cCache_Timeout
I have tried:
Various Url Encoding:
@{
//string encodedItem = Url.Encode(item.Key);
//string encodedItem = HttpUtility.UrlEncode(item.Key);
string encodedItem = Server.UrlEncode(item.Key);
}
Adding a route handler:
<add name="UrlRoutingHandler" type="System.Web.Routing.UrlRoutingHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" path="Remote.mvc/*" verb="GET"/>
Modifying the web.config system.web
<httpRuntime relaxedUrlToFileSystemMapping="true" />
None of these things corrected the example URL.
Relevant code
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Key)
</td>
<td>
@Html.DisplayFor(modelItem => item.Value)
</td>
<td>
@Html.DisplayFor(modelItem => item.IsActive)
</td>
<td>
@{
//string encodedItem = Url.Encode(item.Key);
//string encodedItem = HttpUtility.UrlEncode(item.Key);
string encodedItem = Server.UrlEncode(item.Key);
}
@Html.ActionLink("Edit", "Edit", new { id = encodedItem }) |
@Html.ActionLink("Details", "Details", new { id = encodedItem }) |
@Html.ActionLink("Delete", "Delete", new { id = encodedItem })
</td>
</tr>
}
I'm clicking the Edit link.
I also tried
@Html.ActionLink("Edit", "Edit", new { id = item.Key })
which had the html output of:
a href=/MyHome/Edit/ABCD.Applications.ClinicalData%7CCache_Timeout
Click this link results in Error:
HTTP Error 404.0
I set a breakpoint in Controller.Edit
. The breakpoint is never hit. Anytime I have a url of the form:
http://mylocalhost:6968/MyHome/Edit/ABCD.X
Where X is anything after a .
then this error occurs. If I remove X, the breakpoint is hit.