Streaming music
Streaming music
Streaming music
Streaming music
Streaming music
Streaming music Streaming music Streaming music Streaming music Streaming music Streaming music Streaming music Streaming music
Streaming music Streaming music
Streaming music
Go Back  Xtreme Visual Basic Talk > > > Streaming music


Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2008, 12:28 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Question Streaming music


Hi,

I read this article of few months ago: http://blogs.msdn.com/coding4fun/arc...31/913360.aspx. I built my own site based on the code provided. Locally it worked perfect.

The problem is when I put it on my web server and try to access it from the web. There seems to be no playlist showing, where as when it ran locally I got loads of songs. It seems that the problem might be to do with the user. I did some crude experiments by putting some email code so I could see what was going on.

The first one is at page level:
Code:
Protected Sub lgnAdmin_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles lgnAdmin.Authenticate 'Create an instance of the MailMessage class. Dim objMM As New MailMessage() 'Set the properties. objMM.To = "me@me.co.uk" objMM.From = "me@me.co.uk" objMM.BodyFormat = MailFormat.Html objMM.Priority = MailPriority.High 'Set the subject. objMM.Subject = "User/Password" 'Set the message. objMM.Body = "Your user name is: " & User.Identity.Name 'Send the message, use the Send method of the SmtpMail class. SmtpMail.Send(objMM) If Me.lgnAdmin.UserName = System.Configuration.ConfigurationManager.AppSettings("UserName").ToString And Me.lgnAdmin.Password = System.Configuration.ConfigurationManager.AppSettings("Password").ToString Then Response.Redirect("Admin.aspx") Else Me.lgnAdmin.InstructionText = "Sorry, your login details do not match!" End If

The second one is in the database class provided by coding 4 fun:
Code:
Private Shared Sub Refresh() Dim wmp As WindowsMediaPlayer = New WindowsMediaPlayer Dim playlist As IWMPPlaylist = wmp.mediaCollection.getAll() 'Create an instance of the MailMessage class. Dim objMM As New MailMessage() 'Set the properties. objMM.To = "me@me.co.uk" objMM.From = "me@me.co.uk" objMM.BodyFormat = MailFormat.Html objMM.Priority = MailPriority.High 'Set the subject. objMM.Subject = "User/Password" 'Set the message. objMM.Body = "Your user name is: " & My.User.Name & "<br/>Playlist count is: " & playlist.count.ToString 'Send the message, use the Send method of the SmtpMail class. SmtpMail.Send(objMM) Dim artistDictionary As Dictionary(Of String, Artist) = New Dictionary(Of String, Artist) For i As Integer = 0 To playlist.count - 1 Dim media As IWMPMedia = playlist.Item(i) Dim albumArtistName As String = media.getItemInfo("AlbumArtist") Dim albumName As String = media.getItemInfo("Album") Dim trackName As String = media.getItemInfo("Title") Dim trackLocation As String = media.getItemInfo("SourceUrl") Dim trackNumberString As String = media.getItemInfo("OriginalIndex") Dim theArtist As Artist Dim artistSortName As String = Artist.GetSortName(albumArtistName) If Not artistDictionary.TryGetValue(artistSortName, theArtist) Then theArtist = New Artist(albumArtistName) artistDictionary.Add(artistSortName, theArtist) End If Dim theAlbum As AppCode.Album If Not theArtist.Albums.TryGetValue(albumName, theAlbum) Then theAlbum = New AppCode.Album(albumName, theArtist) theArtist.Albums.Add(albumName, theAlbum) End If Dim theTrack As Track If Not theAlbum.Tracks.TryGetValue(trackName, theTrack) Then Dim trackNumber As Integer If Integer.TryParse(trackNumberString, trackNumber) Then theTrack = New Track(trackNumber, trackName, trackLocation) Else theTrack = New Track(trackName, trackLocation) End If theTrack.Album = theAlbum theAlbum.Tracks.Add(trackName, theTrack) End If Next ArtistList.AddRange(artistDictionary.Values) ArtistList.Sort() End Sub

When I ran it in visual studio I got a user and lots of songs in the playlist. Running it from IIS I got no user and no playlist.

I have read impersonation articles and tried adding the following to my web config:
Code:
<identity impersonate="true" userName="machine\me" password="pass"/>
After adding this the email logging still the user as blank.

Also read various articles such as: http://msdn2.microsoft.com/en-us/lib...c5(VS.71).aspx. Up to now I stumped.

I wanted to add this to part of my site (with a login page to stop public access) so I could access all my music on my server at home from work.

Can anyone please help.

Dave.
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #2  
Old 01-05-2008, 07:33 AM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Question The stream dies not flow yet!

Hi,

Tried 2 stategies but still no luck.

Attempt 1 Windows Authentication. Here is what IIS 5 security looks like:

http://i205.photobucket.com/albums/b...ia/windows.jpg

Here is the relevant part of web config:

Code:
<system.web> <httpHandlers> <add path="*.wpl" type="PlaylistCreator" verb="*" validate="false" /> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> </httpHandlers> <httpModules> <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" /> <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" /> <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule" /> </httpModules> <siteMap defaultProvider="MusicSiteMapProvider"> <providers> <add name="MusicSiteMapProvider" type="MusicSiteMapProvider" /> </providers> </siteMap> <compilation debug="true"/> <authentication mode="Windows"/> <authorization> <allow users="MACHINE\ME" /> <deny users="*" /> </authorization> </system.web>

I am given a windows login screen at which I put in my normal windows login details. It fails 3 times and then shows the You are not authorized to view this page page.



Attempt 2 Forms Authentication. Here is what IIS 5 security looks like:

http://i205.photobucket.com/albums/b...aria/forms.jpg

Here is the relevant part of web config:

Code:
<system.web> <httpHandlers> <add path="*.wpl" type="PlaylistCreator" verb="*" validate="false" /> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> </httpHandlers> <httpModules> <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" /> <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" /> <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule" /> </httpModules> <siteMap defaultProvider="MusicSiteMapProvider"> <providers> <add name="MusicSiteMapProvider" type="MusicSiteMapProvider" /> </providers> </siteMap> <compilation debug="true"/> <authentication mode="Forms"> <forms loginUrl="Homepage.aspx" protection="All" timeout="30" name=".ASPXAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="Homepage.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" /> </authentication> <authorization> <deny users="?" /> </authorization> </system.web>

Again, I am given a windows login screen at which I put in my normal windows login details. It fails 3 times and then shows the You are not authorized to view this page page.

One other point, when I publish this site for IIS to run I stop the site in IIS and re-start it. Are there any other steps I am missing out?

Please help if you can.

Thanks, Dave.
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #3  
Old 01-12-2008, 08:14 AM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Question Is this possible?

Hi,

I found that impersonation is not the problem. I put this is my config:
Code:
<authentication mode="Windows"/> <identity impersonate="true" userName="MCH_NAME\ME" password="pasword"/>

Then I put this code in my page:
Code:
Dim username As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name Me.Label1.Text = "Users name is: " & username

The impersonation worked when I browsed the site through IIS. The user was as the config file stated, however the playlist is still empty.

Do you think that trying to access my music collection stored on my web server from a machine via the internet is possible or am I wasting my time?

If it is at all possible what should I check as the cause of the playlist being empty.

I really would appreciate some help as I have been trying to do this for a while now.

Dave.
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #4  
Old 01-14-2008, 08:35 AM
shaul_ahuvaStreaming music shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

It looks like it is possible, but using integrated authentication can be tricky depending on your network setup.

Have you tried basic authentication just to see if it works?
Reply With Quote
  #5  
Old 01-14-2008, 12:07 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default

If I try basic authentication what do I set my Defalut Domain & Realm to?
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #6  
Old 01-14-2008, 12:22 PM
shaul_ahuvaStreaming music shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

You can just leave them as default. When you try to log on, you'll get a dialog asking you to enter your username and password. Then, just enter the username as "[domain or machine] name\user name" and your password.
Reply With Quote
  #7  
Old 01-14-2008, 12:44 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default

I put my login details in and it fails to log in. After 2 more attempts I get the: You are not authorized to view this page message.
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #8  
Old 01-14-2008, 01:07 PM
shaul_ahuvaStreaming music shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

Hmmm...I'll give this a whirl when I get home tonight to see if I can replicate the problem.
Reply With Quote
  #9  
Old 01-14-2008, 04:02 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default

Truly appreciated!

Let me know if you want any of my code zipping up for you!

Many thanks, again

Dave.
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #10  
Old 01-14-2008, 10:48 PM
shaul_ahuvaStreaming music shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

I did some checking, and it appears that wmp.dll (specifically, the WMPlayer.OCX.7 class) needs to be set up as a COM+ application to work as you want it to (at least in Server 2003). I'm not sure why it works okay locally in XP Pro, but then again I'm no security expert. Even then, I was only get the default list of playlists and no songs that were in the library.

I hesitate to provide any more info at this point due to my limited understanding in this area and the dangers of accidentally decreasing security on a web server. Hopefully someone with more knowledge in this area can chime in...

Also, have you thought about a different technology or approach to what you want to do? While I don't have any real hard evidence to lean on, my understanding is that automating client applications on a server is usually not the best solution.

Last edited by shaul_ahuva; 01-14-2008 at 10:53 PM.
Reply With Quote
  #11  
Old 01-15-2008, 03:46 AM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default

Hi,

I am open to suggestions of different technology approaches. The reason I decided to do it this way in the first place was the link I mentioned at the start of this thread.

If you can think of a way this is possible please tell!

Cheers, Dave.
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #12  
Old 01-15-2008, 07:32 AM
shaul_ahuvaStreaming music shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

What exactly are your requirements - to provide a site similar to the one in the article?
Reply With Quote
  #13  
Old 01-15-2008, 12:10 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default

I wanted if it is at all possible to access my music library of my web server, from my computer at work via the web.
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
  #14  
Old 01-16-2008, 08:46 AM
shaul_ahuvaStreaming music shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

Hmmm...well it looks playlist files don't store very much information, and after a brief search it seems the "Windows Media Library" has a proprietary interface that MS hasn't released...

In a nutshell, if automating Media Player won't work (again, I don't know if it will) then the only thing you really have is the media file itself since it looks like everything else is pulled from the media library. This is probably not what you want, but I'm afraid I've hit a wall regarding suggestions.

What o/s are you using on your web server? Based on my testing, Server 2003 doesn't allow access to WMP by default while XP Pro seems to allow access. Since the article was geared towards Media Center, maybe that's the problem?
Reply With Quote
  #15  
Old 01-16-2008, 01:12 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default

I am using Windows Server 2003. Do you reckon that something like WinAmp would be more agreeable than WMP?
__________________
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Streaming music
Streaming music
Streaming music Streaming music
Streaming music
Streaming music
Streaming music Streaming music Streaming music Streaming music Streaming music Streaming music Streaming music
Streaming music
Streaming music
 
Streaming music
Streaming music
 
-->