Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Using Enterprise Library with web parts

  Asked By: Colin    Date: Jul 13    Category: Sharepoint    Views: 1185

We were developing a web part which takes data from a database. We want to use enterprise library(EL) to set up this connection. We were able to strongly name the EL dll's and everything looked good.

At runtime the web part tries to pick up configuration settings for "dataconfiguration.config" from <virtual dir>/bin/web.config. How do i specify these settings to be picked up from my web part's app.config and where should I place my app.config.



4 Answers Found

Answer #1    Answered By: Titus Sweet     Answered On: Jul 13

I started down the same path using the EL with a document library  event sink…

Your WebPart will not have a config  file that it will be able to see (or the EL will be able to see) by default. Because the process is running from within the virtual server, the config you have access to is the web.config for the SharePoint site you’re currently using (SPS/WSS). When the EL runs, it will look for it’s config stuff within the web.config of the SharePoint site you’re using. From there, it contains the path to the other EL AppBlock configs.

Answer #2    Answered By: Laura Walker     Answered On: Jul 13

You have to put your settings  in the machine.config file

Answer #3    Answered By: Christop Mcfadden     Answered On: Jul 13

You should also be able to put the xml configuration  file into your web  part resources, and read the XML directly from the file, unfortunately you can’t use the .net configuration settings  class to read it.

Answer #4    Answered By: Victoria Bell     Answered On: Jul 13

You don’t *have* to do put your settings  in the machine.config… you can put your settings within the web.config of the calling SharePoint web  app directory in IIS (virtual server or virtual directory/web app).

Didn't find what you were looking for? Find more on Using Enterprise Library with web parts Or get search suggestion and latest updates.