Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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
 
Old May 14th, 2015, 08:29 AM
Registered User
 
Join Date: Mar 2014
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 C# Code Seems to be Self Generating

Ever since I downloaded the code to get the banners, strange errors keep coming up:

I delete<%@ Register Src="~/Controls/ContactForm.ascx" TagPrefix="Wrox" TagName="ContactForm" %>" and "<Wrox:ContactForm runat="server" ID="ContactForm" />" from Contact.aspx and it keeps coming back.

I delete "<Wrox:Banner ID="Banner2" runat="server" DisplayDirection="Horizontal" />" from AboutUs.aspx and it keeps coming back

The element <uc1:Banner ID="Banner1" runat="server" /> in Frontend.master keeps changing to <Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Vertical" /> and the @ Register element keeps disapearing

I delete "Banner2.NavigateUrl = "http://imar.spaanjaars.com";" from AboutUs.aspx.cs and it keeps coming back

I get a compile error: The type or namespace name 'Direction' could not be found (are you missing a using directive or an assembly reference?)
that leads to a bunch of code in Banner.aspx.cs that I subsequently delete and the code keeps coming back.

Then I get a web.config error: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. and lo and behold my web.config.configuration has 30 to 40 lines of code that I delete, and it keeps coming back.

I performed the exact same steps in C# that I did in VB. VB works fine, C# keeps throwing compile errors that have me going around in circles. It's as if there's some weird Wrox virus.

Help!
 
Old May 15th, 2015, 02:36 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This sounds really weird; code shouldn't just disappear and come back. Are you sure you don't have other software running on your machine that changes these files? Have you tried restarting Visual Studio and tried to make changes in another editor (Notepad for example).

With regards to the config error: sounds like a misconfiguration in web.config. Can you post the full code?

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!
 
Old May 15th, 2015, 08:39 AM
Registered User
 
Join Date: Mar 2014
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Figured out both things - sort of

Hi Imar,

Thank you so much for the swift reply.

I had extracted your code to a subfolder called xxCSharp in my solution. When I launch the site the first time, no problem. When I launch it subsequently, for whatever reason, the compiler reports an error referencing the web.config in Chapter 13! Why it works the first time and why it ignores the web.config in the root is way beyond my comprehension. If I ignore the error, it runs just fine except, on occasion
<link href="App_Themes/Monochrome/Monochrome.css" rel="stylesheet" type="text/css" /> was getting plopped into the Content1 element in default.aspx which explains the mishmash in the DarkGrey theme. I thnk.

I moved your code out of the solution folder and I've launched the CSharp site several times now and everything seems peachy. So far...

I love the book by the way - I am finally starting to get how this web thingy works.

Best Regards,
Tim Mulherin

Last edited by tmulher; May 15th, 2015 at 08:42 AM.. Reason: To remove "it" from Figured it out both things...
 
Old May 16th, 2015, 03:12 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> I moved your code out of the solution folder and I've launched the CSharp site several times now and everything seems peachy. So far...

Yeah, that makes sense. When you place a site within another site, the sub site takes it configuration from the main site, which causes all kinds of issues.

Glad you were able to make it work.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating Client Code argyleghost BOOK: Professional WCF 4: Windows Communication Foundation with .NET 4 6 December 29th, 2010 09:42 AM
Chapter 16 Generating Graphics (PHP5) CCIX PHP How-To 1 July 8th, 2005 07:23 AM
error in snapshot generating code (asp) vinodkalpaka Classic ASP Components 2 July 20th, 2004 01:14 AM
error in snapshot generating code (asp) vinodkalpaka Pro VB 6 0 July 19th, 2004 01:19 AM
Chapter 15: Generating DataSet Lieth BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 September 25th, 2003 12:26 PM





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