Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 15th, 2013, 01:50 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Default Start with Chapter 8 website?

Wanting to start fresh with the source from Chapter 8.

I created a new website, and then did a File, Add, Existing Web Site and selected: C:\BegASPNET\Source\Chapter 08.

Then I preview (control-F5) default.aspx and it gives me:

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The file '/Chapter 09/Site/Controls/Banner.ascx' does not exist.

----
is there a better way to get a fresh start with the chapter 8 website?

Derek
Reply With Quote
  #2 (permalink)  
Old May 15th, 2013, 02:47 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Did you add files from the existing website? Or did you open the web site? Your description seems to suggest you added files to an existing site rather than opening the entire site.

To open the site correctly, choose File | Open Existing Web Site and then browse to the folder. The introduction of the book, before Chapter 1, has the full details.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
detnyre (May 23rd, 2013)
  #3 (permalink)  
Old May 22nd, 2013, 06:15 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Default Thanks... but..

Thanks!
Was able to open and preview chapters 1 through 5.
Having problem previewing chapters 6 and greater.

I'm using Microsoft Visual Studio Express 2012.

When I open Chapter 6 by doing a File, Open Web site, and then preview default.aspx, it tells me:

================================================== ======
Server Error in '/Chapter 06' Application.
Theme 'DarkGray' cannot be found in the application or global theme directories.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Theme 'DarkGray' cannot be found in the application or global theme directories.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpException (0x80004005): Theme 'DarkGray' cannot be found in the application or global theme directories.]
System.Web.Compilation.ThemeDirectoryCompiler.GetT hemeBuildResultType(String themeName) +853
System.Web.Compilation.ThemeDirectoryCompiler.GetT hemeBuildResultType(HttpContext context, String themeName) +67
System.Web.UI.Page.InitializeThemes() +9644018
System.Web.UI.Page.PerformPreInit() +38
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +335


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18033
================================================== =====

Checked the solution explorer and see the App_Themes folder with the Monochrome and DarkGrey folders in it.

Not sure what to do to fix this.....
Reply With Quote
  #4 (permalink)  
Old May 23rd, 2013, 02:43 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

It sounds like you've been following along with your own code and then used DarkGray with an a as the Theme name. Now when the code tries to set a theme it does find a cookie, but it's value (DarkGray) does not match an existing theme (DarkGrey). Clearing your cookies should resolve the issue.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
detnyre (May 23rd, 2013)
  #5 (permalink)  
Old May 23rd, 2013, 11:59 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Default Thanks...

Thank you - clearing the cookies fixed the problem..

Understand now why it was doing that... cookie was set with value of the theme that did not exist....

Derek
Reply With Quote
  #6 (permalink)  
Old May 24th, 2013, 03:24 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yep; and the DarkGrey versus DarkGray naming just made that harder to spot ;-)

In the .NET 4.5 version of the book and site I modified the code in the BasePage slightly to prevent errors like this from happening:

Code:
private void Page_PreInit(object sender, EventArgs e)
{
  HttpCookie preferredTheme = Request.Cookies.Get("PreferredTheme");
  if (preferredTheme != null)
  {
    string folder = Server.MapPath("~/App_Themes/" + preferredTheme.Value);
    if (System.IO.Directory.Exists(folder))
    {
      Page.Theme = preferredTheme.Value;
    }
  }
}
This code uses Directory.Exists to first check if the Theme folder exists on disk before it tries to set the theme.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old May 24th, 2013, 09:46 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Default Thanks

Added the updated code, just in case I go back to the version with the different spelling of the theme.

Thank you...
Reply With Quote
Reply


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
Chapter 3: Customizing the start page smiller BOOK: Professional Visual Studio 2010 1 August 28th, 2010 08:07 AM
How to start a libary from Visual Studio 2008? (Chapter 42) Matsy BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8 1 July 12th, 2010 10:31 AM
How to Publish WebSite Chapter 3 WroxUnited Sample hdpark BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 October 19th, 2007 08:24 AM
I can't log in in chapter 5 website asptwodev BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 September 13th, 2007 11:12 AM
Start of chapter 6 baz BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 April 28th, 2004 07:53 PM



All times are GMT -4. The time now is 04:41 PM.


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