Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > sitemap connectionstrings

Reply
Thread Tools

sitemap connectionstrings

 
 
Andy Sutorius via DotNetMonster.com
Guest
Posts: n/a
 
      01-10-2006
I am creating a custom sitemap and when I run the site I get the following
error and the debugger trips on line 28 of the code below. Can someone
explain why I am getting this error and how to correct it?

Parser Error Message: The entry 'LocalSqlServer' has already been added.

Source Error:
Line 13: </appSettings>
Line 14: <connectionStrings>
Line 15: <add
Line 16: name="LocalSqlServer"
Line 17: connectionString="server=(local); uid=sa; pwd=sterling;
database=ca101web;"

=========
default.aspx.cs - line 28

string[] connString = ConfigurationManager.ConnectionStrings["LocalSqlServer"]
..ConnectionString.Split(new Char[] {';'});

--
Message posted via http://www.dotnetmonster.com
 
Reply With Quote
 
 
 
 
Wouter van Vugt
Guest
Posts: n/a
 
      01-10-2006
The LocalSqlServer connection string is configured in the
c:\windows\Microsoft .NET\Framework\V2.0xxxx\Config\Web.config file.
Yes, there is one there also . Of course, you can't add the same
connectionstring twice using the same name, as the name is used as the
primary key.

Wouter van Vugt
Trainer - Info Support
http://blogs.infosupport.com/wouterv

 
Reply With Quote
 
 
 
 
Andy Sutorius via DotNetMonster.com
Guest
Posts: n/a
 
      01-10-2006
I am confused with the way the custom sitemap is supposed to work. Line 28
comes from my Page Load and it is pulling the connection string from the web.
config. I thought I needed the name of the connection string in line 28 in
order to get the connection string information? I am then calling the
Initialize method with the namevaluecollection from the connection string. Am
I incorrect in my architecture?

Wouter van Vugt wrote:
>The LocalSqlServer connection string is configured in the
>c:\windows\Microsoft .NET\Framework\V2.0xxxx\Config\Web.config file.
>Yes, there is one there also . Of course, you can't add the same
>connectionstring twice using the same name, as the name is used as the
>primary key.
>
>Wouter van Vugt
>Trainer - Info Support
>http://blogs.infosupport.com/wouterv


--
Message posted via http://www.dotnetmonster.com
 
Reply With Quote
 
Wouter van Vugt
Guest
Posts: n/a
 
      01-11-2006
You should use a SiteMapDataSource, and set its Provider property. Then
in the web.config you configure a custom SiteMapProvider, here you also
set the connectionString. On line 28 of your code, you can use the name
of the connectionstring, that isn't the problem. THe problem here is
that the connectionstring you are requesting exists two times, one in
the web.config for your root directory. One for the
C:\windows\Microsoft.NET\..... folder.

Grtz, Wouter

 
Reply With Quote
 
Andy Sutorius via DotNetMonster.com
Guest
Posts: n/a
 
      01-11-2006
Thank you for your help!

Wouter van Vugt wrote:
>You should use a SiteMapDataSource, and set its Provider property. Then
>in the web.config you configure a custom SiteMapProvider, here you also
>set the connectionString. On line 28 of your code, you can use the name
>of the connectionstring, that isn't the problem. THe problem here is
>that the connectionstring you are requesting exists two times, one in
>the web.config for your root directory. One for the
>C:\windows\Microsoft.NET\..... folder.
>
>Grtz, Wouter


--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200601/1
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Sitemap.CurrentNode use non default sitemap provider? AmitKu ASP .Net 1 09-27-2006 12:25 PM
I have created a "Auction.sitemap" instead of the default "web.sitemap" - But I can't run it. Learner ASP .Net Security 5 05-07-2006 03:37 PM
ConnectionStrings in ASP.NET 2.0? sstrangee@gmail.com ASP .Net 8 03-28-2006 06:02 PM
ConfigurationSettings.ConnectionStrings("Personal").ConnectionString does not work Dave ASP .Net 3 11-29-2005 01:02 AM
MSDE, ASP.NET, Visual Studio .NET, and connectionstrings Nathan Sokalski ASP .Net 16 06-25-2005 02:40 AM



Advertisments