 |
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 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
|
|
|
|
|

May 15th, 2013, 01:50 PM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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
|
|

May 15th, 2013, 02:47 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

May 22nd, 2013, 06:15 PM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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.....
|
|

May 23rd, 2013, 02:43 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

May 23rd, 2013, 11:59 AM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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
|
|

May 24th, 2013, 03:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

May 24th, 2013, 09:46 AM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Thanks
Added the updated code, just in case I go back to the version with the different spelling of the theme.
Thank you...
|
|
 |
|