rss2
asked on
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\de ployments' 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\dep loyments\w eb.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
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\de
Source ERror:
[No relevant source lines]
Source File: F:\Visual Studio 2005\Webites\Blah_v1.2\dep
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
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?
Do you have a web.config file in the deployments directory? Does your root level config have any <location> elements?
ASKER
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
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
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.
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>
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>
ASKER
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\Fra mework\v2. x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<!-- <add name="OMDB" connectionString="Data Source=PLATMANDB,10501;Ini tial Catalog=WintelCFG;Integrat ed 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.ReportViewe rWebContro l.axd" verb="*" type="Microsoft.Reporting. WebForms.H ttpHandler , Microsoft.ReportViewer.Web Forms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d 50a3a" validate="false"/>
</httpHandlers>
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Directory Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D 50A3A"/>
<add assembly="Microsoft.Report Viewer.Web Forms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D 50A3A"/>
<add assembly="System.Managemen t, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D 50A3A"/></ assemblies >
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting. RdlBuildPr ovider, Microsoft.ReportViewer.Com mon, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d 50a3a"/>
</buildProviders>
</compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collecti ons"/>
<add namespace="System.Collecti ons.Specia lized"/>
<add namespace="System.Configur ation"/>
<add namespace="System.Text"/>
<add namespace="System.Text.Reg ularExpres sions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Cach ing"/>
<add namespace="System.Web.Sess ionState"/ >
<add namespace="System.Web.Secu rity"/>
<add namespace="System.Web.Prof ile"/>
<add namespace="System.Web.UI"/ >
<add namespace="System.Web.UI.W ebControls "/>
<add namespace="System.Web.UI.W ebControls .WebParts" />
<add namespace="System.Web.UI.H tmlControl s"/>
<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="GenericEr rorPage.ht m">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm " />
</customErrors>
</system.web>
</configuration>
Thank you!!
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\Fra
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<!-- <add name="OMDB" connectionString="Data Source=PLATMANDB,10501;Ini
<add name="OMDB" connectionString="Data Source=LDNDCM05673V05C\lf3
<add name="OMDBConnectionString
<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.ReportViewe
</httpHandlers>
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Directory
<add assembly="Microsoft.Report
<add assembly="System.Managemen
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.
</buildProviders>
</compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collecti
<add namespace="System.Collecti
<add namespace="System.Configur
<add namespace="System.Text"/>
<add namespace="System.Text.Reg
<add namespace="System.Web"/>
<add namespace="System.Web.Cach
<add namespace="System.Web.Sess
<add namespace="System.Web.Secu
<add namespace="System.Web.Prof
<add namespace="System.Web.UI"/
<add namespace="System.Web.UI.W
<add namespace="System.Web.UI.W
<add namespace="System.Web.UI.H
<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="GenericEr
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm
</customErrors>
</system.web>
</configuration>
Thank you!!
ASKER
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?
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?
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.
As for your error, I suggest you try HappyFunBall's advise and test your application on a local drive to eliminate a coding problem.
ASKER
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
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
ASKER
How do I indicate my comment is the solution for people reading this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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="~/MasterPa