Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Problem with Web Config File

  Asked By: Carter    Date: Oct 01    Category: Sharepoint    Views: 1582

I have created a web part and imported into the share point page.
My Web part folder has a web config file where I have some of the values defined.
When iam trying to retreive the values it is giving Null exception. It is not reading the values from the config file.
There is a confict between the share point web config file which is available in the bin folder

can any one help me to solve this problem?

Share: 

 

9 Answers Found

 
Answer #1    Answered By: Ted Gilmore     Answered On: Oct 01

You say “There is a confict between the share  point web  config file  which is available in the bin  folder” …

That shouldn’t be the case. The web.config should be in the root of the virtual server… and the \bin should be in the same root… so you’d have:

C:\inetpub\wwwroot

Web.config

\bin

WebPart1.dll

WebPart2.dll

You should be putting your name-value pairs that your Web Part needs to access in the web.config in the root, NOT in the \bin. The .NET Framework looks for web.config’s in the web application root (or in subfolders).

Or have I misunderstood you?

 
Answer #2    Answered By: Monte Cooley     Answered On: Oct 01

The web.config that your web  part will use will be the one for SharePoint. You should not be installing your web parts manually – you should be using CAB files which will put them in the right directories for you.

 
Answer #3    Answered By: Guadalupe Bullock     Answered On: Oct 01

I have to define some of my values  in the appsettings section of the web  config file? Which web config  file have to define?

The web.config that your web part  will use will be the one for SharePoint. You should not be installing your web parts manually – you should be using CAB files which will put them in the right directories for you.

 
Answer #4    Answered By: Nathanial Mcclure     Answered On: Oct 01

As per your advise,
The following settings which are more specific to one particular web  part.
<appSettings>
<add key="WSUrl" value="http://172.27.2.55:6060/ProcessEngineWS"></add>
<add key="FNCEURL" value="http://localhost:6070/FNCEWS10DIME"></add>
<add key="RootId" value="{0F1E2D3C-4B5A-6978-8796-A5B4C3D2E1F0}"></add>
<add key="HostName" value="172.27.2.58"></add>
<add key="Workplace" value="http://localhost:8080/Workplace"></add>
</appSettings>

Can i include the above settings into the web config  file of the share  point?

The web.config that your web part  will use will be the one for SharePoint. You should not be installing your web parts manually – you should be using CAB files which will put them in the right directories for you.

 
Answer #5    Answered By: Matt Prince     Answered On: Oct 01

In my opinion these keys and values  can be added to
the web.config but I have my doubts why they need to
be placed separate from the webpart. This information
can all be obtained by the webpart itself
programmatically using the SPS Object Model (eg
SPGlobalAdmin, SPVirtualServer, ...).

 
Answer #6    Answered By: Brooks Bond     Answered On: Oct 01

Can you please give me a sample to do what ever you have explained because iam new to sharepoint

In my opinion these keys and values  can be added to
the web.config but I have my doubts why they need to
be placed separate from the webpart. This information
can all be obtained by the webpart itself
programmatically using the SPS Object Model (eg
SPGlobalAdmin, SPVirtualServer, ...).

 
Answer #7    Answered By: Gregg Wilkinson     Answered On: Oct 01

On http://www.ontolica.com/ (and NO, I am not working
for them!) they have this excellent tool: Sharepoint
Explorer. With this wonderful tool you can browse
through the entire SPS Object Model.

created  a while ago a copy of this SPS Object Model
browser but as webpart, simply to get all the code I
would need bundled in one source. I don't go into
details of this webpart, but you can (referring to the
SDK's) read almost any SPS property through the Object
Model, eg:

StringBuilder sb = new StringBuilder("");

SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPVirtualServerCollection servers =
globalAdmin.VirtualServers;

foreach(SPVirtualServer server in servers)
{
sb.Append(" Portal: " +
server.Description.ToString() + " ");

if (server.State == SPVirtualServerState.Ready)
{
SPSiteCollection sites = server.Sites;

foreach(SPSite site in sites)
{
sb.Append("Site: " + site.Url.ToString() + " ");

SPWebCollection webs = site.AllWebs;

foreach(SPWeb web  in webs)
{
sb.Append("TeamSite Name: " + web.Name.ToString()
+ " ");
}
}
}
}

return sb.ToString();

 
Answer #8    Answered By: Darrel Sexton     Answered On: Oct 01

The one used by SharePoint… in the root of your virtual server. If your SharePoint site was intalled on the default web  site for example: c:\inetpub\wwwroot\web.config

 
Answer #9    Answered By: Tory Sellers     Answered On: Oct 01

I have to define some of my values  in the appsettings section of the web  config file? Which web config  file have to define?

The web.config that your web part  will use will be the one for SharePoint. You should not be installing your web parts manually – you should be using CAB files which will put them in the right directories for you.

 
Didn't find what you were looking for? Find more on Problem with Web Config File Or get search suggestion and latest updates.




Tagged: