[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Parser error using masterpages - IIS is looking for a web.config file in the wrong place

Hi Experts,

I have a masterpage and a directory structure like this:

MasterPage.master
Default.aspx
--/deployments
--/deployments/manage.aspx
--/deployments/edit.aspx

The opening default.aspx page works fine, but then if I click on the menu to go to deployments/manage.aspx, I get the following error:

Server Error in '/Blah_v1.2' 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 beow and modify your configuration file appropriately.

Parser Error Message: An error occurred loading a configuration file: Failed to start monitoring changes to 'F:\visual STudio 2005\WebSites\Blah_v1.2\deployments' because the network BIOS command limit has been reached. For more information on this error, please refer to Microsoft knowledge base article 810886. Hosting on a UNC share is not supported for the Windows XP Platform.

Source ERror:
[No relevant source lines]

Source File: F:\Visual Studio 2005\Webites\Blah_v1.2\deployments\web.config    Line:0

So why is it looking for a web.config file in the deployments directory when there is already one at root level?

Do I  have to put my masterpage in its own masterpage directory? Is that what a "secured directory" means?

Thanks,
rss2
0
rss2
Asked:
rss2
  • 5
  • 3
  • 3
1 Solution
 
HappyFunBallCommented:
I'm not sure about the error, but I'd suggest moving the site to a local drive or a test server.

As for master pages, you can reference them using the tilde character (~) which represents the root of the application, so your reference in the manage.aspx can be MasterPageFile="~/MasterPage.master"
0
 
CmdoProg2Commented:
I use a single masterpage with web.config files in the subdirectories and one at the root level.  
Do you have a web.config file in the deployments directory?  Does your root level config have any <location> elements?
0
 
rss2Author Commented:
CmdoProg2, can you tell me a little more about that.. I thought each website app or whatever is supposed to have one web.config file. I don't have a web.config file for each directory..just the one at the root level.

What happens is, when I get the error above, I just keep refreshing until I get the page. It eventually comes back. What's that all about?

What should the web.config file look like for each directory?
thanks!

rss2
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!

 
HappyFunBallCommented:
Sorry to butt in, but you don't need a web.config file for each directory.  You can have one, if you want to change settings for that directory and all directories below it.  Otherwise, the directory will inherit the configuration from the web.config at the root level.
0
 
CmdoProg2Commented:
HappyFunBall is correct that you don't need a web.config file for each directory.  Generally, the subdirectory web.config file is used for page authorization.  It depends upon your needs, but I think your error is neither a masterpage or subdirectory web.config file problem since your page "eventually comes back".  Is your F drive a shared drive?


BTW ... here is an sample subdirectory web.config file.  In the root web.config file, the directory authorization allows anonymous users.  This allows only authenicated users to access the MyAccount page.

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <location path="MyAccount.aspx">
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
  </location>
</configuration>
0
 
rss2Author Commented:
Cool I'm going to try that.

Here is my web.config file that I have a root level. Is there anything wrong here? Like, do I need to specify the SQL Server 2005 provider somewhere? Is my provider wrong? Is the xml statement on the first line incorrect?

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
      <appSettings/>
 
      <connectionStrings>
<!--            <add name="OMDB" connectionString="Data Source=PLATMANDB,10501;Initial Catalog=WintelCFG;Integrated Security=SSPI" providerName="System.Data.SqlClient"/> -->
    <add name="OMDB" connectionString="Data Source=LDNDCM05673V05C\lf3_main3_dev;Initial Catalog=OMDB;Integrated Security=SSPI" providerName="System.Data.SqlClient"/>
            <add name="OMDBConnectionString" connectionString="Data Source=ldndcm05673v05c\lf3_main3_dev;Initial Catalog=OMDB;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="SMSWebReport" connectionString="http://ldnpsm00012cs/SMSReports/Report.asp?ReportID=133;" />
    <add name="DEMO" connectionString="ON;" />
      </connectionStrings>
 
      <system.web>
            <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions
            where data loss can occur.
            Set explicit="true" to force declaration of all variables.
        -->
            <httpHandlers>
                  <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
            </httpHandlers>
            <compilation debug="true" strict="false" explicit="true">
                  <assemblies>
                        <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                        <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                        <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
                  <buildProviders>
                        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
                  </buildProviders>
            </compilation>
            <pages>
                  <namespaces>
                        <clear/>
                        <add namespace="System"/>
                        <add namespace="System.Collections"/>
                        <add namespace="System.Collections.Specialized"/>
                        <add namespace="System.Configuration"/>
                        <add namespace="System.Text"/>
                        <add namespace="System.Text.RegularExpressions"/>
                        <add namespace="System.Web"/>
                        <add namespace="System.Web.Caching"/>
                        <add namespace="System.Web.SessionState"/>
                        <add namespace="System.Web.Security"/>
                        <add namespace="System.Web.Profile"/>
                        <add namespace="System.Web.UI"/>
                        <add namespace="System.Web.UI.WebControls"/>
                        <add namespace="System.Web.UI.WebControls.WebParts"/>
                        <add namespace="System.Web.UI.HtmlControls"/>
        <add namespace="Barcap.SCM.SCCM"/>
                  </namespaces>
            </pages>
            <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
            <authentication mode="Windows"/>
            <identity impersonate="true"/>
            <!--
            The <customErrors> 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.
-->
        <customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
       
      </system.web>
</configuration>

Thank you!!
0
 
rss2Author Commented:
CmdoProg2, yes my F: drive is a shared drive.

Also in the web.config file your provided for authorising MyAccount.aspx, what if I want to provide this for the whole Deployments directory and the pages underneath it. How do I do that?
0
 
CmdoProg2Commented:
You can put the location element at the bottom of your root web.config file before the configuration closing tag.  The path attribute can be either a directory or a page.   When you specify a directory, then all pages and subdirectories in the directory are affected.  This can be overridden.  For more information see the definition at http://msdn2.microsoft.com/en-us/library/b6x6shw7.aspx 

As for your error, I suggest you try HappyFunBall's advise and test your application on a local drive to eliminate a coding problem.
0
 
rss2Author Commented:
Hey I realised what the problem was.

I built my web site in Visual Studio .NET, and I selected a folder on a network drive where I work. Now, this network drive is a shared folder and as it's a large company, it's a reeeeally long folder name.

A colleague told me that he wasn't sure, but thought the refreshing business might point to the fact that the file folder name is so incredibly long that the Visual Studio "allowed" filename reaches it's limit with some of my subfolders and thinks it can't find the web.config.

So I closed everything and started over, this time using my local drive C:\ and a folder in there.

Now it all works fine. No more parse error! fantastic! phew.

rss2
0
 
rss2Author Commented:
How do I indicate my comment is the solution for people reading this?
0
 
HappyFunBallCommented:
There should be an option when you type a comment.

But hey, can you give me credit for the solution, since it ultimately turned out that you needed to put the files on your local drive, and that was what I said to do in my first comment?

It's generally a good idea to do so.  I've had other problems (like code access security issues) when I don't have the development site local.
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

  • 5
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now