5

Lo agrego a mi encabezado <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> y puedo acceder a ViewData y todas sus partes internas, así como a todos los objetos mvc como url y html. Tan pronto como agregue "System.Web.Mvc.ViewPage<app.Models.tTable>" no tengo acceso a ninguna clase de mvc ni a los métodos de ayuda. Estoy confundido sobre por qué es esto. Recientemente realicé una actualización de mvc preview 5 a rc1, pero mi transición a rc1 fue perfecta sin errores ni errores.mvc no codebehind fuertemente tipeado viewdata headers not working

Respuesta

6

Después de pescar (mucha pesca) encontré la respuesta, esto es porque no leí las notas oficiales de la versión en lugar de ejecutar un tutorial de un blog, pero para que esto funcione debe reemplazar el nodo <pages> en el archivo web.config en el directorio "/ Vistas" con

<!-- 
     Enabling request validation in view pages would cause validation to occur 
     after the input has already been processed by the controller. By default 
     MVC performs request validation before a controller processes the input. 
     To change this behavior apply the ValidateInputAttribute to a 
     controller or action. 
    --> 
    <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> 

añadí la comentando de una pre construida archivo web.config

+0

Esto es tan aplicable a MVC 2 como 1. Aunque la versión y PublicKeyToken cambios a la versión 2.0 específicas .... \t \t \t \t \t \t \t \t \t \t \t \t \t \t – EBarr

3

Hay un truco. Hay un archivo web.config en la carpeta/Vistas. Wow, no vi eso.

Gracias por publicar