allowDefinition=MachineToApplication and errors switching to VS2008 Express

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • K Viltersten

    allowDefinition=MachineToApplication and errors switching to VS2008 Express

    We have a project working well today and it's developed
    on VS2005. Since we're planing to switch to VS2008 in a
    soon future, i've been trying to move the project to
    VS2008 Express (Web Developer).

    After i've moved over all the files, i run into problems
    compiling and running it. Both versions of VS are run on
    the same computer (with the sam settings, of course).
    Still, when i try to run index.aspx, i get error message
    as follows:

    Error 95 It is an error to use a section
    registered as allowDefinition ='MachineToAppl ication'
    beyond application level.

    It's also suggested that it might be due to that the
    directory isn't configured as an application in the IIS.
    What can be done to resolve it?

    A guide for moving from VS2005 to VS2008 Express would
    be great but i have't found one that is good. Not for
    web-projects, anyway.


    --
    Regards
    Konrad Viltersten
  • Juan T. Llibre

    #2
    Re: allowDefinition =MachineToAppli cation and errors switching to VS2008 Express

    re:
    !when i try to run index.aspx, i get error message as follows:

    !Error 95 It is an error to use a section registered as
    !allowDefinitio n='MachineToApp lication' beyond application level.

    There should be no conflicts when running projects based on VS 2005 in VWD 2008,
    in reference to the "allowDefinitio n='MachineToApp lication' beyond application level" config.

    Both the .Net Framework 2.0 and the .Net Framework 3.5 target the same v2.0.50727
    base configuration files, and don't use different machine.config nor web.config files.

    Did you convert the project when you first opened it in VWD 2008 ?

    re:
    !It's also suggested that it might be due to that the directory isn't
    !configured as an application in the IIS. What can be done to resolve it?

    The ASP.NET DEvelopment Server included with VWD creates a root application
    when it runs your project, so that shouldn't be the root cause for your error.

    I suggest you check the specific setting which is causing the problem in your web.config.

    There's not too many of them:

    <section name="anonymous Identification"
    <section name="authentic ation"
    <section name="healthMon itoring"
    <section name="hostingEn vironment"
    <section name="machineKe y"
    <section name="membershi p"
    <section name="profile"
    <section name="roleManag er"
    <section name="securityP olicy"
    <section name="sessionSt ate"
    <section name="siteMap"
    <section name="trust"
    <section name="urlMappin gs"
    <section name="cache"
    <section name="outputCac he"
    <section name="outputCac heSettings"
    <section name="sqlCacheD ependency"

    If you are using any of those, you need to have a virtual directory,
    at least, or an application, although as mentioned the dev web server
    creates one for you when running your code.

    Look for web.config entries which use those sections and test-delete them.
    ( backup the original web.config so you can restore the original settings...if needed )
    ....until you find the culprit...and post back your results.

    Have you set index.asp as your "Start Page" for your project ?
    Try setting it ( select it in the Solution Explorer, right-click and select "Set as Start Page" ).

    Also, try setting the project's target to .Net Framework 2.0 in the project's property pages,
    instead of the .Net Framework 3.5 ( if you don't need .Net Framework 3.5 features... ),
    if you selected targeting the .Net Framework 3.5 when you converted the project.

    You can always flip it back if that doesn't do anything.
    All that does is change a few entries in web.config.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    =============== =============== ========
    "K Viltersten" <tmp1@vilterste n.comwrote in message news:op.ub2xduc si74t80@lp028.p agero.local...
    We have a project working well today and it's developed
    on VS2005. Since we're planing to switch to VS2008 in a
    soon future, i've been trying to move the project to
    VS2008 Express (Web Developer).

    After i've moved over all the files, i run into problems
    compiling and running it. Both versions of VS are run on
    the same computer (with the same settings, of course).
    Still, when i try to run index.aspx, i get error message
    as follows:

    Error 95 It is an error to use a section
    registered as allowDefinition ='MachineToAppl ication'
    beyond application level.

    It's also suggested that it might be due to that the
    directory isn't configured as an application in the IIS.
    What can be done to resolve it?

    A guide for moving from VS2005 to VS2008 Express would
    be great but i have't found one that is good. Not for
    web-projects, anyway.


    --
    Regards
    Konrad Viltersten


    Comment

    • K Viltersten

      #3
      Re: allowDefinition =MachineToAppli cation and errors switching to VS2008 Express

      !when i try to run index.aspx, i get error message as follows:
      !Error 95 It is an error to use a section registered as
      !allowDefinitio n='MachineToApp lication' beyond application level.
      >
      Did you convert the project when you first opened it inVWD 2008?
      I haven't been asked about any conversions. I simply opened
      VWD2008 Express and opened the SLN-file containig the
      solution i've been working in VS2005. It just got opened
      and the only nag i got was one for converting the line breaks
      to Windows format.
      re:
      !It's also suggested that it might be due to that the directory isn't
      !configured as an application in the IIS. What can be done to resolve
      it?
      >
      I suggest you check the specific setting which is causing theproblem in
      your web.config.
      >
      There's not too many of them:
      >
      <section name="anonymous Identification"
      <section name="authentic ation"
      <section name="healthMon itoring"
      <section name="hostingEn vironment"
      <section name="machineKe y"
      <section name="membershi p"
      <section name="profile"
      <section name="roleManag er"
      <section name="securityP olicy"
      <section name="sessionSt ate"
      <section name="siteMap"
      <section name="trust"
      <section name="urlMappin gs"
      <section name="cache"
      <section name="outputCac he"
      <section name="outputCac heSettings"
      <section name="sqlCacheD ependency"
      As far i could see, there was no "section" tags in my web.config
      file. The line i'm directed to when clicking on the error
      description says:

      <system.web>
      <customErrors defaultRedirect ="Error.aspx " mode="RemoteOnl y"/>
      BELOW IS THE LINE
      <authenticati on mode="Forms">
      ABOVE IS THE LINE
      <forms timeout="10000"/>
      </authentication>
      <compilation debug="true">
      <assemblies>
      <add assembly="Syste m.DirectoryServ ices, Version=2.0.0.0 , Culture=neutral ,
      PublicKeyToken= B03F5F7F11D50A3 A"/>
      </assemblies>
      </compilation>
      </system.web>




      --
      Regards
      Konrad Viltersten

      Comment

      • Juan T. Llibre

        #4
        Re: allowDefinition =MachineToAppli cation and errors switching to VS2008 Express

        re:
        !I haven't been asked about any conversions. I simply opened VWD2008 Express
        !and opened the SLN-file containing the solution i've been working in VS2005.
        !It just got opened and the only nag i got was one for converting the line breaks to Windows format.

        That's really odd.

        Everytime I create a project in VS 2005 and later open
        the .sln file with VWD, the conversion wizard runs.

        re:
        !As far i could see, there was no "section" tags in my web.config file.

        There wouldn't be. Those sections go into the machine.config file.
        What I asked you was to check whether you web.config contained references to those objects.

        re:
        !The line i'm directed to when clicking on the error description says:

        !<authenticatio n mode="Forms">

        Yes, that's the reference to <section name="authentic ation".

        What authentication code do you have in your app ?
        Do you have a logon page which requests credentials from your users ?

        Here's a complete example to test the authentication capability you seem to be missing:

        Could you create a new project in VWD, copy the 3 files
        I included in web.zip into the new project and run *default.aspx*
        by right-clicking it in the Solution Explorer and selecting "View in Browser" ?

        ....and then post back the results of your test ?

        You should get prompted for authentication.
        Use "tmp1@vilterste n.com" for both the username and the password.

        You should first be sent to login.aspx and then, after inputting the credentials above,
        be redirected to login.aspx where the username "tmp1@vilterste n.com" will be displayed.

        In case you can't download zip files, here's the text of the files :

        web.config:
        -----------------
        <?xml version="1.0"?>
        <configuratio n>
        <appSettings/>
        <connectionStri ngs/>
        <system.web>
        <compilation debug="true" strict="false" explicit="true" >
        </compilation>
        <pages>
        <namespaces>
        <clear/>
        <add namespace="Syst em"/>
        <add namespace="Syst em.Collections"/>
        <add namespace="Syst em.Collections. Specialized"/>
        <add namespace="Syst em.Configuratio n"/>
        <add namespace="Syst em.Text"/>
        <add namespace="Syst em.Text.Regular Expressions"/>
        <add namespace="Syst em.Web"/>
        <add namespace="Syst em.Web.Caching"/>
        <add namespace="Syst em.Web.SessionS tate"/>
        <add namespace="Syst em.Web.Security "/>
        <add namespace="Syst em.Web.Profile"/>
        <add namespace="Syst em.Web.UI"/>
        <add namespace="Syst em.Web.UI.WebCo ntrols"/>
        <add namespace="Syst em.Web.UI.WebCo ntrols.WebParts "/>
        <add namespace="Syst em.Web.UI.HtmlC ontrols"/>
        </namespaces>
        </pages>
        <!--
        The <authentication section enables configuration
        of the security authentication mode used by
        ASP.NET to identify an incoming user.
        -->
        <authenticati on mode="Forms">
        <forms loginUrl="login .aspx" name=".ASPXFORM SAUTH">
        </forms>
        </authentication>
        <authorizatio n>
        <deny users="?"/>
        </authorization>
        </system.web>
        <system.codedom >
        </system.codedom>
        <system.webServ er>
        </system.webServe r>
        </configuration>
        -----------------------

        default.aspx:
        ------------------
        <%@ Page Language="VB" %>
        <html>
        <head>
        <title>Forms Authentication - Default Page</title>
        </head>

        <script runat="server">
        Sub Page_Load(ByVal Src As Object, ByVal e As EventArgs)
        Welcome.Text = "Hello, " & Context.User.Id entity.Name
        End Sub

        Sub Signout_Click(B yVal sender As Object, ByVal e As EventArgs)
        FormsAuthentica tion.SignOut()
        Response.Redire ct("Login.aspx" )
        End Sub
        </script>

        <body>
        <h3>
        Using Forms Authentication</h3>
        <asp:Label ID="Welcome" runat="server" />
        <form id="Form1" runat="server">
        <asp:Button ID="Submit1" OnClick="Signou t_Click"
        Text="Sign Out" runat="server" /><p>
        </form>
        </body>
        </html>
        ------------

        login.aspx:
        -----------------
        <%@ Page Language="VB" %>
        <%@ Import Namespace="Syst em.Web.Security " %>

        <script runat="server">
        Sub Logon_Click(ByV al sender As Object, ByVal e As EventArgs)
        If ((UserEmail.Tex t = "tmp1@vilterste n.com") And _
        (UserPass.Text = "tmp1@vilterste n.com")) Then
        FormsAuthentica tion.RedirectFr omLoginPage _
        (UserEmail.Text , Persist.Checked )
        Else
        Msg.Text = "Invalid credentials. Please try again."
        End If
        End Sub
        </script>

        <html>
        <head id="Head1" runat="server">
        <title>Forms Authentication - Login</title>
        </head>
        <body>
        <form id="form1" runat="server">
        <h3>
        Logon Page</h3>
        <table>
        <tr>
        <td>
        E-mail address:</td>
        <td>
        <asp:TextBox ID="UserEmail" runat="server" /></td>
        <td>
        <asp:RequiredFi eldValidator ID="RequiredFie ldValidator1"
        ControlToValida te="UserEmail"
        Display="Dynami c"
        ErrorMessage="C annot be empty."
        runat="server" />
        </td>
        </tr>
        <tr>
        <td>
        Password:</td>
        <td>
        <asp:TextBox ID="UserPass" TextMode="Passw ord"
        runat="server" />
        </td>
        <td>
        <asp:RequiredFi eldValidator ID="RequiredFie ldValidator2"
        ControlToValida te="UserPass"
        ErrorMessage="C annot be empty."
        runat="server" />
        </td>
        </tr>
        <tr>
        <td>
        Remember me?</td>
        <td>
        <asp:CheckBox ID="Persist" runat="server" /></td>
        </tr>
        </table>
        <asp:Button ID="Submit1" OnClick="Logon_ Click" Text="Log On" runat="server" />
        <p>
        <asp:Label ID="Msg" ForeColor="red" runat="server" />
        </p>
        </form>
        </body>
        </html>
        -----------

        Running those 2 pages with the web.config will tell you if
        the problem is with VWD...or with your authentication code.

        Please post back the results of the test, OK ?



        Juan T. Llibre, asp.net MVP
        asp.net faq : http://asp.net.do/faq/
        foros de asp.net, en español : http://asp.net.do/foros/
        =============== =============== ========
        "K Viltersten" <tmp1@vilterste n.comwrote in message news:op.ub26ikb xi74t80@lp028.p agero.local...
        !when i try to run index.aspx, i get error message as follows:
        !Error 95 It is an error to use a section registered as
        !allowDefinitio n='MachineToApp lication' beyond application level.
        >
        Did you convert the project when you first opened it inVWD 2008?
        I haven't been asked about any conversions. I simply opened
        VWD2008 Express and opened the SLN-file containig the
        solution i've been working in VS2005. It just got opened
        and the only nag i got was one for converting the line breaks
        to Windows format.
        re:
        !It's also suggested that it might be due to that the directory isn't
        !configured as an application in the IIS. What can be done to resolve
        it?
        >
        I suggest you check the specific setting which is causing theproblem in
        your web.config.
        >
        There's not too many of them:
        >
        <section name="anonymous Identification"
        <section name="authentic ation"
        <section name="healthMon itoring"
        <section name="hostingEn vironment"
        <section name="machineKe y"
        <section name="membershi p"
        <section name="profile"
        <section name="roleManag er"
        <section name="securityP olicy"
        <section name="sessionSt ate"
        <section name="siteMap"
        <section name="trust"
        <section name="urlMappin gs"
        <section name="cache"
        <section name="outputCac he"
        <section name="outputCac heSettings"
        <section name="sqlCacheD ependency"
        As far i could see, there was no "section" tags in my web.config
        file. The line i'm directed to when clicking on the error
        description says:

        <system.web>
        <customErrors defaultRedirect ="Error.aspx " mode="RemoteOnl y"/>
        BELOW IS THE LINE
        <authenticati on mode="Forms">
        ABOVE IS THE LINE
        <forms timeout="10000"/>
        </authentication>
        <compilation debug="true">
        <assemblies>
        <add assembly="Syste m.DirectoryServ ices, Version=2.0.0.0 , Culture=neutral ,
        PublicKeyToken= B03F5F7F11D50A3 A"/>
        </assemblies>
        </compilation>
        </system.web>




        --
        Regards
        Konrad Viltersten





        Comment

        • K Viltersten

          #5
          Re: allowDefinition =MachineToAppli cation and errors switching to VS2008 Express

          What authentication code do you have in your app ?
          Do you have a logon page which requests credentialsfrom your users?
          Yes, that's what we used.
          Here's a complete example to test the authenticationc apability you seem
          to be missing:
          >
          Could you create a new project in VWD, copy the 3 files
          I included in web.zip into the new project and run*default.asp x* by
          right-clicking it in the SolutionExplore r and selecting "View in
          Browser" ?
          When i log in suing my e-mail i get to see the follwing
          text piece.

          Using Forms Authentication
          Hello, tmp1@viltersten .com

          When i log in using other nick/password i get the red
          error message as follows.

          Invalid credentials. Please try again.
          You should get prompted for authentication.
          Use "tmp1@vilterste n.com" for both the username and thepassword.
          >
          You should first be sent to login.aspx and then, afterinputting the
          credentials above, be redirected tologin.aspx where the username
          "tmp1@vilterste n.com"will be displayed.
          Yes, except that i get sent to default.aspx at the
          successful login, not login.apsx. Perhaps that's what
          you ment?
          Running those 2 pages with the web.config will tell you if
          the problem is with VWD...or with your authentication code.
          Please post back the results of the test, OK ?
          Well, what do you think?

          --
          Regards
          Konrad Viltersten

          Comment

          • Juan T. Llibre

            #6
            Re: allowDefinition =MachineToAppli cation and errors switching to VS2008 Express

            re:
            !Yes, except that i get sent to default.aspx at the
            !successful login, not login.apsx. Perhaps that's what you ment?

            Yes, that's what I meant.

            re:
            !When i log in suing my e-mail i get to see the follwing text piece.
            !Using Forms Authentication
            !Hello, tmp1@viltersten .com
            !When i log in using other nick/password i get the red error message as follows.
            !Invalid credentials. Please try again.
            !Well, what do you think?

            That means that you don't have a problem with whether authentication works or not.

            As the example shows, authentication works when you create a new project in VWD
            and run it with the development server, even if the project is not marked as an application.

            It looks like you have a problem with your application's configuration,
            inherited from your old project, especially since you say you did not
            convert the project to VWD 2008 ( which you should have been prompted to do ).

            What I'd suggest is for you to create a new project in VWD,
            and add your old project's files one by one with "Add existing item".

            Whatever the problem is with your application's configuration should go away that way.
            From then on, you should be able to continue developing the app in the new project.



            Juan T. Llibre, asp.net MVP
            asp.net faq : http://asp.net.do/faq/
            foros de asp.net, en español : http://asp.net.do/foros/
            =============== =============== ========
            "K Viltersten" <tmp1@vilterste n.comwrote in message news:op.ub39fdy ai74t80@lp028.p agero.local...
            >What authentication code do you have in your app ?
            >Do you have a logon page which requests credentialsfrom your users?
            >
            Yes, that's what we used.
            >
            >Here's a complete example to test the authentication capability you seem to be missing:
            >>
            >Could you create a new project in VWD, copy the 3 files
            >I included in web.zip into the new project and run*default.asp x* by right-clicking it in the SolutionExplore r and
            >selecting "View in Browser" ?
            >
            When i log in suing my e-mail i get to see the follwing
            text piece.
            >
            Using Forms Authentication
            Hello, tmp1@viltersten .com
            >
            When i log in using other nick/password i get the red
            error message as follows.
            >
            Invalid credentials. Please try again.
            >
            >You should get prompted for authentication.
            >Use "tmp1@vilterste n.com" for both the username and thepassword.
            >>
            >You should first be sent to login.aspx and then, afterinputting the credentials above, be redirected tologin.aspx
            >where the username "tmp1@vilterste n.com"will be displayed.
            >
            Yes, except that i get sent to default.aspx at the
            successful login, not login.apsx. Perhaps that's what
            you ment?
            >
            >Running those 2 pages with the web.config will tell you if
            >the problem is with VWD...or with your authentication code.
            >Please post back the results of the test, OK ?
            >
            Well, what do you think?
            >
            --
            Regards
            Konrad Viltersten

            Comment

            Working...