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 February 27th, 2007, 06:40 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with example code?

Hey All,
I just got ASP 2 Website programming. Im working through chp2. I have downloaded the chapter by chapter example code and am trying to work through the example. I have completed the chapter and when I run my website I get the following error. The code giving the error is code the book suggests, any ideas???

Thanks
Jeremy

ERROR:

Server Error in '/theBeerHouse' Application.
________________________________________
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: CS0103: The name 'Directory' does not exist in the current context

Source Error:


Line 27: string themesDirPath = HttpContext.Current.Server.MapPath("~/App_Themes");
Line 28: // get the array of themes folders under /app_themes
Line 29: string[] themes = Directory.GetDirectories(themesDirPath);
Line 30: for (int i = 0; i <= themes.Length - 1; i++)
Line 31: themes[i] = Path.GetFileName(themes[i]);

Source File: c:\localdev\apps\theBeerHouse\App_Code\Helpers.cs Line: 29
 
Old February 28th, 2007, 12:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there a "using System.IO"?

 
Old February 28th, 2007, 12:14 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey,
Thanks for the response. I dont have the line: "using System.IO" in my helper.cs file. Should I put this somewhere?

 
Old February 28th, 2007, 12:19 PM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to vantoko
Default

Put it on top of the file (where all the other using .... items are

koen

 
Old February 28th, 2007, 12:23 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey,
I added "using system.IO;". Now Im getting the following 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: CS0246: The type or namespace name 'CacheDependency' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 32: themes[i] = Path.GetFileName(themes[i]);
Line 33: // cache the array with a dependency to the folder
Line 34: CacheDependency dep = new CacheDependency(themesDirPath);
Line 35: HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);
Line 36: return themes;


Source File: c:\localdev\apps\theBeerHouse\App_Code\Helpers.cs Line: 34

************************************************** **

As a side note: Is there perhaps a better set of chapter by chapter code for this book? Is it possible that since Im using WebDevExpress I dont have all the functionality required for the site?

Thanks for any input!
Jeremy


 
Old February 28th, 2007, 01:54 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, so I have compiled the entire bit of code for chapter two as supplied by mythicalme. It works. I was attempting to read thru the chapter and copy and paste the bits of code as the text introduces em (who has the time to type every character??!!). Apparently this method doesnt work. Also Ive noticed small differences in the code between the book and mythicalme's code. I really wish that that a working and 'offical' version of the by-chapter code had been provided. It would be useful for learning to be able to build the project incrementally. I am surprised that this wasnt included. I will look for this in the next book i buy.

Thanks all
Jeremy


 
Old February 28th, 2007, 02:01 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

When you have issues with the code that is in the book, check the books Erratta (if there is one) as this normally includes changes to code that did not work and such.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old February 28th, 2007, 04:03 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

right, I shoulda thought of that earlier ...
thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Code behind problem.. shabirmaher General .NET 1 August 12th, 2005 03:09 AM
problem in code HumaMunir BOOK: Beginning Java 2 3 May 16th, 2005 09:19 AM
Problem in Code about "SetValue" arctica82 Pro VB.NET 2002/2003 2 April 15th, 2005 03:39 PM
problem on example code zerocold C# 0 July 15th, 2004 04:19 PM





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