Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jhermiz
3564 Posts |
Posted - 2005-03-22 : 09:39:36
|
Im creating web parts for sharepoint. We are running sharepoint 2003...just getting into the groove of things. I cannot seem to find where these web parts should be stored. For instance, one of the steps states I have to setup the output path in VS.net.The problem is I dont know neither does our admin :) how the sharepoint pages are stored. They are not in c:\inetpub\wwwroot..etc.I've done searches on the file structure and there are just way too many results.Does anyone else run 2k3 and have any ideas on this ?Thanks Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
|
jhermiz
3564 Posts |
Posted - 2005-03-22 : 13:23:36
|
Got that part solved...Now im getting:"A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe."In sharepoint when adding the web form control...I already added:<SafeControl Assembly="MyWebPart1" Namespace="MyWebPart1" TypeName="*" Safe="True" /> To the web config file but I am not certain why it will not work :(.It is a very basic Hello World Web Part just to see a label... Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
|
|
jhermiz
3564 Posts |
Posted - 2005-03-22 : 14:48:36
|
Aha..found out we were using host headers so the default bin is not the same.For anyone who ever begins or will begin writing web parts I have jotted down the exact steps of how to do this just in case. At least it will save you guys the three hours I spent trying to get it to work:To import a dwp follow these steps:1)First create a new project in vs.net -C# / VB.NET -Web Part Library2)Write all the code -write the code (c# / vb.net)3)Modify the AssemblyInfo file -towards the bottom: [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("H:\\yourKeyName.snk")] [assembly: AssemblyKeyName("")]H:\\yourKeyName.snk is simply the key generated to give a public token key to the dll file that you are creating.See below:-------------------------------------------------------------------------------------------------------C:\Documents and Settings\blah>snMicrosoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.Usage: SN [-q(uiet)] <option> [<parameters>] Options: -c [<csp>] Set/reset the name of the CSP to use for MSCORSN operations. -d <container> Delete key container named <container>. -D <assembly1> <assembly2> Verify <assembly1> and <assembly2> differ only by signature. -e <assembly> <outfile> Extract public key from <assembly> into <outfile>. -i <infile> <container> Install key pair from <infile> into a key container named <container>. -k <outfile> Generate a new key pair and write it into <outfile>. -m [y|n] Enable (y), disable (n) or check (no parameter) whether key containers are machine specific (rather than user specific). -o <infile> [<outfile>] Convert public key in <infile> to text file <outfile> with comma separated list of decimal byte values. If <outfile> is omitted, text is copied to clipboard instead. -p <infile> <outfile> Extract public key from key pair in <infile> and export to <outfile>. -pc <container> <outfile> Extract public key from key pair in <container> and export to <outfile>. -q Quiet mode. This option must be first on the command line and will suppres any output other than error messages. -R <assembly> <infile> Re-sign signed or partially signed assembly with the key pair in <infile>. -Rc <assembly> <container> Re-sign signed or partially signed assembly with the key pair in the key container named <container>. -t[p] <infile> Display token for public key in <infile> (together with the public key itself if -tp is used). -T[p] <assembly> Display token for public key of <assembly> (together with the public key itself if -Tp is used). -v[f] <assembly> Verify <assembly> for strong name signature self consistency. If -vf is specified, force verification even if disabled in the registry. -Vl List current settings for strong name verification on this machine. -Vr <assembly> [<userlist>] Register <assembly> for verification skipping (with an optional, comma separated list of usernames for which this will take effect). <assembly> can be specified as * to indicate all assemblies or *,<public key token> t indicate that all assemblies with the given public key token. Public key tokens should be specified as a string of hex digits. -Vu <assembly> Unregister <assembly> for verification skipping. The same rules for <assembly> naming are followed as for -Vr. -Vx Remove all verification skipping entries. -? -h Displays this help text.C:\Documents and Settings\blah>sn -k H:\yourKeyName.snkMicrosoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.Key pair written to H:\yourKeyName.snkC:\Documents and Settings\jhermiz>-------------------------------------------------------------------------------------------------------------------3)Move the dll to either of the following: 1) In our case (since we use host headers) move it to C:\Windows\assembly (C: refering to the actual server name: \\Server\c$\Windows\Assembly). 2) If you are not using host headers (which we are in step 1) then you simply need to include the dll in the \\server\inetpub\wwwroot\bin directory.4)Modify the web.config file (of your sharepoint site) so that the web part is considered "safe"<SafeControl Assembly="MyWebPart1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a2e7f5089e77946f" Namespace="MyWebPart1" TypeName="*" Safe="True" />Put in the Assembly Name in this case mine was MyWebPart1, also place the token you generated from the sn tool (vs.net command prompt)Save the web.config file5)Once you have the dll in the GAC (Global Assembly Cache) you need to open the portal. -Go to a site and click the Modify Page link at the top right. -Import the .dwp file you had created in your original project (this is on the local development machine). -Drag and drop the web part to the sharepoint portal server6)Voila!!!!! Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
|
|
|
|
|
|
|