Groups | Blog | Home
all groups > dotnet xml > march 2005 >

dotnet xml : xml tags unrecognised by server??


lilyminako NO[at]SPAM yahoo-dot-com.no-spam.invalid
3/12/2005 1:36:39 AM
I am new to xml and I am trying to use xml as web.config file. I will
use asp.net form to get the web.config settings. Below is my
web.config file:

<?xml version="1.0" encoding="UTF-8" ?>

<configuration>

<system.web>

<appSettings>
<add key="Searcharoo_VirtualRoot" value="http://localhost/"
/> <!--website to spider-->
<add key="Searcharoo_RequestTimeout" value="5" /> <!--5
second timeout when downloading-->
<add key="Searcharoo_RecursionLimit" value="200" />
<!--Max pages to index-->
</appSettings>

</system.web>

</configuration>
every time I try to run the asp.net web form, error msg will appear
said that Unrecognized configuration section 'appSettings'. I had do
references on MSDN library and I follow the steps but still get the
same error. I wonder is there anything to do with the asp.net web
form which will get settings from this web.config file? The part of
the file to get settings is as below:

[b:1660e6e52f]// get web.config settings
if (null !=
configurationSettings.appSettings["Searcharoo_RequestTimeout"]) {
prefRequestTimeout =
Convert.ToInt32(configurationSettings.appSettings["Searcharoo_RequestTimeout"]);
}
if (null !=
configurationSettings.appSettings["Searcharoo_VirtualRoot"]) {
startingUri = new Uri
(configurationSettings.appSettings["Searcharoo_VirtualRoot"].ToString()
);
} else {
//startingUri = new Uri ("http://localhost:8080/"); //
occasionally hardcode this for testing...
startingUri = new Uri ("http://" +
Request.ServerVariables["HTTP_HOST"]);
}[/b:1660e6e52f]
I really stuck now and hope that sm 1 will help me out this
problem..Thank you so much.


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
Martin Honnen
3/12/2005 4:02:52 PM


[quoted text, click to view]

The documentation here
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconformatofconfigurationfiles.asp>
suggests you need e.g.

<configuration>
<configSections>
<section name="appSettings"
type="System.Configuration.NameValueFileSectionHandler,
System, Version=1.0.3300.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

<appSettings>
<add key="dsn" value="localhost;uid=MyUserName;pwd=;"/>
<add key="msmqserver" value="server\myqueue"/>
</appSettings>
</configuration>

that is one "declaration" of the section named "appSettings" in
configSections.

If that doesn't help then perhaps someone in an ASP.NET group knows more.


--

Martin Honnen
AddThis Social Bookmark Button