Monday, November 10, 2014

Logging Utility

Background

Sometimes you need to introduce excessive logging in a workflow, web application, complex runtime application logging is a very important thing in order to identify issues. I have a logger by looking into various loggers available over the web. The sole purpose of this logger for me was to be applied to a workflow which was written in C# using Windows Workflow Foundation.

Logging seems quite easy if it's an application which runs one time or is a sequential one where the rate of concurrent users is less or negligible you just write all the logging lines down in a file and that's all. But imagine when there are multiple people working on an application for which you are logging you will definitely come across the issue of writing to the file when it's already in use.

Implementation Details 


Here are details of the workflow with a test application; I have tried up to 20 threads which are trying to access the file for writing and its working fine.


Monday, March 17, 2014

Handling the UnauthorizedAccessException in SharePoint Visual Web Part


I came across an issue lately where I had to allow different users to access a web part with each having their own permissions set for a document library.

Some of the users might not have access on the web part or even the library that we have configured with this web part to be shown. So in order to by pass the automatically getting redirected to access denied page we need to run the code in this scope


using (new SPSecurity.SuppressAccessDeniedRedirectInScope())
{
   //Your custom code here
}


That's all that helped me get through this painful situation.