我想使用 Watin 来获取 html 快照,以使我的单页 ajax 应用程序可以按照 google 规范进行爬网。
有人可以向我展示如何使用 Watin 将 html 快照返回给 googlebot 的代码示例吗?
这是我到目前为止所拥有的,但老实说,我什至不确定我要去哪里,我真的没有在网上找到一个可以真正清除它的例子:
控制器:
public PartialViewResult Solutions()
{
//Googlebot request
HtmlString htmlSnapshot = (HtmlString)GetHtmlSnapshot(Request.Path);
//return ?????????
//Normal user request
return PartialView("Solutions", null);
}
public PartialViewResult MarketData()
{
return PartialView("MarketData", null);
}
public IHtmlString GetHtmlSnapshot(string uglyUrl)
{
if (uglyUrl.Contains("?_escaped_fragment_="))
{
string prettyUrl = uglyUrl.Replace("?_escaped_fragment=", "");
string decodedUrl = HttpUtility.UrlDecode(prettyUrl);
FireFox firefox = new FireFox();
firefox.GoTo(decodedUrl);
//?????????
}
}