title: SQL CLR how to access username, hostname, and app_name running in safe mode
body: <p>I have a trigger written in sql clr (sql 2005, .net 3.5) and I need to get at username, hostname and app_name.  In TSQL I would simply use</p>
  
  <pre><code>select suser_name()
  select host_name()
  select APP_NAME()
  </code></pre>
  
  <p>In my .Net code I tried</p>
  
  <pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().Name
  System.Environment.MachineName
  System.AppDomain.CurrentDomain.ApplicationIdentity.FullName
  </code></pre>
  
  <p>but running in safe mode I do not have access to any of these properties.  Any ideas on how to acomplish this?</p>
  
  <p>Thanks</p>