Very strange error, i have a field on an MVC View:
<%: Html.CheckBox("Reportable", ViewData["Reportable"])%>
Im guessing this is bad practice, but i need a boolean value, and am trying to get it from the FormCollection on postback by doing:
wasteStreamReciever.ERCBReportable = bool.Parse(Request.Form["Reportable"]);
Am i doing it wrong? Is there a better way?
edit
I have also tried to no avail:
bool bchk = false;
bool.TryParse(Request.Form["Reportable"], out bchk);
edit2
The exception being thrown is:
A potentially dangerous Request.Form value was detected from the client
System.Web.HttpRequestValidationException
An HTML checkbox should only pass its value when checked. If you only need to know whether the ‘Reportable’ box was checked, you don’t need to parse the value at all; you just need to see whether there is a value.