Form Authentication error in IIS
<pre><code>Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

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.

Source Error: 


Line 59:             ASP.NET to identify an incoming user. 
Line 60:         --&gt;
Line 61:     &lt;authentication mode="Forms"&gt;
Line 62:       &lt;forms loginUrl="Login.aspx" name=".ASPXAUTH" defaultUrl="Login.aspx" protection="All" path="/"&gt;&lt;/forms&gt;
Line 63:     &lt;/authentication&gt;

Source File: D:\Etool Project\ERecruitmentfinal2\WebClient\web.config    Line: 61 


Show Additional Configuration Errors: D:\Etool Project\ERecruitmentfinal2\WebClient\web.config 
</code></pre>

<p>this is the error i am getting while configuring the files in iis as virtual directory.I tried to configure the virtual directory in iis and make the form authentication to be enabled but it also showing the error: <strong>Configuration section not allowed to be set below application</strong></p>

<p>My web.config file is</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key="smtpcon" value="smtp.gmail.com"&gt;&lt;/add&gt;
    &lt;add key="USERNAME" value="radiantsofthrms@gmail.com"&gt;&lt;/add&gt;
    &lt;add key="PASSWORD" value="Hrms123$"&gt;&lt;/add&gt;
    &lt;add key="LogAudit" value="true"&gt;&lt;/add&gt;
    &lt;add key="PhotoURL" value="http://localhost/photo/"&gt;&lt;/add&gt;
  &lt;/appSettings&gt;
    &lt;connectionStrings&gt;
        &lt;add name="PORTAL" providerName="System.Data.SqlClient" connectionString="Password=sql;User ID=sa;Data Source=(local);database=Etool;" /&gt;
    &lt;/connectionStrings&gt;
  &lt;location path="Css"&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow users="*" /&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;
  &lt;location path="Js"&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow users="*" /&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;
  &lt;location path="images"&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow users="*" /&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;
  &lt;location path="ForgotPassword.aspx"&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow users="*" /&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;
    &lt;system.web&gt;
        &lt;!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        --&gt;
        &lt;compilation debug="true" targetFramework="4.0"&gt;
            &lt;assemblies&gt;
                &lt;add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
                &lt;add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /&gt;
                &lt;add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
                &lt;add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /&gt;
            &lt;/assemblies&gt;
        &lt;/compilation&gt;
        &lt;!--
            The &lt;authentication&gt; section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        --&gt;
    &lt;authentication mode="Forms"&gt;
      &lt;forms loginUrl="Login.aspx" name=".ASPXAUTH" defaultUrl="Login.aspx" protection="All" path="/"&gt;&lt;/forms&gt;
    &lt;/authentication&gt;
    &lt;machineKey validationKey="282487E295028E59B8F411ACB689CCD6F39DDD21E6055A3EE480424315994760ADF21B580D8587DB675FA02F79167413044E25309CCCDB647174D5B3D0DD9141" decryptionKey="8B6697227CBCA902B1A0925D40FAA00B353F2DF4359D2099" validation="SHA1" /&gt;
    &lt;authorization&gt;
      &lt;deny users="?" /&gt;
      &lt;allow users="*" /&gt;
    &lt;/authorization&gt;
        &lt;!--
            The &lt;customErrors&gt; 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.

        &lt;customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"&gt;
            &lt;error statusCode="403" redirect="NoAccess.htm" /&gt;
            &lt;error statusCode="404" redirect="FileNotFound.htm" /&gt;
        &lt;/customErrors&gt;
        --&gt;
        &lt;httpRuntime requestValidationMode="2.0" /&gt;
        &lt;pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" validateRequest="false" /&gt;
    &lt;/system.web&gt;
    &lt;system.webServer&gt;
        &lt;defaultDocument&gt;
            &lt;files&gt;
                &lt;add value="login.aspx" /&gt;
            &lt;/files&gt;
        &lt;/defaultDocument&gt;
        &lt;directoryBrowse enabled="true" /&gt;
    &lt;/system.webServer&gt;
&lt;/configuration&gt;
</code></pre>
