Link to home
Start Free TrialLog in
Avatar of shwaqar82
shwaqar82

asked on

web.config error allowDefinition='MachineToApplication'

Hi Experts

Im recieving the below error and no one gives me satisfactory answer. I visited several google pages still cant find out whats wrong in it. I cant express how depress im to solve this problem. I really need your help guys :(

Server Error in '/CallForm' 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 16:       </customErrors>
Line 17:
Line 18:       <authentication mode="Forms">
Line 19:        
Line 20:       </authentication>

Source File: C:\Inetpub\wwwroot\CallForm\restrictedpages\web.config    Line: 18

Let me tell you what im trying to do. I already have a working application in asp.net using vb.net. Users can access to this web site without registration process or login. Now i need to make folder in my application and make this folder to be accessible for registered user.
For that  what i did is...i made new folder in my application...then i create this folder an application to IIS through configuration tab in IIS's application properties. I have 3 files in my folder(RestritedFolder) including web.config. That web.config has following attributes in it:

<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
      <customErrors mode="Off">
       
      </customErrors>

      <authentication mode="Forms">
      </authentication>
</system.web>
</configuration>

CAN ANYBODY FIX IT OR TELL ME THE OTHER WAY I CAN DIRECT THE REGISTERED USER ONLY TO ACCESS WEB PAGES IN THAT FOLDER.
Any alternative or any solution will be acceptable

Avatar of YZlat
YZlat
Flag of United States of America image

first try opening IIS, browsing to your project directory and make sure it is configured as an application
Avatar of jbarber2005
jbarber2005

you have to create a virtual directory in IIS

1) Open IIS
2) Expand Web Sites
3) Expand Default Web Sites (it could be renamed, or have multiple here)
4) right click on the directory CallForm and choose properties
5) On the first tab click the button "Create", then click ok
6) refresh your web app
go to Control Panel->Administrative Tools ->Internet Information Services

Expand Web Sites node, then expand default web site node.
Find your application folder and right-click on it and select properties.
Select Directory tab and look for a textbox that says "Application name" next to it. Click on the "Create" button that is right next to that textbox
Avatar of shwaqar82

ASKER

Hey oh my god i loose my application now. It already configured as an application. I just clicked on remove button and press create button ...and now i just lost everything ....i got bunch of errors

Start with the first one:

Error      1      C:\Inetpub\wwwroot\CallForm\RestrictedPages\Default.aspx: ASP.NET runtime 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:\Inetpub\wwwroot\CallForm\restrictedpages\web.config line 18)      C:\Inetpub\wwwroot\CallForm\RestrictedPages\Default.aspx      1      1      C:\...\CallForm\
you only needed to click "Create" button if it was there
Warning      3      Namespace or type specified in the Imports 'System.Web.Caching' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.      C:\Inetpub\wwwroot\CallForm\RestrictedPages\Default.aspx      5      1      C:\...\CallForm\


Thats the another warning i recieved
then the problem must be in your code - sometimes when you get error in web.config it may mean the problem is in the code itself
there was no create button available as application is already being configured as an application. The remove button is availible. What i did is clicked on remove button which in turn make 'Create' button availible for me and then i clicked on Create button to make it application ...
which code............? i just create Default.aspx in it. And it has nothing in it inside.

My application hirarchy is like that.

MyMainApplication(configured as an application having web.config)--->RistrictedPages(is a sub folder configured as an application inside MyMainApplication having web.config in it)
is restrictedpages your application name or CallForm?
well CallForm is my main application. CallForm has a a sub folder in it along with different sub folders. From IIS i go to CallForm ...then go to RestrictedPages. Right click on RestrictedPages click on new and then 'Virtual Directory' to make this sub folder a sub application to IIS. So you can say that RestrictedPages is a sub application in CallForm which is a main application.
I see...

either move web.config to CallForm folder or configure restrictedpages as an application through IIS
i did that already ...and im pretty sure that that problem is in web.config. This problem occurs only when i put authentication tags in it. The page works fine with web.config in restrictedpages folder without <authentication> tags in it. Seems like the problem is in this tags. Is there any relation of web.config with global.asa ..........? Can i use only one web.config to restrict users to access pages in restrictedpages folder. Is there any other way i can do that

My main concern is to make some pages accessible by authenticated users. My other main concern is to put all that restricted pages in separate folder
where did you put authentication tags?
is restrictedpages directory configured as an application?

does it have web.config file?
i put authentication tags in restrictedpages's web.config file. Yes i configured restrictedpages directory as an application to IIS
ASKER CERTIFIED SOLUTION
Avatar of YZlat
YZlat
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i can we do that by putting the authentication information in CallForm's web.config. Can we still restrict users to access that folder without authentication
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et_compiler -v /appls -p
"E:\Sites WWW\devlappl.intracger"


what is  "E:\Sites WWW\devlappl.intracger"

is that the path to the main application. I have the following path:
C:\Inetpub\wwwroot\CallForm.
What do i put instead of :
"E:\Sites WWW\devlappl.intracger"
you don't get it - <location> tag will specify settings only for the restricted folder, not for the entire application. The rest of the application will not require authentication
i got it and i tried it but it will let me access the page in restrictedpages folder. Do i still have to configure the restrictedpages folder as an application to IIS after removing web.config from it