Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 27th, 2007, 06:40 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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
  #2 (permalink)  
Old February 28th, 2007, 12:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there a "using System.IO"?

  #3 (permalink)  
Old February 28th, 2007, 12:14 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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?

  #4 (permalink)  
Old February 28th, 2007, 12:19 PM
Friend of Wrox
 
Join Date: Aug 2006
Location: , , .
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

  #5 (permalink)  
Old February 28th, 2007, 12:23 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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


  #6 (permalink)  
Old February 28th, 2007, 01:54 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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


  #7 (permalink)  
Old February 28th, 2007, 02:01 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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
================================================== =========
  #8 (permalink)  
Old February 28th, 2007, 04:03 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:37 AM.


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