virtual directory not being configured as an application error in asp.net app

Discussion in 'ASP .Net' started by Tim Zych, Dec 23, 2003.

  1. Tim Zych

    Tim Zych Guest

    Does anybody know what's wrong with this authentication?

    I'm following the book ASP.Net Kick Start's advice....

    1) Create a new ASP.Net app

    2) Create a web.config file in the root directory with the following:
    <configuration>
    <system.web>
    <authentication mode="Forms" />
    </system.web>
    </configuration>

    3) Create a folder called "Secret Files" and in it add a WebForm called
    Secret.aspx and another Web.Config file.
    The web.config file contains:
    <configuration>
    <system.web>
    <authorization>
    <deny users="?" />
    </authorization>
    </system.web>
    </configuration>

    and the Secret.aspx file has a label indicating success if we are redirected
    to that page.

    4) Add a page called Login.aspx that contains a 2 textboxes (txtUsername and
    txtPassword) and a button.

    The button_click event has the following code:

    Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    If txtUsername.Text = "tim" And txtPassword.Text = "password" Then
    System.Web.Security.FormsAuthentication. _
    RedirectFromLoginPage(txtPassword.Text, False)
    Else
    Label1.Text = "Invalid Username/Password"
    End If
    End Sub


    When I run this *inside* Visual Studio, it seems to work OK. But when I
    replicate this into another asp.net folder, I get the error:
    ----------------------------------------------------------------------------
    Parser Error Message: 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.
    ----------------------------------------------------------------------------

    Apparently the framework doesn't like the web.config file in the root
    directory.
    <authentication mode="Forms" /> is highlighted in the error message.

    How can I fix this?

    Thanks.
     
    Tim Zych, Dec 23, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TM
    Replies:
    2
    Views:
    623
  2. =?Utf-8?B?UGF1bA==?=

    Virtual directory not configured as an application

    =?Utf-8?B?UGF1bA==?=, Dec 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    20,482
    =?Utf-8?B?UGF1bA==?=
    Dec 22, 2004
  3. scott
    Replies:
    1
    Views:
    1,069
    scott
    Jun 12, 2006
  4. Adam Sandler
    Replies:
    0
    Views:
    402
    Adam Sandler
    Jan 22, 2007
  5. Tim Mackey
    Replies:
    1
    Views:
    611
    Tim Mackey
    Jan 23, 2007
Loading...

Share This Page