> From: "John"
>
> > When this runs through the ASP.Net Deployment Server,
> > this works fine; the correct number of songs are printed.
> > However, if I run this via IIS instead, it reports that
> > there are 0 songs.
> >
> > What am I missing? Is there a better methodology to
> > access the windows media library opposed to going through
> > WMPLib.dll in ASP.Net?
>
> The MediaLibrary is a per-user resource. If you run the code
> inside VS, it will run as the current user and access the
> current user's library. If you run it inside IIS, it will
> run in the context of the SYSTEM account (or whatever
> account the IIS service is running under) and access that
> account's library, which doesn't exist.
>
> WMP is not designed as a server-side component. If you want
> it to access a given user's library, you can *try*
> impersonating that user on the thread that creates the WMP
> instance. User imporsonation is a security topic, not a
> WindowsMedia one. See
> System.Security.Principal.WindowsImpersonationContext and
> advapi32.dll!ImpersonateLoggedOnUser().
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> //
http://www.riseoftheants.com/mmx/faq.htm >
>
>