I am trying to access media directly from a network share on our local network. The problem is that I need to pass windows credentials with the url. I have tried impersonation with logon type 9, and I have tried passing the credentials in the url like this:
@"\\username:password@ip\share_name\path\filename.mkv"
I am trying to access the media in a windows media player in a winform project, and the player just loads something and goes to a ready state. When typing the address in explorer it asks for credentials, which is what I expected, but how do I do that in my case? I feel like I have tried everything..
token = IntPtr.Zero;
LogonUser("Username", "NAS-IP", "Password",
9, 0, ref token);
person = new WindowsIdentity(token).Impersonate();
axWindowsMediaPlayer1.URL = @"\\ip\camera_share\axis-ACCC8E7B9050\20170712\08\20170712_085720_39AA_ACCC8E7B9050\20170712_08\20170712_085720_0092.mkv";
EDIT
For some reason it works if I use the machinename/servername as address in the media player url. This is just not that efficient if the client only knows the ip of the server not the name.
token = IntPtr.Zero;
LogonUser("username", "serverip", "password",
9, 0, ref token);
person = new WindowsIdentity(token).Impersonate();
axWindowsMediaPlayer1.URL = @"\\servername\camera_share\axis-ACCC8E7B9050\20170719\10\20170719_100732_8084_ACCC8E7B9050\20170719_10\20170719_100732_E5A7.mkv";
Any idea on how to work around that?