我想创建一个HttpModule来为google bot生成html快照,我的代码是:
private void Application_BeginRequest(Object source, EventArgs e)
{
// Create HttpApplication and HttpContext objects to access
// request and response properties.
var application = (HttpApplication)source;
HttpContext context = application.Context;
string escapedFragment = HttpContext.Current.Request.Params["_escaped_fragment_"];
if (!string.IsNullOrWhiteSpace(escapedFragment))
{
string result = string.Empty;
using (var client = new WebClient())
{
Stream data = client.OpenRead("http://giadinhthinhvuong.com/#/" + escapedFragment);
if (data != null)
{
var reader = new StreamReader(data);
result = reader.ReadToEnd();
}
}
context.Response.Write(result);
}
}
但是它似乎无法在网页中使用ajax内容。
Here您可以找到我的链接测试。
所以我的问题是: