解析与回发一个.net页面 [英] Parse a .Net Page with Postbacks

查看:162
本文介绍了解析与回发一个.net页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要阅读的使用aspx页面显示来自联合国从在线数据库中的数据。我以前做过的HTML解析,但它通过操纵查询字符串值始终。在这种情况下,网站使用asp.net回发。所以,你点击一个值箱一个,那么框两个节目,点击一个值框2,点击一个按钮,让您的结果。

I need to read data from an online database that's displayed using an aspx page from the UN. I've done HTML parsing before, but it was always by manipulating query-string values. In this case, the site uses asp.net postbacks. So, you click on a value in box one, then box two shows, click on a value in box 2 and click a button to get your results.

是否有人知道我怎么能自动执行该过程?

Does anybody know how I could automate that process?

谢谢,

迈克

推荐答案

您还可能只需要发送一个请求,但一个请求可以是相当复杂的。 ASP.Net是非常困难的(尽管不是不可能)屏幕抓取。事件验证和视图状态之间,它的棘手得到您的要求恰到好处。做到这一点最简单的方法是经常使用像提琴手嗅探工具来看看到底是什么http请求样子,然后就模仿请求。

You may still only need to send one request, but that one request can be rather complicated. ASP.Net is notoriously difficult (though not impossible) to screen scrape. Between event validation and the ViewState, it's tricky to get your requests just right. The simplest way to do it is often to use a sniffer tool like fiddler to see exactly what the http request looks like, and then just mimic that request.

如果你仍然需要发送两个请求,这是因为第一个请求还使一些国家在会话的地方,这意味着你用什么来发送这些请求需要能够与同一会话发送。这通常意味着配套区。

If you do still need to send two requests, it's because the first request also places some state in a session somewhere, and that means whatever you use to send those requests needs to be able to send them with the same session. This often means supporting cookies.

这篇关于解析与回发一个.net页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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