Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 January 30th, 2006, 01:53 PM
rat rat is offline
Authorized User
 
Join Date: Jan 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rat
Default Error allowdefinition

Hi
  I am reading beginning ASP.Net2.0 by cris hart and friends.when i am trying to debug a page in chaper 03 it is giving me an error like this

Error 1 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:\Documents and Settings\projects\BEGASNET2\chapters\Begin\Chapter 03\Samples\Web.Config 26

can anyone explain how to solve this problem.

rat

 
Old January 30th, 2006, 05:45 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Is the error message correct? Did you set up the site as an application / virtual directory?

Can you give us some more details about the folder where you stored your web site, and how you configured IIS?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 31st, 2006, 06:39 AM
rat rat is offline
Authorized User
 
Join Date: Jan 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rat
Default

I am using windows-xp home edition.so i do not have access to IIS.
Is there any way to do it without IIS configuration.

rat

 
Old January 31st, 2006, 06:57 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

How do you access the page?

That is, what do you see in the address bar of your browser?

Imar
 
Old January 31st, 2006, 04:23 PM
rat rat is offline
Authorized User
 
Join Date: Jan 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rat
Default

when i start debugging , the address i see is
http://localhost:1352/Chapter03/WroxUnited/Default.aspx

rat

 
Old January 31st, 2006, 04:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right. And where is web.config stored? And what code does it contain?

I think it also makes a difference when you open the site at WroxUnited, and not at Chapter03. That way, WroxUnited is the root of your site....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 31st, 2006, 04:40 PM
rat rat is offline
Authorized User
 
Join Date: Jan 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rat
Default

There are two web.config
one is at the root level of chapter-03 that is Web.Config
and another one is in the wroxunited folder under chaper-03 that is web.config

 
Old January 31st, 2006, 04:56 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right. In that case, both are applied, and you get this error.

To fix this, remove the one from wroxunited (copy its contents to the other) or open the website so that WroxUnited as the root.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 31st, 2006, 09:00 PM
rat rat is offline
Authorized User
 
Join Date: Jan 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rat
Default

how to combine two.the code is here can you please help me


<?xml version="1.0"?>
<!-- Note: As an alternative to hand editing this file you can use the web admin tool to
     configure settings for your application. Use the Website->Asp.Net Configuration option
     in Visual Studio.
     A full list of settings and comments can be found in machine.config.comments usually
     located in \Windows\Microsft.Net\Frameworks\v2.x\Config -->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <!--
    Mode defines certain feature availability:
      Full: No restrictions
      Real: Runs as if a real site, without the view code, download and user/role view links
  -->
  <appSettings>
    <add key="mode" value="Full" />
  </appSettings>

    <!--
        define the connection string to the database
    -->
  <connectionStrings>
     <add name="WroxUnited"
      connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|WroxUnited.mdf;Integrated Security=True;User Instance=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>

    <httpModules>
      <add name="Page" type="Wrox.Web.GlobalEvents.ThemeModule" />
    </httpModules>

    <!--
            Set compilation debug="true" to insert debugging symbols into the compiled page.
            Because this affects performance, set this value to true only during development.
        -->
    <compilation debug="true">
    </compilation>
    <!--
            Set forms authentication and define the login page
        -->
    <authentication mode="Forms">
      <forms loginUrl="Default.aspx" />
    </authentication>
    <!--
            Enable the role manager
            This controls access to pages and the visibility of certain menu items
        -->
    <roleManager enabled="true"/>
    <anonymousIdentification enabled="true"/>
    <!--
            The <customErrors> section enables configuration of what to do if/when an unhandled
            error occurs during the execution of a request. Specifically, it enables developers
            to configure html error pages to be displayed in place of a error stack trace.
        -->

        <customErrors mode="RemoteOnly">
      <error statusCode="404" redirect="missingPage.aspx"/>
        </customErrors>

    <!--
            Redefine the Site Map Provider, to add the security trimming attribute,
            which is off by default
        -->
    <siteMap defaultProvider="AspXmlSiteMapProvider" enabled="true">
      <providers>
        <clear/>
        <add name="AspXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
          siteMapFile="web.sitemap" securityTrimmingEnabled="true"/>
      </providers>
    </siteMap>

    <!--
            Define the SMTP Mail server settings
            Required for the PasswordRecovery control (and possibly mailshots)
        <smtpMail from="admin@wroxunited.com" serverName="your_smtp_server">
            <fields>
            </fields>
        </smtpMail>
        -->
    <!--
            Define the user profile properties
        -->
    <profile enabled="true">
      <properties>
        <add name="MemberName"/>
        <add name="Name"/>
        <add name="Address"/>
        <add name="City"/>
        <add name="County"/>
        <add name="PostCode"/>
        <add name="Country"/>
        <add name="Mailings" type="System.Boolean"/>
        <add name="Email"/>
        <add name="Theme"/>
        <add name="Cart" serializeAs="Binary" type="Wrox.Commerce.ShoppingCart" allowAnonymous="true"/>
      </properties>
    </profile>

  </system.web>
</configuration>


at root level one's code is

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
        <compilation debug="true"/>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
        <authentication mode="Windows"/>
        <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    </system.web>
</configuration>

rat



 
Old February 1st, 2006, 12:52 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

First of all, it's a lot easier to open the WroxUnited folder as the root of your site. That way, you don't need to configure anything.

I wouldn't be surprised if that was also the intention of the writers, although I can't be sure since I don't have the book.

That said, the easiest thing to do is create an entirely new Config file (choose Add New Item from the project's context menu). Then copy each setting one by one in the appropriate locations. E.g. <appSettings> keys should be copied to <appSettings> and so on.

Be aware that if you copy site specific settings to the web.config in the root, ALL applications under that root will inherit those settings. So, once you're done, all sites will have a Profile for example. Not sure if that's what you want.

Cheers,

Imar





Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR allowDefinition='MachineToApplication' adamcherochak ASP.NET 2.0 Basics 6 September 7th, 2007 05:43 PM
allowDefinition='MachineToApplication' Error gp2p BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 May 19th, 2007 08:01 PM
allowDefinition='machineToApplication'beyond app enzoinbath BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 November 5th, 2006 03:25 PM
problem with allowDefinition='MachineToApplication juliaw .NET Framework 2.0 2 June 12th, 2006 10:44 AM
allowDefinition='MachineToApplication' tripathi.vipul ASP.NET 1.0 and 1.1 Basics 0 May 13th, 2006 06:11 AM





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