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: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 September 19th, 2008, 08:21 PM
Registered User
 
Join Date: Aug 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 16: 1st 'Try It Out' Web.config error

Hi Imar,

Selecting Build -> 'Build Website' in VS2008 results in the following 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. C:\BegASPNET\Site\web.config 153

after adding the <profile> code:

<profile>
        <properties>
          <add name="FirstName" />
          <add name="LastName" />
          <add name="DateOfBirth" type="System.DateTime"/>
          <add name="Bio" />
          <add name="FavoriteGenres" type="System.Collections.Generic.List`1[System.Int32]" />
        </properties>
      </profile>



Searching online for solutions to this particular error has yielded results but I have not been able to put them to use (or know which to use as I don't know what is causing this problem).

Thanks!!

Gerard Torres
Reply With Quote
  #2 (permalink)  
Old September 20th, 2008, 04:47 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,

Take a look at page 656 where the error is explained. You probably opened C:\BegASPNET in VWD and tried to browse to http://localhost:123/Site.

Instead, you need to open C:\BegASPNET\Site in VWD so files like web.config are at the root level.

Does this help?

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #3 (permalink)  
Old September 20th, 2008, 05:23 PM
Registered User
 
Join Date: Aug 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for pointing me to the right place. I have not solved the problem although I'm pretty sure I am building the right folder. However, I am going to put this on hold until I read chapter 18 in it's entirety and get a better idea of IIS. So, I'll let you know if it's still a problem for me after that.

Thank you Imar!

Gerard Torres
Reply With Quote
  #4 (permalink)  
Old September 20th, 2008, 10:22 PM
Registered User
 
Join Date: Aug 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay, I've read through chapter 13 and configured IIS and everything else needed (except creating a Release copy of the project since I'm still on ch. 16) and I am still receiving the same error no matter what I do. I should also note that the error only occurs when I have included the <profile> code:

<profile>
        <properties>
          <add name="FirstName" />
          <add name="LastName" />
          <add name="DateOfBirth" type="System.DateTime"/>
          <add name="Bio" />
          <add name="FavoriteGenres" type="System.Collections.Generic.List`1[System.Int32]" />
        </properties>
      </profile>

and if I remove the code the build proceeds just fine. Any ideas?

Gerard Torres
Reply With Quote
  #5 (permalink)  
Old September 21st, 2008, 03:18 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 Gerard,
Quote:
quote:Any ideas?
Yes, the same as before: you're opening the wrong folder. You get this error when a sub folder tries to override an application level setting.

You only get this error with <profile /> as at this stage that's the only "root" element that needs to be defined at the application folder.

Other settings can also be overridden in sub folders that are not marked as an application.

For me it's difficult to say what exactly the problem is as I don't know your setup. Can you send me a screenshot of the Solution Explorer and optionally a copy of the site?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #6 (permalink)  
Old September 21st, 2008, 07:50 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 Gerard,

Thanks for sending me the files. Take a look at the end of the web.config file:
Code:
<location path="Management">
  <system.web>
    <profile>
      <properties>
        <add name="FirstName" />
        <add name="LastName" />
        <add name="DateOfBirth" type="System.DateTime"/>
        <add name="Bio" />
        <add name="FavoriteGenres" type="System.Collections.Generic.List`1[System.Int32]" />
      </properties>
    </profile>
    <authorization>
      <allow roles="Managers"/>
      <deny users="*"/>
    </authorization>
  </system.web>    
</location>
Notice how you added the Profile section to a location element. This is not allowed, resulting in the error you got. Move the <profile /> element to under the main <system.web /> element:
Code:
<configuration>
  <system.web>

    ....

    <profile>
      <properties>
        <add name="FirstName" />
        <add name="LastName" />
        <add name="DateOfBirth" type="System.DateTime"/>
        <add name="Bio" />
        <add name="FavoriteGenres" type="System.Collections.Generic.List`1[System.Int32]" />
      </properties>        
    </profile>

    ....

  </system.web>    

  <location path="Management">
    <system.web>
      <authorization>
        <allow roles="Managers"/>
        <deny users="*"/>
      </authorization>
    </system.web>    
  </location>
</configuration>
Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #7 (permalink)  
Old September 21st, 2008, 09:00 AM
Registered User
 
Join Date: Aug 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh man.. I see. I didn't even think about which system.web I was placing it in because while I was trying to access this problem, I failed to think that I could even access other locations from the main application config file.

Fortunately, the cause of the problem reinforces my understanding of what that error is supposed to mean (rather than confusing me further), which means I'll know what to look for in the future.

Thank you again for helping me learn!

Gerard Torres
Reply With Quote
  #8 (permalink)  
Old September 21st, 2008, 09:35 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 Gerard,

You're welcome. Glad it's working now....


Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
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 16 Beginning php5, apache, mysql, web dev charlie2450 Beginning PHP 1 September 13th, 2008 02:07 AM
Web Forms *i think it's chapter 16 / 17?* ryan.webb BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 September 8th, 2007 09:38 AM
Beg. JSP 2.0 Chapter 16 - Struts web application EdgarRaul JSP Basics 2 August 13th, 2004 01:26 AM
Beg. JSP 2.0 Chapter 16 - Struts web application EdgarRaul JSP Basics 1 August 12th, 2004 02:16 AM



All times are GMT -4. The time now is 08:07 PM.


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