Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 885
  • Last Modified:

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

0
shwaqar82
Asked:
shwaqar82
  • 11
  • 10
1 Solution
 
YZlatCommented:
first try opening IIS, browsing to your project directory and make sure it is configured as an application
0
 
jbarber2005Commented:
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
 
YZlatCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
shwaqar82Author Commented:
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
 
YZlatCommented:
you only needed to click "Create" button if it was there
0
 
shwaqar82Author Commented:
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
 
YZlatCommented:
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
 
shwaqar82Author Commented:
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
 
shwaqar82Author Commented:
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
 
YZlatCommented:
is restrictedpages your application name or CallForm?
0
 
shwaqar82Author Commented:
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
 
YZlatCommented:
I see...

either move web.config to CallForm folder or configure restrictedpages as an application through IIS
0
 
shwaqar82Author Commented:
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
 
YZlatCommented:
where did you put authentication tags?
0
 
YZlatCommented:
is restrictedpages directory configured as an application?

does it have web.config file?
0
 
shwaqar82Author Commented:
i put authentication tags in restrictedpages's web.config file. Yes i configured restrictedpages directory as an application to IIS
0
 
YZlatCommented:
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
 
shwaqar82Author Commented:
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
 
shwaqar82Author Commented:
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
 
YZlatCommented:
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
 
shwaqar82Author Commented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 11
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now