Solved

web.config error allowDefinition='MachineToApplication'

Posted on 2006-11-03
22
852 Views
Last Modified: 2008-02-01
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

0
Comment
Question by:shwaqar82
  • 11
  • 10
22 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 17868231
first try opening IIS, browsing to your project directory and make sure it is configured as an application
0
 
LVL 5

Expert Comment

by:jbarber2005
ID: 17868234
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
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17868255
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
0
 

Author Comment

by:shwaqar82
ID: 17868348
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\
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17868397
you only needed to click "Create" button if it was there
0
 

Author Comment

by:shwaqar82
ID: 17868405
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
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17868407
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
0
 

Author Comment

by:shwaqar82
ID: 17868424
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 ...
0
 

Author Comment

by:shwaqar82
ID: 17868482
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)
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17868549
is restrictedpages your application name or CallForm?
0
 

Author Comment

by:shwaqar82
ID: 17868621
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.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 35

Expert Comment

by:YZlat
ID: 17868630
I see...

either move web.config to CallForm folder or configure restrictedpages as an application through IIS
0
 

Author Comment

by:shwaqar82
ID: 17868768
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
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17869151
where did you put authentication tags?
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17869162
is restrictedpages directory configured as an application?

does it have web.config file?
0
 

Author Comment

by:shwaqar82
ID: 17869440
i put authentication tags in restrictedpages's web.config file. Yes i configured restrictedpages directory as an application to IIS
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17869517
0
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 17869536
another thing you can try is add the <location> tags to the config file in CallForm directory and put there authentication infor for restricted folder. Then delete config file from the restricted directory
0
 

Author Comment

by:shwaqar82
ID: 17869594
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
0
 

Author Comment

by:shwaqar82
ID: 17869795
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"
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17869943
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
0
 

Author Comment

by:shwaqar82
ID: 17870158
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
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now