create cross domain proxy page with asp.net

Hello there,
I create a c# code according the link below to create a proxy page to get info from blip.tv

http://www.experts-exchange.com/Programming/Languages/Scripting/AJAX/Q_23622413.html?sfQueryTermInfo=1+asp.net+cross+domain+proxi

The code I have below works fine to get the details info from blip.tv but get wrong information with the playlist
url for detail list
http://www.blip.tv/file/2331487?skin=json
url for playlist
http://www.blip.tv/bookmarks/1990066?skin=json
Both link retrive correct info from web browser, but with the c# code, play list is not correct.
Any idea? Thanks ahead
string requestcontent;
        string responsecontent;
   
        string request = "http://blip.tv/bookmarks/1990066?skin=json";
        HttpWebRequest req=(HttpWebRequest)WebRequest.Create(request );
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
     
        Stream sw = req.GetRequestStream();
        sw.Write(buffer, 0, buffer.Length);    
        sw.Close();
 
        HttpWebResponse WebResp = (HttpWebResponse)req.GetResponse();
        Stream sr = WebResp.GetResponseStream ();
        StreamReader sdr = new StreamReader(sr);
        responsecontent = sdr.ReadToEnd();
 
        responsecontent = responsecontent.Replace("]);", "]");     
        responsecontent = responsecontent.Substring(16, responsecontent .Length -16);
        Response .Write (responsecontent );
        sdr.Close();
        WebResp.Close();

Open in new window

LVL 1
tomcattyyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MogalManicCommented:
Try changing the Method to Get (line 6).
0
tomcattyyAuthor Commented:
Hello MoqalManic,
I change the method to Get and get this runtime exception
System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.
on this line
Stream sw = req.GetRequestStream();
suggestions?
thanks

0
MogalManicCommented:
Sorry,

I did not examine your sample close enough.  When you use the GET method you don't need lines 7-11(all of the information to request the data is in the URL).  So your code should look like this:
string requestcontent;
string responsecontent;
 
string request = "http://blip.tv/bookmarks/1990066?skin=json";
HttpWebRequest req=(HttpWebRequest)WebRequest.Create(request );
req.Method = "GET";
 
HttpWebResponse WebResp = (HttpWebResponse)req.GetResponse();
Stream sr = WebResp.GetResponseStream ();
StreamReader sdr = new StreamReader(sr);
responsecontent = sdr.ReadToEnd();
 
responsecontent = responsecontent.Replace("]);", "]");     
responsecontent = responsecontent.Substring(16, responsecontent .Length -16);
Response .Write (responsecontent );
sdr.Close();
WebResp.Close();

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

tomcattyyAuthor Commented:
Thanks MoqaManic,
I changed as suggest and it works as before. I start to suspect it's the source feed got problem, I send in one playlist number and It returned with all playlist with id=-1, I am contacting the blip.tv now to see if it is their problem.
the query is like below
http://blip.tv/bookmarks/179899?skin=json
I will got correct count in FF but not in IE, so after I place the query in c# code, the result is not correct.
Any input on this?
Thanks
0
tomcattyyAuthor Commented:
Hello MogalManic,
obviously the json feed got problem, they suggest me to use Rss feed,
I remove some of the returncontent trimming line and I hope to see the whole xml content.
 but after I change the request string to a RSS feed. I got only the content, all  the xml tag was not shown as it should be here, below in code snippet is the one been returned.
Can you see something need to change? Thanks.

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:blip="http://blip.tv/dtd/blip/1.0" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:amp="http://www.adobe.com/amp/1.0" xmlns:dcterms="http://purl.org/dc/terms" xmlns:gm="http://www.google.com/schemas/gm/1.1" xmlns:mediaad="http://blip.tv/dtd/mediaad/1.0" version="2.0">
<channel>
<title>tomcattyy : epicProp1 - blip.tv (beta)</title>
<link>http://blip.tv</link>
<description>tomcattyy : epicProp1 - blip.tv (beta)</description>
<language>en-us</language>
<generator>http://blip.tv</generator>
<lastBuildDate>Tue, 07 Jul 2009 20:52:55 +0000</lastBuildDate>
<pubDate>Tue, 07 Jul 2009 20:52:55 +0000</pubDate>

<item>
<guid isPermaLink="false">5600B332-6B37-11DE-8F7C-C8FB9814B35A</guid>
<link>http://blip.tv/file/2331487</link>
<title>property1</title>
<blip:user>tomcattyy</blip:user>
<blip:userid>408432</blip:userid>
<blip:safeusername>tomcattyy</blip:safeusername>
<blip:show>tomcattyy</blip:show>
<blip:showpage>http://tomcattyy.blip.tv/</blip:showpage>

<blip:picture>http://blip.tv/skin/blipnew/placeholder_user.gif</blip:picture>
<blip:posts_id>2351491</blip:posts_id>
<blip:item_id>2331487</blip:item_id>
<blip:item_type>file</blip:item_type>
<blip:contentRating>TV-UN</blip:contentRating>
<blip:rating>0.0</blip:rating>
<blip:datestamp>2009-07-07T20:47:07Z</blip:datestamp>
<blip:language>English</blip:language>
<blip:adChannel/>

<blip:recommendations>0</blip:recommendations>
<blip:recommendable>0</blip:recommendable>
<blip:adminRating/>
<blip:runtime>51</blip:runtime>
<blip:embedLookup>AYGPw2eY91Q</blip:embedLookup>
<blip:embedUrl type="application/x-shockwave-flash">http://blip.tv/play/AYGPw2eY91Q</blip:embedUrl>
<wfw:commentRss>http://blip.tv/comments/?attached_to=post2351491&skin=rss</wfw:commentRss>
<blip:thumbnail_src>Tomcattyy-property1247-316.jpg</blip:thumbnail_src>
<blip:puredescription>House </blip:puredescription>

<blip:smallThumbnail>http://a.images.blip.tv/Tomcattyy-property1247-316-875.jpg</blip:smallThumbnail>
<blip:license>No license (All rights reserved)</blip:license>
<description>

http://blip.tv tomcattyy : epicProp1 - blip.tv (beta) en-us http://blip.tv Tue, 07 Jul 2009 20:52:55 +0000 Tue, 07 Jul 2009 20:52:55 +0000 5600B332-6B37-11DE-8F7C-C8FB9814B35A http://blip.tv/file/2331487 tomcattyy 408432 tomcattyy tomcattyy http://tomcattyy.blip.tv/ http://blip.tv/skin/blipnew/placeholder_user.gif 2351491 2331487 file TV-UN 0.0 2009-07-07T20:47:07Z English 0 0 51 AYGPw2eY91Q http://blip.tv/play/AYGPw2eY91Q http://blip.tv/comments/?attached_to=post2351491&skin=rss Tomcattyy-property1247-316.jpg House http://a.images.blip.tv/Tomcattyy-property1247-316-875.jpg No license (All rights reserved) <embed src="http://blip.tv/play/AYGPw2eY91Q" type="application/x-shockwave-flash" width="480" height="390" allowscriptaccess="always" allowfullscreen="true"></embed> <br /> House http://blip.tv/file/2331487 Default Category Tue, 07 Jul 2009 20:52:55 +0000 <embed src="http://blip.tv/play/AYGPw2eY91Q" type="application/x-shockwave-flash" width="480" height="390" allowscriptaccess="always" allowfullscreen="true"></embed> property1 30FA4B6C-6B31-11DE-A131-99B68C287762 http://blip.tv/file/2331301 tomcattyy 408432 tomcattyy tomcattyy http://tomcattyy.blip.tv/ http://blip.tv/skin/blipnew/placeholder_user.gif 2351289 2331301 file TV-UN 0.0 2009-07-07T20:03:08Z English 0 0 187 AYGPwh2Y91Q http://blip.tv/play/AYGPwh2Y91Q http://blip.tv/comments/?attached_to=post2351289&skin=rss Tomcattyy-mark1854-465.jpg this isthe video1 http://a.images.blip.tv/Tomcattyy-mark1854-465-932.jpg No license (All rights reserved) <embed src="http://blip.tv/play/AYGPwh2Y91Q" type="application/x-shockwave-flash" width="320" height="270" allowscriptaccess="always" allowfullscreen="true"></embed> <br /> <strong>this isthe video1<br /></strong> http://blip.tv/file/2331301 Citizen Journalism korean Tue, 07 Jul 2009 20:53:39 +0000 korean korean <embed src="http://blip.tv/play/AYGPwh2Y91Q" type="application/x-shockwave-flash" width="320" height="270" allowscriptaccess="always" allowfullscreen="true"></embed>mark1

Open in new window

0
tomcattyyAuthor Commented:
It turned out to be the xml file displayed by browser is like that, all tag will be removed. It's working fine. Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.