Claus on Code

A data dudes random musings about code, bugs, products, life etc.

  • What week is it?

    I noticed many people are using the weeks, as a way of describing time. I have never used weeks, so I never know where to look up what date, a week is. I have always thought that it would be easy to make a program in .NET that do the work for me, and it… Continue reading

  • New job

    Long time no see. It’s been a long time since my last post. That is partly due to my new job. I just changed workplace from one of the biggest software companies in Scandinavia, to a little software consulting company with 18 employees. My short-sighted plan with this blog, was actually to write about my… Continue reading

  • Impersonating administrator

    Developing to sharepoint 2003, you often need to access data, that only an administrator has access to. To do that in code, you need to impersonate an administrator. The classic solution looks like this.    Add the following code to your project:  private WindowsImpersonationContext ctx = null;  public void UseAppPoolIdentity(){   try{    if (!WindowsIdentity.GetCurrent().IsSystem){… Continue reading