C#在后台访问网站 [英] C# access website in background
本文介绍了C#在后台访问网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够通过C#窗口的Form应用程序访问LastFM的API.我希望能够使用LastFM的API搜索.如何提出要求?
"http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=" + apikey +&artist =" + artist +&album =" + album
I want to be able to access LastFM''s API through my C# Window''s Form application. I want to be able to use LastFM''s API search. How can I make a request?
"http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=" + apikey + "&artist=" + artist + "&album=" + album
推荐答案
使用类System.Net.HttpWebRequest
.您将需要使用编译时间类System.Net.WebRequest
,因为运行时类型由URI在其工厂方法Create
中确定.
您将在此处找到一些代码示例:
http://msdn.microsoft.com/en-us/library/system.net. webrequest.aspx [ ^ ].
—SA
Use the classSystem.Net.HttpWebRequest
. You will need to use compile time classSystem.Net.WebRequest
, as the runtime type is determined by the URI in its factory methodCreate
.
You will find some code sample here:
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].
—SA
您可以在URL上进行HTTP发布,然后查看响应中返回的内容.
You can do a HTTP post to the URL and see what you get back in a response.
这篇关于C#在后台访问网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文