Sandbox framework provides excellent way for farm administrators to validate solutions that run in the sandbox. Farm administrators need to deploy sandboxed solution validator that run when a sandboxed solution is uploaded to a Solution Gallery. Sandboxed solution validator is called when a solution is activated. The validator class inherits from SPSolutionValidator. We need to override ValidateSolution and ValidateAssembly methods. The ValidateSolution method is called once for each solution, and ValidateAssembly is called once for each assembly in each solution.
Code : http://min.us/mvkppzL