app.config and web.config problems

Hi all,

I've structured my application in the following way.:
1. I've created a library project (.dll) with the BLL and DAL (built using the DataSet VS 2005 designer), at this moment I was asked to put the connection string inside of an app.config file (decrypted).
2. In a second project (Web Application) I've put a reference for the .dll mentioned above.
3. When I ran the web project for the first time I've got an error indicating that the .dll didn't find the connectionstring used to build the DAL so after some tips I performed a "copy and paste" from app.config to web.config .... ran the program again and the dll wasn't able to find the connection string again :-(

** Below the file that wasn't working ***
    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


<remove name="LocalSqlServer"/>
<add name="DLLConnectionString" connectionString="Data Source=serverDLL;Initial Catalog=DLLDB;User ID=prog;Password=******" providerName="System.Data.SqlClient" />
<add name="OtherConnectionString" connectionString="Data Source=serverXXX;Initial Catalog=OtherDB;Persist Security Info=True;User ID=prog;Password=******" providerName="System.Data.SqlClient"/>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->

<add name="DefaultSwitch" value="Information" />
<add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->





            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.

<compilation debug="true" strict="false" explicit="true">
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies></compilation>
<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"/>
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
<!--<authentication mode="Windows"/>-->

<authentication mode="Forms">
<forms cookieless="AutoDetect" loginUrl="~/AccessDenied.aspx" name="RONLINEFORMAUTH"/>
<membership defaultProvider="RONLINE_MembershipProvider" userIsOnlineTimeWindow="15">
<add name="RONLINE_MembershipProvider" connectionStringName="SegurancaMiraConnectionString" applicationName="/" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="3" passwordAttemptWindow="0" minRequiredPasswordLength="0" minRequiredNonalphanumericCharacters="0" type="VSSLibAuditorOnline.Mirasoft.Membership.MiraMembershipProvider"/>
            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="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />



4/11/2008 9:03:09 PM 12495 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 50
Get it on Google Play
Get it on Apple App Store

Hi  marcossoft,

How do you access your connection string ? Remember, that you use the ConfigurationManager (System.Configuration.dll) for Windows "executable" applications  and WebConfigurationManager (System.Web.Configuration.dll) for applications:

 so your code might look something like this:


string connectionString;
if (HttpContext.Current != null) // app
   connectionString = WebConfigurationManager.ConnectionStrings["myConnection"].ConnectionString;
else // windows app
   connectionString = ConfigurationManager.ConnectionStrings["myConnection"].ConnectionString;
Łukasz Podolak
4/12/2008 8:09:17 PM

Web resources about - app.config and web.config problems -

Problem novel - Wikipedia, the free encyclopedia
Working class, or proletarian novels are often also social problem novels . This was in many ways a reaction to rapid industrialization , and ...

Corporate Australia's real problem: ancient companies
Our biggest companies are pretty aged, compared to the dynamic corporate giants that power the world's biggest economy.

Report claims Samsung Galaxy S7 will fix the biggest problem with the Galaxy S6
... Samsung ditched microSD support on the Galaxy S6. Well according to a new report on Monday, Samsung will fix the bigger of those two problems ...

November 2015: Unofficial Problem Bank list declines to 255 Institutions
This is an unofficial list of Problem Banks compiled only from public sources. Here is the unofficial problem bank list for November 2015. Changes ...

Acampora on problems in the market
Master technician Ralph Acampora says he has some doubts about this "fractured" market.

Tesla Unveils ‘Cheap’ $80,000 SUV, As Problems Mount For The Automaker
Tesla unveiled an $80,000 “budget” version of its Tesla Model X SUV Tuesday as the company struggles to sell cars and burns through cash at an ...

New York's anti-terror reporting app could easily cause problems
New York state is understandably more anxious than ever about terrorist threats, and it's hoping that some mobile technology will bolster its ...

Can Los Angeles Solve Its Traffic Problem By Building More Roads?
The Reason Foundation publishes a Los Angeles transportation plan that embraces reality over dogma.

Family evicted, building deemed unlivable: Landlord cannot fix problems, he was murdered
... A Milwaukee family has been forced to leave their apartment. Their building has been declared unlivable. The landlord was required to fix problems ...

Icy roads causing problems for Thanksgiving travelers around Colorado Springs
Dress warm this holiday, temperatures Thursday are predicted to be colder...

Resources last updated: 11/28/2015 3:20:07 AM