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://www.webdeveloper.com/forum/archive/index.php/"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:
// 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"]);
}
I really stuck now and hope that sm 1 will help me out this problem..Thank you so much.
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.web>
<appSettings>
<add key="Searcharoo_VirtualRoot" value=http://www.webdeveloper.com/forum/archive/index.php/"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:
// 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"]);
}
I really stuck now and hope that sm 1 will help me out this problem..Thank you so much.