<p>I am trying to access a Windows Media Player library from ASP.NET.</p>

<p>The following code:</p>

<p>WMPLib.WindowsMediaPlayer mplayer = new WMPLib.WindowsMediaPlayer();</p>

<p>WMPLib.IWMPStringCollection list = mplayer.mediaCollection.getAttributeStringCollection("artist", "audio");</p>

<p>Returns an non-empty list when run using the VS2005 development web server but an empty list when using IIS.</p>

<p>Setting impersonation with:</p>

<p>System.Security.Principal.WindowsImpersonationContext impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();</p>

<p>Doesn't help. It seems that WMPLib still doesn't thinks its running as a user who has a library. </p>

<p>Is there a way to get around this?</p>

Have you tried configuration via web.config in ASP.NET? When you're running in the VS2005 debugger, you're (probably) running code as yourself, but when under IIS you'll be running it as IUSR_
machinename
or another low-permission system account.
Try adding something like this to your web.config file:
```
```
<system.web>
<identity impersonate="true" userName="MYDOMAIN\myuser" password="p@ssw0rd" />
</system.web>
```
```
No idea whether this works with Media Player specifically, but it works for other identity/security related problems like this.