asp.net mvc - MVC 4.0 String was not recognized as a valid Boolean -
i have razor 2.0 form works locally. i've verified dll's on prod mvc, razor, , helpers latest version. i'm getting exception on every page uses @html.beginform
varying parameters. mvc pages seem work fine long no form helpers used:
exception: [formatexception: string not recognized valid boolean.] system.boolean.parse(string value) +13981920 system.convert.changetype(object value, type conversiontype, iformatprovider provider) +811 system.web.mvc.viewcontext.scopeget(idictionary`2 scope, string name, tvalue defaultvalue) +89 system.web.mvc.scopecache..ctor(idictionary`2 scope) +75 system.web.mvc.scopecache.get(idictionary`2 scope, httpcontextbase httpcontext) +299 system.web.mvc.viewcontext.getclientvalidationenabled(idictionary`2 scope, httpcontextbase httpcontext) +9 system.web.mvc.html.formextensions.formhelper(htmlhelper htmlhelper, string formaction, `enter code here`formmethod method, idictionary`2 htmlattributes) +233 system.web.mvc.html.formextensions.beginform(htmlhelper htmlhelper, string actionname, string controllername, formmethod method, object htmlattributes) +134 asp._page_views_portal_loginform_cshtml.execute() in e:\webroot\nw_qa_bleedhr\views\portal\loginform.cshtml:4 system.web.webpages.webpagebase.executepagehierarchy() +280 system.web.mvc.webviewpage.executepagehierarchy() +125 system.web.webpages.webpagebase.executepagehierarchy(webpagecontext pagecontext, textwriter writer, webpagerenderingbase startpage) +196 system.web.mvc.html.partialextensions.partial(htmlhelper htmlhelper, string partialviewname, object model, viewdatadictionary viewdata) +147 asp._page_views_portal_welcome_cshtml.execute() in e:\webroot\nw_qa_bleedhr\views\portal\welcome.cshtml:9 system.web.webpages.webpagebase.executepagehierarchy() +280 system.web.mvc.webviewpage.executepagehierarchy() +125 system.web.webpages.startpage.executepagehierarchy() +143 system.web.webpages.webpagebase.executepagehierarchy(webpagecontext pagecontext, textwriter writer, webpagerenderingbase startpage) +181 system.web.mvc.viewresultbase.executeresult(controllercontext context) +380 system.web.mvc.<>c__displayclass1a.<invokeactionresultwithfilters>b__17() +33 system.web.mvc.controlleractioninvoker.invokeactionresultfilter(iresultfilter filter, resultexecutingcontext precontext, func`1 continuation) +613 system.web.mvc.controlleractioninvoker.invokeactionresultwithfilters(controllercontext controllercontext, ilist`1 filters, actionresult actionresult) +263 system.web.mvc.async.<>c__displayclass25.<begininvokeaction>b__22(iasyncresult asyncresult) +240 system.web.mvc.<>c__displayclass1d.<beginexecutecore>b__18(iasyncresult asyncresult) +28 system.web.mvc.async.<>c__displayclass4.<makevoiddelegate>b__3(iasyncresult ar) +15 system.web.mvc.controller.endexecutecore(iasyncresult asyncresult) +53 system.web.mvc.async.<>c__displayclass4.<makevoiddelegate>b__3(iasyncresult ar) +15 system.web.mvc.<>c__displayclass8.<beginprocessrequest>b__3(iasyncresult asyncresult) +42 system.web.mvc.async.<>c__displayclass4.<makevoiddelegate>b__3(iasyncresult ar) +15 system.web.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +606 system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +288
this form dead simple:
@model gis.pangea.nw.presentation.viewmodels.loginview <div id="doalogin_div"> @using (html.beginform("candidatelogin", "account", formmethod.post, new { id = "loginform" })) { @html.antiforgerytoken() @html.validationsummary() <table id="loginform_tb"> <tr> <td colspan="2" id="loginheader_td"> <h3 id="loginheader_h3">@model.returningapplicanttext</h3> </td> </tr> <tr> <td class="fieldname_td" id="username_td"> @html.labelfor(p=>model.logindto.username) </td> <td class="fielddata_td" id="usernameinput_td"> @html.textboxfor(p => model.logindto.username, new {id="username",name="username" }) @html.validationmessage("username") </td> </tr> <tr> <td class="fieldname_td" id="password_td"> <label for="password"> @html.encode(model.passwordtext) </label> </td> <td class="fielddata_td" id="passwordinput_td"> @html.passwordfor(p=>model.logindto.password, new {id="password",name="password" }) @html.validationmessage("password") </td> </tr> <tr> <td colspan="2" id="forgotpassword_td"> @html.actionlink("forgot username or password?","forgotpassword") </td> </tr> <tr> <td colspan="2" id="loginsubmit_td" class="submit_td"> <input type="submit" class="formbutton" value="@model.loginbuttontext" /> </td> </tr> <tr> <td colspan="2" id="loginvalidation_td"> @if (!string.isnullorempty(model.logindto.validationmessage)) { <span class="validationmessage">@model.logindto.validationmessage</span> } </td> </tr> </table> } </div>
i suspected wrong or missing version of dll. mvc components should in bin folder, , i've verified (at least top level dlls)
here view config file: <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <sectiongroup name="system.web.webpages.razor" type="system.web.webpages.razor.configuration.razorwebsectiongroup, system.web.webpages.razor, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> <section name="host" type="system.web.webpages.razor.configuration.hostsection, system.web.webpages.razor, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> <section name="pages" type="system.web.webpages.razor.configuration.razorpagessection, system.web.webpages.razor, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> </sectiongroup> </configsections> <system.web.webpages.razor> <host factorytype="system.web.mvc.mvcwebrazorhostfactory, system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <pages pagebasetype="system.web.mvc.webviewpage"> <namespaces> <add namespace="system.web.helpers" /> <add namespace="system.web.mvc" /> <add namespace="system.web.mvc.ajax" /> <add namespace="system.web.mvc.html" /> <add namespace="system.web.optimization" /> <add namespace="system.web.routing" /> <add namespace="mvccontrolstoolkit.core" /> <add namespace="mvccontrolstoolkit.controls" /> <add namespace="mvccontrolstoolkit.controls.validation" /> </namespaces> </pages> </system.web.webpages.razor> <appsettings> <add key="webpages:enabled" value="false" /> </appsettings> <system.web> <compilation debug="false" targetframework="4.5"> <assemblies> <add assembly="system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add assembly="system.web.webpages, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add assembly="system.web.helpers, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add assembly="system.web.webpages.razor, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> </assemblies> </compilation> <httphandlers> <add path="*" verb="*" type="system.web.httpnotfoundhandler" /> </httphandlers> <pages validaterequest="false" pageparserfiltertype="system.web.mvc.viewtypeparserfilter, system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" pagebasetype="system.web.mvc.viewpage, system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" usercontrolbasetype="system.web.mvc.viewusercontrol, system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> <controls> <add assembly="system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" namespace="system.web.mvc" tagprefix="mvc" /> </controls> </pages> </system.web> <system.webserver> <validation validateintegratedmodeconfiguration="false" /> <handlers> <remove name="blockviewhandler" /> <add name="blockviewhandler" path="*" verb="*" precondition="integratedmode" type="system.web.httpnotfoundhandler" /> </handlers> </system.webserver> </configuration> project uses combination of asp pages , mvc views, , working webforms 1.0 , mvc 2.0. application setup application under default website. i've seen lots of variations same exception came down syntax errors in form helpers. seems more environmentally related. appreciated!
this problem emerged web.config error, specifically, following 2 lines:
<add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" />
the 2nd line broken when had invalid boolean value like:
<add key="unobtrusivejavascriptenabled" value="none" />
Comments
Post a Comment