I have been working with streaming media / rtsp for the first time. Usually a steaming media is played by clicking on a standard http link, such as this one:
The problem arises when I try to get the contents of this <ASX> file from in my c# code: Here is my code; the Accept and UserAgent header values were copied from the WireShark analyzer.
string wsbLink = "http://web.servicebureau.net/conf/meta?i=1112994453&c=2343&m=was&u=/w_ccbn.xsl&date_ticker=KCI"; HttpWebRequest r = (HttpWebRequest)WebRequest.Create(wsbLink); r.Accept = "*/*"; r.UserAgent="Windows-Media-Player/9.00.00.4503"; WebResponse resp = r.GetResponse(); StreamReader sr = new StreamReader(resp.GetResponseStream()); string result = sr.ReadToEnd();
The "result" variable will always contain string.Empty, because the contentLength of the response is -1.
I am not able to access the ASX file info using a standard HttpWebRequest.
It seems that the info I'm looking for is outside the HTTP protocol section of the response. Look again at the image from the WireShark analyzer, and you will see that the info is indeed outside the HTTP protocol section of the packet.
So what do I need to be able to do to get his data?
No, this is all inside HTTP. The media type section does not indicate that it's not inside HTTP. It's just a description of something Wireshark has parsed from the HTTP response.
I tried your code "as is" and it worked just fine. I suggest you run Wireshark when issuing the "fake" request, to see what happens.
-- "Mark As Answer" if my reply helped you --
Marked as answer by bboyle1234 on May 23, 2008 06:53 PM
You're right ... oh dear, I had been testing it using "Response.Write(result);" and of course, the resulting webpage didn't show anything, 'cos it wasn't html [:$]
bboyle1234
Member
38 Points
101 Posts
Send and receive non-http requests and responses
May 23, 2008 06:17 PM|LINK
Hi,
I have been working with streaming media / rtsp for the first time. Usually a steaming media is played by clicking on a standard http link, such as this one:
http://web.servicebureau.net/conf/meta?i=1112994453&c=2343&m=was&u=/w_ccbn.xsl&date_ticker=KCI
When I click this link in my browser, it sets off four request-response cycles of HTTP GET --> HTTP1.1 OK.
Each of the GET requests are slightly different, using a different user agent or accept header.
Each time, they generate an OK response with this data in it:
<ASX version="3"> <TITLE>LifeCell Acquisition Update Call</TITLE> <entry> <ref href="mms://a1112.e1112994453.c2343.conf.vm.akamaistream.net/7/1112/2343/1112994453/conference.download.akamai.com/2929/p_!/11/12/99/44/53/1112994453_193.108.155.200_0_1211456272.wma?auth=daAd0ccd0b6ama5d.cTawcraca1bidvc3d6-binUJ3-bA&aifp=001&akamai_event_id=1112994453"/> <starttime value="00:54:36"/> <duration value="00:40:44"/> <TITLE>LifeCell Acquisition Update Call</TITLE> </entry> </ASX>I know this data is contained in the responses, because I have seen it using WireShark analyzer. See the image of these packets in my wireshark here:
http://img518.imageshack.us/img518/5403/mediaquestionkc8.png
The problem arises when I try to get the contents of this <ASX> file from in my c# code: Here is my code; the Accept and UserAgent header values were copied from the WireShark analyzer.
The "result" variable will always contain string.Empty, because the contentLength of the response is -1.
I am not able to access the ASX file info using a standard HttpWebRequest.
It seems that the info I'm looking for is outside the HTTP protocol section of the response. Look again at the image from the WireShark analyzer, and you will see that the info is indeed outside the HTTP protocol section of the packet.
So what do I need to be able to do to get his data?
Many thanks, Ben
gunteman
All-Star
22406 Points
3305 Posts
Re: Send and receive non-http requests and responses
May 23, 2008 06:47 PM|LINK
No, this is all inside HTTP. The media type section does not indicate that it's not inside HTTP. It's just a description of something Wireshark has parsed from the HTTP response.
I tried your code "as is" and it worked just fine. I suggest you run Wireshark when issuing the "fake" request, to see what happens.
bboyle1234
Member
38 Points
101 Posts
Re: Send and receive non-http requests and responses
May 23, 2008 06:53 PM|LINK
You're right ... oh dear, I had been testing it using "Response.Write(result);" and of course, the resulting webpage didn't show anything, 'cos it wasn't html [:$]