Re: Using WMPLib in IIS



I thought the same thing, Alessandro, and so I tried the following things:

* added Identity Impersonate = true (didn't work)
* Set the application pool to run as a specific user, me (didn't work)
* Impersonated the current user through code in the same method I use WMP
(didn't work)

I realize the library wasn't intended to be used this way, but I would have
to think there has to be an API that would allow me to do this (get what
songs are in a library), from what's available with media connect, etc,
especially since the code works outside of IIS. I've been told this works on
other servers such as cassini, just not IIS

"Alessandro Angeli" wrote:

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



.



Relevant Pages

  • Re: AD queries. Please, prove me being wrong...
    ... If you want to impersonate the authenticated user ... Kerberos delegation in AD to allow the web app to have the rights to ... delegate the user's credentials to AD. ... means that you must ensure that you use IWA auth in IIS and ensure that IWA ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: File copy via ASP.NET access errors?
    ... Where are the user credentials coming from? ... the <impersonate> web.config setting, then are you using a domain account? ... Basic Authentication means that IIS has the user's ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: File copy via ASP.NET access errors?
    ... Where are the user credentials coming from? ... the <impersonate> web.config setting, then are you using a domain account? ... Basic Authentication means that IIS has the user's ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: SQL2k3 connectivity problems
    ... I want one user that my app is running under. ... IIS is configured to use this user for anonymous. ... Why wouldn't ASP.Net just follow the rules, and impersonate ... > Why are you using integrated security in an ASP.NET app? ...
    (microsoft.public.dotnet.framework.adonet)