Trusted Proxy + Sandbox logger + CAS (Part 2)

As you can read here , we are creating a full trusted proxy with also some CAS principles.

The Full trusted proxy should be finished and now it’s time to write a Sandbox Solution that will be using this logger.

1. Make sure the Full trusted proxy is deployed at farm level and that the feature is activated.

2 Because we are calling from a partially trusted application we need to tell the DLL that this can be expected and is ok.

Go to AssemblyInfo.CS


And add a line at the bottom:


Ok now re-deploy the Trusted Proxy.

3. Create a new project under the current Visual Studio solution (Sandboxed)

3. a. Before we can use the full trusted proxy, we first need to make a reference to it’s DLL file. But first we need to add something to the Full trusted proxy.

4. Create a new code file “Logger.cs” and enter the code below, as you can see the ULSProxyArgs are being instantiated and than passed via the ExecuteRegisteredProxyOperation.


5. Now add a feature receiver and for this example we will create for each content type a new list + logging everything that we do.



6. Checks are being done and all the exceptions are being caught and logged. But we can also created our own exceptions and pass information to the SP logs.

7. Finally we should see something like the picture below appearing in the logs.



Now if you get into some trouble and get errors like: An operation is not legal in the current state.

Than double check the Feature receiver of the trusted proxy and what assembly and type name it passes. This is most the time the problem/solution.

Logger Code: icon_home_skydrive

Leave a Reply

Your email address will not be published. Required fields are marked *