 |
BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
 | This is the forum to discuss the Wrox book ASP.NET MVC Website Programming Problem Design Solution by Nicholas Berardi, Al Katawazi, and Marco Bellinaso; ISBN: 9780470410950 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

July 9th, 2010, 03:22 PM
|
|
Authorized User
|
|
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
|
|
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
|
|

July 10th, 2010, 05:04 AM
|
|
Authorized User
|
|
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
|
|
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>
|
|

July 10th, 2010, 11:51 AM
|
|
Authorized User
|
|
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Anyone to help? I really need help
It's urgent
|
|

July 10th, 2010, 01:03 PM
|
|
Authorized User
|
|
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
|
|
|
|

October 25th, 2010, 12:49 PM
|
|
Registered User
|
|
Join Date: Oct 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you
Thanks for bring up and providing the rsolution. It worked for me too. 
|
|
 |