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
5
A
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
3
Hay un truco. Hay un archivo web.config en la carpeta/Vistas. Wow, no vi eso.
Gracias por publicar
Cuestiones relacionadas
- 1. Spring @Async Not Working
- 2. codeigniter redirect not working
- 3. Git Push Not Working
- 4. Decimal Ternary Not Working
- 5. CGRectContainsRect Not Working
- 6. jquery scrollTo not working
- 7. picking object not working?
- 8. SqlBulkCopy Not Working
- 9. hitTest: withEvent: Not Working
- 10. $ (document) .ready not Working
- 11. asp.net vistas de mvc y viewdata fuertemente tipado
- 12. ¿Dónde debería colocar mi asp.net-mvc fuertemente tipado viewdata?
- 13. Hide Soft Keyboard Not Working
- 14. android: state_enabled missing/not working?
- 15. Maven Checkstyle: Check not working
- 16. .htaccess! -f rule not working
- 17. text-align justify not working
- 18. phpunit - @covers tag not working
- 19. ASP.NET MVC Intellisense no encuentra ViewData
- 20. jQuery Validation Plugin + equalTo Not Working
- 21. ctypes import not working on python 2.5
- 22. Windows Phone 7 - CameraTask Not Working
- 23. anulando el diseño after_sign_up_path_for not working
- 24. tokeninput jquery plugin - preventDuplicates not working
- 25. F # Performance Profiler Instrumentation Not Working
- 26. "IS NULL" en Zend_Db_Table select not working
- 27. welcome-file en web.xml con spring not working?
- 28. Asp.net MVC Control de usuario ViewData
- 29. ASP.NET MVC ViewData sentencia if
- 30. Entity Framework con MVC fuertemente tipado
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