문제

I am trying to use MVCContrib InputBuilders but I am having trouble. I am also using S#arp architecture and spark. My spark view looks like this:

new.spark:

<viewdata model="NewUserViewModel" />
${Html.InputForm<NewUserViewModel>()}

My global.asax.cs contains:

  protected void Application_Start() {
    XmlConfigurator.Configure();
    var controller = InitializeServiceLocator();
    ModelBinders.Binders.DefaultBinder = new SharpModelBinder();            
    ViewEngines.Engines.Clear();
    InputBuilder.BootStrap();
    ViewEngines.Engines.Add(controller.Resolve<IViewEngine>());
    RouteRegistrar.RegisterRoutesTo(RouteTable.Routes);
  }
도움이 되었습니까?

해결책

I hate it when I answer my own question but I found adding this to the /Views/Web.config under </system.web> fixed my problem.

    <pages
    validateRequest="false"
    pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <controls>
            <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
        </controls>
    </pages>

I'm not really sure why that helped. My guess is my app was configured to only to work with spark views and this is adding the regular view engine back in, but I am not expert here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top