您好,我有一个带有以下脚本的 html 页面 (twitter.html)
<script type="text/javascript" charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
<script type="text/javascript">
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
var TwitterCount = getParameterByName('TwitterCount');
var TwitterHandleName = getParameterByName('TwitterHandleName');
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: TwitterCount,
interval: 30000,
width: 272,
height: 'auto',
theme: {
shell: {
background: '#ffffff',
color: '#000000'
},
tweets: {
background: '#ffffff',
color: '#005A8C',
links: '#000000'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
behavior: 'all'
}
}).render().setUser(TwitterHandleName).start();
</script>
如果我访问该页面
http://localhost/twitter.html?TwitterHandleName=billgates&TwitterCount=3
我可以看到最后 3 条推文。
我想要的是从我的 aspx 页面在此页面上进行 http 发布。下面的代码仅返回脚本标签等,而不是呈现的 html。我的问题是如何获取页面的呈现 html?
HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create("http://localhost/twitter.html?TwitterHandleName=billgates&TwitterCount=3);
loHttp.Timeout = 30000;
loHttp.UserAgent = "Twitter";
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
//Encoding enc = Encoding.GetEncoding(1252); // Windows default Code Page
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream());
string htmlCode = loResponseStream.ReadToEnd();
loWebResponse.Close();
loResponseStream.Close();