Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Building ASP.NET Web Parts for Windows SharePoint Services 3.0

Download

Right click “Save as…”

Windows SharePoint Services 3.0 builds upon the Web Part infrastructure that was introduced in ASP.NET 2.0. This tutorial demonstrates how to create an ASP.NET Web Part 2.0 project from scratch and to get it up and running within a Windows SharePoint Services 3.0 site.

Tags:

Follow the Discussion

  • Very nice... 

    I have one question about adding web parts as safe to the web.config file...

    We are using Sharepoint Portal server and I don't have a web.config located in the inpub/wwwroot directory as shown in the clip.

    Where is the web.config file we need to edit for Portal Server?
    Thank you in advance.

    Mad

  • donchodoncho Evangelist
    Are you using SPS 2003 or Office SharePoint Server 2007 beta 2?
  • Doncho, thanks I am using Office SharePoint Server 2007 beta 2
  • Doncho...

    I am still needing the answer - you or anyone at MS care to answer?  Time is of the essense...
    Expressionless

  • Never mind Doncho - found it...

    In our case

    C:\Inetpub\wwwroot\wss\VirtualDirectories\c2170bb3-43df-46d7-9737-303d33ba0d0a

    One of the virtual directories...

    Works great!

    Big Smile:D

  • donchodoncho Evangelist

    Sorry I took so long to get back to you.  Glad you found it.

     

  • Good demo. I have some questions about making it work for me on my system. I am running WSS 3.0 Beta 2 and the bin directory and web.config file were not located at C:\inetpub\wwwroot\. I did find the virtual directories that someone else pointed out but again no folder specifically name "bin" was there. Could the litware.dll be placed under the _app_bin directory or the App_GlobalResources directory? I modified the web config file there and created a bin folder. When I go to the Web Part Gallery and select New, I do not see the litware web part to add.

    Perplexed

    Any suggestions?

  • Sounds like you have done the same as I did...  Not sure why it wouldn't show up...

  • AH HA! I think I got it figured out. I had to name the class in the web.config file rather than use "*". Then SharePoint sees the webpart. Funny though, I can go back to the web.config file and change the Typename back to "*" and it still works.

    Big Smile
  • The default installation for WSS will use a GUID for the root directory.  If you create create a new web site in IIS and enable WSS on it then you can specify the physical directory to use instead of a random GUID.  This is useful for development situations where you want to have a stable path for your code to use with source control software.
  • Strange thing happens, or rather doesn't happen.
    When I create new library and put in the same code as in the video, the output library goes to my BIN folder and my we.config file has a safe entry I still cannot see the webpart from galery. In other words I can't find the galery to populate it and be able to use webpart.

    Any ideas?
    Perplexed
  • Hi

    I had problem adding a webpart to the webpart gallery too.

    I have to reboot the machine to add a webpart in the "add new webpart to a gallery" list.
    I can't get a refresh if I change the webpart in VS2K5 (and re-generate it).

    I don't have a intpub/wwwroot/web.config, so I modified the web.config or every virtualdirectory.

    I use MOSS2007beta2 (without tech refresh) and WSS3. French version upgraded form Sharepoitn server 2k3.

     

  • i did as you said, but i tried to add it, this message appeard to me "helloworld: Assemblies that implement Asp.Nety Web Parts and are installed into a partialy trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedAttribute set for import to succeed"

    any idea plz.
  • Great demo, but here's my dilemma: I'd really like to leverage our existing ASP.NET user controls by writing a simple web part (as described in this demo) but that calls Page.LoadControl() to load one of our ASP.NET user controls.

    I've seen lots of examples on how to create a simple web part that outputs some simple text, but I've been stymied when it comes to finding any good examples of the LoadControl() technique.  I've actually done this from another example I found, but I keep getting this error:

    Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallersAttribute set for import to succeed.

    Any thoughts??

    thanks!

  • I am not able to watch the video.
    Is the link is broken or the server is too busy??
  • Excellent introductory tutorial on v3 web parts development, Charles!  Even though, I am watching this over a year after the fact, I have a couple of questions: are the *.webpart files stored in the SharePoint databases after SharePoint creates them?  Second, do I have to modify the web.config file and install the *.dll on ALL web servers if I have a multi-server/cluster farm deployment OR does SharePoint somehow replicate this for me?

    Thanks in advance, Charles.
    Shola Salako.
  • Hi, did you ever get an answer to how to apply a web part to a multiple WFE server farm?  Does one have to copy the dll to each bin directory?

    Also, I am also getting the error message:
    "...must be compiled with the AllowPartiallyTrustedCallersAttribute set to succeed"

    Did anyone find a workaround for this? I have the following line set in my assembly file:
    [assembly: System.Security.AllowPartiallyTrustedCallers()]

    And my web.config has the following line:

    <SafeControl Assembly="FooWebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=645f96a346d0edda" Namespace="FooWebParts" TypeName="*" Safe="True" />

    Any help would be greatly appreciated....
  • I ran into the same error, not sure if its the same thing... But i found that my code was throwing an exception. Tried some exception handling when i found the error it had nothing to do with the error that was reported.

    "must be compiled with the AllowPartiallyTrustedCallersAttribute set to succeed"

    Well in my code i was attempting to access a web service in the constructor and apparently no permissions are granted at this point. Changed the code to run in the CreateChildControls and like magic it worked....

    Hope this helps
  • I ran into the issue many others have mentioned in this thread while going through this exercise, first mentioned in skought's post.  As the video was created during the (early?) beta process some of the instructions no longer apply to the GA product. 

    Specifically I followed the instructions to have the DLL file (aka assembly) written out to c:\inetpub\wwwroot\bin.  This folder is there in my machine and the build put the file there without any trouble.  The correct location of the file on my machine is:

    c:\inetpub\wwwroot\wss\VirtualDirectories\80\bin

    Also, when it was time to edit the web.config file it was not in the folder specified in the video (c:\inetpub\wwwroot).  Instead the proper folder to find the file to edit is:

    C:\Inetpub\wwwroot\wss\VirtualDirectories\80

    Like some others I did a search for all instances of web.config in the c:\inetpub\wwwroot path and modified multiple instances of the file.  It wasn't until I put the actual DLL file in the correct bin folder that the web part actually showed up for me.

    c:\inetpub\wwwroot\wss\VirtualDirectories\80\bin

    While I was frustrated by the fact that my web part wasn't working when trying to follow along with an extremely elementary exercise, I have to (grudgingly) admit that I learned more about the whole process by having to repeat the steps multiple time and beat my head against the wall in frustration.
  • Thank you for this basic walk through.  It worked like a charm!  I would like to use SQL and AD data in the webpart and haven't found any med-advanced code snippits on how to accomplish this.  Do you have any suggestions on where to look?

     

    Thanks,

    Shawn.

    the w3b1d10t.

  • I too faced the same error.

    Assemblies that implement Asp.Nety Web Parts and are installed into a partialy trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedAttribute set for import to succeed"

    But the good thing is, I was able to resolve the error.

    While creating the project VS 2005 added a signature file <filename>.snk file.

    Please delete the <*.snk> file from the project and rebuild the project. Then put the DLL in the bin directory of the web site......

    Now you should be able to add the web part to the SharePoint site.

    Hope this helps you...Smiley

  • I faced the same problem. Did everything everybody else previously mentioned.

    How I solved it. I created a web part project under VS2005 with WSS extensions installed. Then built the project (and this is the important bit) and deployed it using VS2005's Build>Deploy <Project> menu. VS2005 did its magic and got it working.

    BTW, deleting the Temporary.snk file did not work for me.

    Thanks.

     

     

  • Doing what wym.inc did (VS2005 Build->Deploy menu) worked for me as well. Din't try the other possibilities.

  • Hi

    I am quite new to Sharepoint and ASP .NET technologies so I appologize if my question is too simple.

    This tutorial is great but I can't imagine creating all controls by writing the code manually.

    Is this possible to create eg. new ASP .NET web appliaction in Visual Studio 2008... create a Web Part using Web Parts Toolbox and other controls in "visual" mode and then populate it somehow to the sharepoint site? Just like dll's ?

    Thanks in advance for the response.

    Best regards.
  • Hi,
    thanks for the video..i am quiet new to sharepoint and so i just followed the video to create my wep parts..however when i try to deploy my web parts i got this message and  error:

    "Load of property 'OutputPath' failed. The entered path is not a valid output path"

    "System.NullReferenceException: object reference not set to an instance of an object."

    i have set my output path to the bin folder..and also i have tried the suggestions written here..but still having the same error..

    any suggestion is welcomed!
    thanks
  • good example.thanks

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.