是否有可能爬ASP.NET页面? [英] Is it possible crawl ASP.NET pages?

查看:231
本文介绍了是否有可能爬ASP.NET页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法抓取使用doPostBack作为事件调用一些ASP.NET页面?

Is there a way to crawl some ASP.NET pages that uses doPostBack as events calling?

示例:

Page1.aspx的:

1包含了的LinkBut​​ton重定向到Page2.aspx

Contains 1 LinkButton that redirects to Page2.aspx

code-背后LinkBut​​ton的Click事件:

Code-behind for LinkButton Click event:

 Response.Redirect("Page2.aspx")

在客户端上单击事件生成此code:

In client side this code is generated on click event:

doPostBack(...

在使用它可以抓取网页只HttpWebRequest的?

Is it possible crawl pages using only HttpWebRequest?

我知道,中使用Response.Redirect是不是在这种情况下,一个好主意,但我没有选择。

I know that use Response.Redirect is not a good idea in this case, but I don't have choice.

推荐答案

是的,这是可能的,如果code遵循一个很好predictable格局。你将不得不从页面收集表单数据和模拟什么doPostBack功能无法(在某些隐藏的字段把一些价值),以及发送POST请求到服务器。你获得了将是一个重定向页面,所以你必须解析,以获得目标页面的URL。

Yes, it's possible if the code follows a well predictable pattern. You would have to gather the form data from the page and simulate what the doPostBack function does (putting some values in some hidden fields), and send a POST request to the server. What you get back would be a redirection page, so you would have to parse that to get the url of the target page.

如果你的意思是,如果像谷歌搜索引擎将抓取的网页,那么这是非常不可能的。他们可能会尝试遵循发布和脚本链接的一些常见的模式,但通常你需要使用的页面之间正确的链接,以确保他们是抓取的。

If you mean if search engines like Google will crawl the pages, then that is very unlikely. They might attempt to follow some common patterns of posting and script linking, but generally you need to use proper links between the pages to be sure that they are crawlable.

这篇关于是否有可能爬ASP.NET页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆