Posts

Showing posts from August, 2014

Log4Net Custom Logger for SharePoint 2010 and 2013 (With Attached working Code)

Image
What is the Problem The big problem in SharePoint 2010/2013 to write the custom error to log files, whenever the error comes, the developer grab the associate correlation GUID and see the associated error in 14 hive folder. The log file also contains the bunch of other information as well. It would be great if somehow I can develop the custom logging feature for our project that is only specific to my project. It will reduced my effort and it would be a big win for me as a developer. Solution we would able to solve this problem by using 3rd party open source DLL “log4net” . We have written some custom classes to override the base function that would help us to write SharePoint logs into the 14 hive. These classes contain the logic for generating the logs under the same location, where the SharePoint logs are generated i.e 14 hives under different folder (This will help to get the exact information during the error and trace). Solution Dependency Log4Net Dll Important Confi

CryptographicException : Keyset does not exist (issue fixed)

Image
One of our project(SharePoint) requirements, we need to use the certificate to encrypt and decrypt the data by using the public and private key. So the code implemented on the DEV working fine, but issue comes when code deployed on the other servers. The error was “ Keyset does not exist ”. The base exception class of this error is “ CryptographicException ”. CryptographicException : Keyset does not exist 0(issue fixed) RSACryptoServiceProvider rsaEncryptor = ( RSACryptoServiceProvider )certificate.PrivateKey; This exception comes when the application pool account doesn’t have access to read the certificate private key. For this we would required to give the full access to the particular certificate. Followings are the required steps to fixing this issue. Solution Application Pool account doesn’t having an permission to access the private key value Steps 1.   Login to server Press Ctrl+R type to   MMC. 2.   File -> Add or remove snap-ins 3