Latest Updates: C# Snippets RSS

  • System.Security.SecurityException: That assembly does not allow partially trusted callers

    Phil Leggetter 12:51 am on August 26, 2009 | 1 Permalink | Reply
    Tags: , , C# Snippets,

    I was writing a Windows Azure ASP.NET MVC application and when making a call to a page I received the following exception:

    System.Security.SecurityException: That assembly does not allow partially trusted callers

    In my application I’m using Castle Windsor for dependency injection and when trying to resolve a service using:

    }

    IGravatar gravatar = MvcApplication.Container.Resolve<IGravatar>();

    I received this message. To solve things I needed to update the WebRole element in the ServiceDefinitions.csdef file so that enableNativeCodeExecution is enabled.

    <WebRole name=”TwitterGravatarMVC” enableNativeCodeExecution=”true”>

    I found the solution, detailed above, on the Azure Services Platform Developer Centre forum.

     
  • C# - Get Windows Temporary Directory

    Phil Leggetter 10:25 am on February 2, 2007 | 0 Permalink | Reply
    Tags: , , C# Snippets,

    Once you know it you’ll probably never forget it…but wait, this is the second time I’ve googled for this. I’d best post how you “get the Windows temporary directory using C#“!

    string tempPath =
        System.IO.Path.GetTempPath();
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
esc
cancel