Integrating VAB with SharePoint 2010

Topics: Validation Application Block
Nov 26, 2010 at 4:50 PM

I must say I tried all day to integrate Validation Application Block within a SharePoint 2010 webpart. I could not get it to work.

After hours of trying I finally got it to deploy (had to recompile VAB with keys to get strong names). But after deployment the next errors appeared...

When doing a POST, and VAB tries to Validate, I get a Security Exception. I think that problem might be connected to web.config and I might have to state a safeControl attribute there. But by now I am extremly frustrated and will try again on monday...

Any tips and tutorials on this matter would be greatly appreciated. Thanks!

Nov 30, 2010 at 2:49 AM

Ah, I posted my answer on the other thread.  But let's just continue the discussion here.  As I've mentioned in the other thread, I haven't really worked on Sharepoint development but found these 2 related thread and article with which I also noticed the extra step of adding entlib assemblies to the SafeControls section of your web.config. - skip reading steps 1-11 as those steps need not be executed if you're using the strongly-named entlib assemblies, the one from Program Files\Microsoft Enterprise Library {version}\bin folder.  Thus, you need not recompile VAB to generate a strongly named assembly version of it.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Nov 30, 2010 at 7:47 AM

Good morning Sarah,

thank you for ur help. It is indeed as you mentioned necessary to a) integrate signed assemblies into the GAC and b) adding them to safecontrol-section to the web.config. Hereby very important to get the right PublicKeyToken. (Find out with sn.exe).

When using the PropertyProxyValidator it is important to get the whole name like this: "assembly.namespace.class, assembly, Version=, Culture=neutral, PublicKeyToken=xxXxXX" (while PublicKeyToken is the PKT of your own assembly this time - look into your manifest for that one).

It was a lot of work getting all these facts together and I really hope I never have to do it again ;)

Here are the SafeControls entries, I found necessary for VAB (further documentation of needed assemblies would be great btw!):

      <SafeControl Assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=xxXxXX" Namespace="Microsoft.Practices.EnterpriseLibrary.Common" TypeName="*" Safe="True" SafeAgainstScript="False" />
      <SafeControl Assembly="Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=xxXxXX" Namespace="Microsoft.Practices.EnterpriseLibrary.Validation" TypeName="*" Safe="True" SafeAgainstScript="False" />
      <SafeControl Assembly="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet, Version=5.0.414.0, Culture=neutral, PublicKeyToken=xxXxXX" Namespace="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet" TypeName="*" Safe="True" SafeAgainstScript="False" />
      <SafeControl Assembly="Microsoft.Practices.ServiceLocation, Version=, Culture=neutral, PublicKeyToken=xxXxXX" Namespace="Microsoft.Practices.ServiceLocation" TypeName="*" Safe="True" SafeAgainstScript="False" />
      <SafeControl Assembly="Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=xxXxXX" Namespace="Microsoft.Practices.Unity" TypeName="*" Safe="True" SafeAgainstScript="False" />
      <SafeControl Assembly="Microsoft.Practices.Unity.Interception, Version=2.0.414.0, Culture=neutral, PublicKeyToken=xxXxXX" Namespace="Microsoft.Practices.Unity.Interception" TypeName="*" Safe="True" SafeAgainstScript="False" />

Of course I cant give any guarantee of these entries being correct (and I deleted my PKT btw.)

Greetings from germany,