p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 (http://p2p.wrox.com/forumdisplay.php?f=472)
-   -   HttpCompileException was unhandled by user code. error CS0246 (http://p2p.wrox.com/showthread.php?t=80078)

fh84 July 9th, 2010 03:22 PM

HttpCompileException was unhandled by user code. error CS0246
 
Hello to all,
i am just implementing chapter 6 and the following RunTime error occurs.
Could you please help me?
Error:
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\root\04b77160\410e7879\App_Web_index.aspx.e5 736d70.pemtelth.0.cs(148): error CS0246: The type or namespace name 'Article' could not be found (are you missing a using directive or an assembly reference?)

Code:

System.Web.HttpCompileException was unhandled by user code
  Message="c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files\\root\\04b77160\\410e7879\\App_Web_index.aspx.e5736d70.pemtelth.0.cs(148): error CS0246: The type or namespace name 'Article' could not be found (are you missing a using directive or an assembly reference?)"
  Source="System.Web"
  ErrorCode=-2147467259
  SourceCode="#pragma checksum \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\Views\\Article\\Index.aspx\" \"{406ea660-64cf-4c82-b6f0-42d48172a799}\" \"70BE4950AE67D9A1C73FCB76E9473760\"\r\n//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//    This code was generated by a tool.\r\n//    Runtime Version:2.0.50727.3082\r\n//\r\n//    Changes to this file may cause incorrect behavior and will be lost if\r\n//    the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace ASP {\r\n    \r\n    #line 276 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Collections;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 279 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Text;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 3 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\WrcApplication\\WrcApplication\\Views\\Article\\Index.aspx\"\r\n    using System.Web.UI;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 130 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\WrcApplication\\WrcApplication\\web.config\"\r\n    using System.Collections.Generic;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 129 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\WrcApplication\\WrcApplication\\web.config\"\r\n    using System.Linq;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 125 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\WrcApplication\\WrcApplication\\web.config\"\r\n    using System.Web.Mvc;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 283 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Web.SessionState;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 128 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\WrcApplication\\WrcApplication\\web.config\"\r\n    using System.Web.Routing;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 277 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Collections.Specialized;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 280 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Text.RegularExpressions;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 281 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Web;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 3 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n    using System.Web.UI.WebControls;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 282 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Web.Caching;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 285 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Web.Profile;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 127 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\web.config\"\r\n    using System.Web.Mvc.Html;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 284 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Web.Security;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 275 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 3 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n    using System.Web.UI.WebControls.WebParts;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 278 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Configuration;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 1 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n    using ASP;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 126 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\web.config\"\r\n    using System.Web.Mvc.Ajax;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    #line 289 \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\web.config\"\r\n    using System.Web.UI.HtmlControls;\r\n    \r\n    #line default\r\n    #line hidden\r\n    \r\n    \r\n    [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]\r\n    public class views_article_index_aspx : System.Web.Mvc.ViewPage<Pagination<Article>>, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {\r\n        \r\n        private static bool @__initialized;\r\n        \r\n        private static object @__fileDependencies;\r\n        \r\n        [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n        public views_article_index_aspx() {\r\n            string[] dependencies;\r\n            ((global::System.Web.Mvc.ViewPage)(this)).AppRelativeVirtualPath = \"~/Views/Article/Index.aspx\";\r\n            if ((global::ASP.views_article_index_aspx.@__initialized == false)) {\r\n                dependencies = new string[2];\r\n                dependencies[0] = \"~/Views/Article/Index.aspx\";\r\n                dependencies[1] = \"~/Views/Shared/Site.Master\";\r\n                global::ASP.views_article_index_aspx.@__fileDependencies = this.GetWrappedFileDependencies(dependencies);\r\n                global::ASP.views_article_index_aspx.@__initialized = true;\r\n            }\r\n            this.Server.ScriptTimeout = 30000000;\r\n        }\r\n        \r\n        protected ProfileCommon Profile {\r\n            get {\r\n                return ((ProfileCommon)(this.Context.Profile));\r\n            }\r\n        }\r\n        \r\n        protected ASP.global_asax ApplicationInstance {\r\n            get {\r\n                return ((ASP.global_asax)(this.Context.ApplicationInstance));\r\n            }\r\n        }\r\n        \r\n        [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n        private void @__BuildControlContent1(System.Web.UI.Control @__ctrl) {\r\n            @__ctrl.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(this.@__RenderContent1));\r\n        }\r\n        \r\n        private void @__RenderContent1(System.Web.UI.HtmlTextWriter @__w, System.Web.UI.Control parameterContainer) {\r\n            @__w.Write(\"\\r\\n<div id=\\\"articles\\\">\\r\\n\\r\\n\");\r\n            \r\n            #line 6 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n  foreach(Article article in ViewData.Model) { \r\n            \r\n            #line default\r\n            #line hidden\r\n            \r\n            #line 7 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n    Html.RenderPartial(\"~/Views/Shared/Article/ArticleItem.ascx\", article); \r\n            \r\n            #line default\r\n            #line hidden\r\n            @__w.Write(\"\\r\\n\\t<hr />\\r\\n\");\r\n            \r\n            #line 9 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n  } \r\n            \r\n            #line default\r\n            #line hidden\r\n            @__w.Write(\"\\r\\n</div>\\r\\n\\r\\n\");\r\n            \r\n            #line 12 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n  Html.RenderPartial(\"~/Views/Shared/Pager.ascx\", ViewData.Model); \r\n            \r\n            #line default\r\n            #line hidden\r\n        }\r\n        \r\n        [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n        private void @__BuildControlSidebarContent(System.Web.UI.Control @__ctrl) {\r\n            @__ctrl.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(this.@__RenderSidebarContent));\r\n        }\r\n        \r\n        private void @__RenderSidebarContent(System.Web.UI.HtmlTextWriter @__w, System.Web.UI.Control parameterContainer) {\r\n            @__w.Write(\"\\r\\n\\t\\t<div id=\\\"news\\\" class=\\\"boxed\\\">\\r\\n\\t\\t\\t<h2 class=\\\"title\\\">Categories</h2>\\r\\n\\t\\t\\t<div \" +\r\n                    \"class=\\\"content\\\">\\r\\n\\t\\t\\t\\t<ul>\\r\\n\\t\\t\\t\\t\\t<li class=\\\"first\\\"><a href=\\\"/\\\">All</a></li>\\r\\n\\t\");\r\n            \r\n            #line 21 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n    foreach(var category in ViewData[\"Categories\"] as IEnumerable<Category>) { \r\n            \r\n            #line default\r\n            #line hidden\r\n            @__w.Write(\"\\r\\n\\t\\t\\t\\t\\t<li>\");\r\n            \r\n            #line 22 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n @__w.Write( Html.ActionLink(category.Title, \"Index\", new { controller = \"Article\", category = category.Path }));\r\n\r\n            \r\n            #line default\r\n            #line hidden\r\n            @__w.Write(\"</li>\\r\\n\\t\");\r\n            \r\n            #line 23 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n    } \r\n            \r\n            #line default\r\n            #line hidden\r\n            @__w.Write(\"\\r\\n\\t\\t\\t\\t</ul>\\r\\n\\t\\t\\t</div>\\r\\n\\t\\t</div>\\r\\n\");\r\n        }\r\n        \r\n        [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n        private void @__BuildControlTree(views_article_index_aspx @__ctrl) {\r\n            \r\n            #line 1 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n            @__ctrl.Title = \"\";\r\n            \r\n            #line default\r\n            #line hidden\r\n            \r\n            #line 1 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n            @__ctrl.MasterPageFile = \"~/Views/Shared/Site.Master\";\r\n            \r\n            #line default\r\n            #line hidden\r\n            \r\n            #line 1 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n            this.InitializeCulture();\r\n            \r\n            #line default\r\n            #line hidden\r\n            \r\n            #line 3 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n            this.AddContentTemplate(\"MainContent\", new System.Web.UI.CompiledTemplateBuilder(new System.Web.UI.BuildTemplateMethod(this.@__BuildControlContent1)));\r\n            \r\n            #line default\r\n            #line hidden\r\n            \r\n            #line 15 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n            this.AddContentTemplate(\"SidebarContent\", new System.Web.UI.CompiledTemplateBuilder(new System.Web.UI.BuildTemplateMethod(this.@__BuildControlSidebarContent)));\r\n            \r\n            #line default\r\n            #line hidden\r\n            System.Web.UI.IParserAccessor @__parser = ((System.Web.UI.IParserAccessor)(@__ctrl));\r\n            \r\n            #line 1 \"C:\\Documents and Settings\\FH84\\Desktop\\Test\\\\Views\\Article\\Index.aspx\"\r\n            @__parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\\r\\n\\r\\n\"));\r\n            \r\n            #line default\r\n            #line hidden\r\n        }\r\n        \r\n        [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n        protected override void FrameworkInitialize() {\r\n            base.FrameworkInitialize();\r\n            this.@__BuildControlTree(this);\r\n            this.AddWrappedFileDependencies(global::ASP.views_article_index_aspx.@__fileDependencies);\r\n        }\r\n        \r\n        [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n        public override int GetTypeHashCode() {\r\n            return 1818804453;\r\n        }\r\n        \r\n        [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n        public override void ProcessRequest(System.Web.HttpContext context) {\r\n            base.ProcessRequest(context);\r\n        }\r\n    }\r\n}\r\n"
  StackTrace:
      at System.Web.Compilation.AssemblyBuilder.Compile()
      at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
      at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
      at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
      at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
      at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(String virtualPath, Type requiredBaseType)
      at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.CreateInstanceFromVirtualPath(String virtualPath, Type requiredBaseType)
      at System.Web.Mvc.WebFormViewEngine.FileExists(ControllerContext controllerContext, String virtualPath)
      at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext, String[] locations, String name, String controllerName, String cacheKey, String[]& searchedLocations)
      at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations)
      at System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache)
      at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass6.<FindView>b__4(IViewEngine e)
      at System.Web.Mvc.ViewEngineCollection.Find(Func`2 cacheLocator, Func`2 locator)
      at System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext controllerContext, String viewName, String masterName)
      at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
      at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
      at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
      at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass11.<InvokeActionResultWithFilters>b__e()
      at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
      at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass11.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10()
      at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
      at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass11.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10()
      at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
      at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
      at System.Web.Mvc.Controller.ExecuteCore()
      at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
      at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
      at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
      at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
      at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)
      at System.Web.Mvc.MvcHttpHandler.VerifyAndProcessRequest(IHttpHandler httpHandler, HttpContextBase httpContext)
      at System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContextBase httpContext)
      at System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContext httpContext)
      at System.Web.Routing.UrlRoutingHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
      at WrcApplication._Default.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\FH84\Desktop\Test\WrcApplication\WrcApplication\Default.aspx.cs:line 18
      at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
      at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
      at System.Web.UI.Control.OnLoad(EventArgs e)
      at System.Web.UI.Control.LoadRecursive()
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException:



Thank you In Advanced

fh84 July 10th, 2010 05:04 AM

Hello again,
Well I was looking around on the code and I found out that there are 2 errors in the page under ~/views/article/Index.aspx

Both errors say that Error The type or namespace name 'Article + Category' could not be found (are you missing a using directive or an assembly reference?)

I am sure i am missing something but i cannot find what!

please help

Code:

<% foreach(Article article in ViewData.Model) { %>
    <% Html.RenderPartial("~/Views/Shared/Article/ArticleItem.ascx", article); %>
    <hr />
<% } %>
</div>

<% Html.RenderPartial("~/Views/Shared/Pager.ascx", ViewData.Model); %>
</asp:Content>

<asp:Content ID="SidebarContent" ContentPlaceHolderID="SidebarContent" runat="server">
        <div id="news" class="boxed">
            <h2 class="title">Categories</h2>
            <div class="content">
                <ul>
                    <li class="first"><a href="/">All</a></li>
    <% foreach(var category in ViewData["Categories"] as IEnumerable<Category>) { %>
                    <li><%= Html.ActionLink(category.Title, "Index", new { controller = "Article", category = category.Path })%></li>
    <% } %>
                </ul>
            </div>
        </div>


fh84 July 10th, 2010 11:51 AM

Anyone to help? I really need help
It's urgent

fh84 July 10th, 2010 01:03 PM

found it here

amemon October 25th, 2010 12:49 PM

Thank you
 
Thanks for bring up and providing the rsolution. It worked for me too.[:)]


All times are GMT -4. The time now is 09:48 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.