I am running a application in Visual Studio 2013 and for Entity framework used Microsoft SQL Server Management Studio 2012. Everything alright from beginning but when I used those command for using HtmlHelpers inside my project that time got those error [Error Code 0x80070032 ]:-
My Web Config Code:-
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory,System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="SportsStore.WebUI" />
<add namespace="SportsStore.WebUI.HtmlHelpers"/>
</namespaces>
</pages>
</system.web.webPages.razor>
Be sure you are editing the web.config within the Views folder in MVC, not the project root web.config. The web.config in Views folder will have all the necessary sections for Razor etc. and that is the file Razor Configuration would use to resolve namespaces.
If you are making changes to the Views folder web.config, make sure you are not missing the configSections declaration (ex below for MVC4)
<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>
I also try this project which is given on Pro MVC 4.0 and solution is :-
Add this line on top of your 'List' View and don't need to any change/add any line in Web-Config file.
@using SportsStore.WebUI.HtmlHelpers
Hope this works for you :)
User contributions licensed under CC BY-SA 3.0