title: CLR UDF Exception In SQL Server 2005
body: <p>When I try my CLR UDF, I am getting this error:</p>
  
  <p>Msg 6522, Level 16, State 1, Line 1</p>
  
  <p>A .NET Framework error occurred during execution of user-defined routine or aggregate "getFileSize":</p>
  
  <p>System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</p>
  
  <p>System.Security.SecurityException:</p>
  
  <p>at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp; stackMark, Boolean isPermSet)</p>
  
  <p>at System.Security.CodeAccessPermission.Demand()</p>
  
  <p>at System.IO.DirectoryInfo..ctor(String path)</p>
  
  <p>at GetFileInfo.ShowDirectoryName.DirSize(SqlString dir).</p>
  
  <p>Any Idea on how to solve this? I tried to spend some time in BOL but my back is really against the wall right now...</p>
  
  <p>Thanks.</p>