In ASP.NET MVC 2 you may get this error due to null value referencing model. In my case, I had the following code in my view.
<% foreach (var item in Model) { %> <tr> <td> <%: item.Fax %> </td> </tr> <% } %>
Using Html.Encode I managed to solve the issue.
<% foreach (var item in Model) { %> <tr> <td> <%: Html.Encode(item.Fax) %> </td> </tr> <% } %>
No comments:
Write comments