Dailycode.info

Short solution for short problems

AllowPartiallyTrustedCallers

When you are develloping web parts for a WSS based site, without using the VS 2005 Extensions, you will probably encounter this word.

I found an article on how to create Web Parts on a develop machine, not on the WSS server. It was written Dmitry Andreev on a msdn blog. He misspelled the word AllowPartiallyTrustedCallers and wrote it like this: AllowPartialTrustedCallers. Try googling for a solution then. The article said that you had to add this attribute to the assembly info. But even  when I found the correct spelling of the word (AllowPartiallyTrustedCallers=correct), my solution wouldn't compile. The reason was that you had to add the "using System.security;" on top. Now it worked fine. I copy the dll to the bin folder and the webpart shows.

Here is the url of the microsoft article with the misspelled attribute:

http://msdn2.microsoft.com/en-us/library/ms515056.aspx


Get assembly info

I wanted to show the assembly version number in the title of the screen, this is the best solution I found to do it:

Add the System.Reflection namespace to your using section like this:

using System.Reflection;
 

And put this code in the page_load

Assembly asm = Assembly.GetExecutingAssembly();
this.Text = this.Text + asm.GetName().Version;