Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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
 
Old September 19th, 2006, 12:51 AM
Registered User
 
Join Date: Sep 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems in Chapter 2 - Default.aspx

I'm getting the following error in my Default.aspx file

Error 2 C:\VSStudioProjects\TheBeerHouse\Default.aspx: ASP.NET runtime error: The file '/TheBeerHouse/Template.master' cannot be processed because the code directory has not yet been built. C:\VSStudioProjects\TheBeerHouse\Default.aspx 1 1 C:\VSStudioProjects\TheBeerHouse
Why is it looking for "/TheBeerHouse/Template.master" when my project is in C:\VSStudioProjects\TheBeerHouse?

Here is the content of my Default.aspx file, where everything has relative path names in it. Thanks in advance.

Nick

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Template.master" CodeFile="Default.aspx.cs" Inherits="_Default" Title="The Beer House" %>

<asp:Content ID="Content1" ContentPlaceHolderID="RightContent" Runat="Server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:Image ID="imgBeers" runat="server" ImageUrl="~/Images/3beers.jpg" ImageAlign="left" />
        Lorem ipsum dolor sit amet, consectueture adipiscing elit
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="LeftContent" Runat="Server">
</asp:Content>
 
Old September 19th, 2006, 04:25 PM
Registered User
 
Join Date: Sep 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've made a little progress on the number of errors. I've typed in ALL the code from Chapter 2 but I'm still getting one error preventing me from running the website.

Being an ASP newbie, I could really use some help on finding the source of this error. I'd be happy to ship someone my code (which isn't much) for these first two chapters.

I know my "system" works because I can run the full blown demo from it and it works fine.

Thanks in advance.

Here's the compile error:


Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

Source Error:



Line 12: namespace MB.TheBeerHouse.UI.Controls
Line 13: {
Line 14: public partial class ThemeSelector1: System.Web.UI.UserControl
Line 15: {
Line 16: protected void Page_Load(object sender, EventArgs e)


Source File: c:\VSStudioProjects\TheBeerHouse\Controls\ThemeSel ector.ascx.cs Line: 14



 
Old September 19th, 2006, 07:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The error is telling you exactly what's wrong. A "partial" class implies that it's only one of a set. And this error is clear "the code directory has not yet been built.".

This is a whole site of interconnecting parts. It's not a set of individual pages that happen to live in the same project.

This book is not a step-by-step set of instructions to take a newbie from nothing all the way to being an Enterprise website developer. This book is mostly a design book for experienced ASP.NET developers, and it teaches the new ASP.NET 2.0 features.

Trying to tackle this book is like trying to learn from a Calculus II book before taking Calculus I.

This kind of forum is not good enough to teach you all the basics. Please try a beginning book first. And ask questions in the forum for that book, and it will be easier to help you.

 
Old October 25th, 2006, 08:41 PM
Registered User
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So I'm NOT a newbie, and I don't understand why I am getting this error either. The error message says "the directory has not been yet been built" so does that mean it needs to be created in a separate project and compiled and referenced? And if that IS what this error means, then how do I compile just the master page? And why should I have to do that?? This error doesn't make sense to me. Can someone please enlighten me? Thanks.
 
Old October 25th, 2006, 10:50 PM
Authorized User
 
Join Date: Oct 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Im not a ASP pro but here's what I found:

If you look at the files in the Beer Site, notice that there is both a default.aspx & default.aspx.cs.

I had to redo my code and ensure that the check-box labeled "Place code in seperate file" is checked. If you right-click on the directory, select "add new item", then look for the check-box. Doing this will join the file to its "code-file". Just adding a file with the ".cs" at the end didnt link like when you use the check-box method. At least this way, it creates the associating ".cs" file for you.

Im not sure if it helps but give it a try.:)

 
Old October 25th, 2006, 10:51 PM
Registered User
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok i fixed it. Not entirely sure why it works now and didn't earlier. But here is what I did.

1) Removed the Configuration.cs class and Contact page from project.
2) Closed Solution
3) Re-opened solution
4) Added 2 files back to solution

And that's it! It works! Any idea why this fixed it?

 
Old October 28th, 2006, 10:09 AM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well I think there are diff. scenirio for this kind of error.I was getting same kind of error.

Cause of an error:
(I)If you add an existing .vb or .cs file to a project that we might have copy from other places or has already in other folder to our web site porject.

(II) I deleted existing .vb file that i copied from other folder and manualy created .vb file with same name (at this point i there was no error) and now I copied code from other .vb file(I mean public sub method with business logic) and got error.

So then i manully added pulic sub and business logic no error.

So i conclusion would be it is visual studio 2005 binding bug and it is not consistance.
I'll post more once i found it.



 
Old October 30th, 2006, 11:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I assume you guys know about the app_code folder, and that every file there is automatically compiled? Those don't really have to be "in your project" because every file in every folder (nested as deep as it goes) under app_code is automatically in your ASP.NET 2.0 project.

And you never have to compile before hitting a page with a browser. This is moslty useful if you're using a local IIS instead of the built-in webserver, since it will compile if you press F5 in VS to launch the built-in server.

Similarly, any .cs or .vb file that is NOT in app_code will only be compiled if it's linked from an .aspx page. There's no way to compile a file that isn't attached to an .aspx page unless it's under app_code. But you could make a separate library project to compile them (an ASP.NET 2.0 web project can not).

Whenever you have a problem with a class not being compiled you need to determine what mechanism SHOULD compile it. Also, make sure your namespaces are right.

A true binding problem is visible in the Fusion Log Viewer (fuslogvw.exe), but you likely have compile problems and not binding problems.

Eric






Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is the default.aspx in chapter 1? jkacher BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 February 29th, 2008 02:30 PM
default.aspx Louisa ASP.NET 1.0 and 1.1 Basics 4 October 14th, 2005 11:55 AM
error in default.aspx anass BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 24th, 2005 09:02 PM





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