Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Where is web.config file?

  Asked By: Alyson    Date: Aug 11    Category: Sharepoint    Views: 8769

i created a web part and after creating it I went inside
c:\inetpub\wwwroot to look for web.config file.... but I didn't see
any file..so I copied another web.config file from different location
and pasted it under c:\inetpub\wwwroot. Then I added the following
safecontrol code inside the file...

<SafeControl Assembly="CustomWebPart" Namespace="CustomWebPart"
TypeName="*" Safe="True" AllowRemoteDesigner="True" />

I compiled it and then I tried to add it to the web part gallery(by
Site Actions -> Site Settings -> Web Parts -> New -> ??)BUT, I didn't
see my web part here... What did i do wrong? Can I copy web.config
file from different location?

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Cory Brooks     Answered On: Aug 11

Although by default it is put in c:\inetpub\wwwroot - it does not have
to be put there. To find out what web.config file  is the that your
portal is using for 100% sure you need to open up IIS, expand
websites, and choose the virtual server that you have extended
sharepoint onto (website). After you have located this, right click
the website and go to properties. Click on the home directory tab and
look at the location.

 
Answer #2    Answered By: Ruth George     Answered On: Aug 11

secondly (I just re-read your post). Simply adding a safe
control does not automatically make it available on your sharepoint
site. YOu need to make sure that the webpart was added  one of the
following ways, simply adding adding a safe control entry is not going
to allow you to add  the webpart to the page. One way is to add a
second project to your solution of type Setup and Deployment --> cab
project. To further this there are some settings  in the cab file  you
will need to add as well such as what content to include in the cab
project, etc. Then you can use stsadmin.exe to add a webpart pack.
Also, depending on what your webpart is doing (ojbect model access)
then you might have to either add the assembly to the GAC or deploy
the .dll to the bin folder of your site  and give full trust in your
trust config  file to the bin folder. If you want the webpart to show
up in the virtual server gallery it needs to have the .dwp file in the
wpcatalog.

In summary, there are ton of things that you need clarify. There are
tons of tutorials and white papers on how to do what I am talking
about in the above paragraph.

 
Answer #3    Answered By: Peter Peterson     Answered On: Aug 11

this is my web  part so I didn't do any major coding in that...My
code is just

namespace CustomWebParts
{
public class FirstPart: WebPart
{
protected override void RenderContents
(System.Web.UI.HtmlTextWriter writer)
{
writer.Write(DateTime.Now.ToLongTimeString());
}
}
}

 
Answer #4    Answered By: Kalyan Pujari     Answered On: Aug 11

Did you sign the assembly? Did you put the assembly in the \bin of the
site?

 
Answer #5    Answered By: Laura Walker     Answered On: Aug 11

Of the five benchmarks that must be met (Compiled, Signed, Marked as
Safe, Trusted, and Deployed), the minimum that WSS v3 requires for a Web
Part like yours to be available in the New gallery:
1. Compiled DLL must be in the bin or GAC (and, of course, it must
contain a WebPart class)
2. Place a SafeControl entry into the web.config
While recommended, it doesn't have to be signed and WSS v3 automatically
trusts web  Parts to display themselves on a Web page.

First, as Michael states, all sites extended with SharePoint will have a
web.config and it will contain a fairly large section about SharePoint.
So, I think that you may have started with the wrong file  system
location. Rather than c:\inetpub\wwwroot, by default, WSS v3 now puts
all Web Applications into
C:\Inetpub\wwwroot\wss\VirtualDirectories\[HostHeaderPlusPortNumber]

If you go into IIS and find your SharePoint site, you will find the path
on the Home Directories tab of the properties for your SharePoint
extended Web site.

Second, as Andrew states, your assembly must be in the bin or the GAC.
If in the GAC, it must be signed (strongly named).

Third, if your Web part  is signed, you must fully qualify it in the
SafeControl entry. The assembly must contain all four values:
AssemblyName, Version, Culture, and PublicKeyToken (can be obtained
using sn -T [locationOfAssembly]\[nameOfAssembly])

Fourth: If the Web Part was signed and deployed to the bin, the Assembly
must be marked with System.Security.AllowPartiallyTrustedCallers because
it will be called by WSS v3's partially trusted assemblies and is
running in a partially trusted location.

 
Answer #6    Answered By: Gopal Jamakhandi     Answered On: Aug 11

I apologies if this has already been asked and answered.

For those of you that subscribe to the Microsoft Action Pack..has there been
a list of 1st Quarter software updates that will be distributed?

 
Didn't find what you were looking for? Find more on Where is web.config file? Or get search suggestion and latest updates.




Tagged: