/*** Extract the value of a specific input from the page *@paramFormparams *@paramDocument *@paramElementID*/ Private voidAddformhiddenelementvalue (list<basicnamevaluepair>Formparams, document document, String ElementID) {element element=document.getElementById (ElementID); if(Element! =NULL) {String elementvalue= Element.attr ("Value"); Formparams.add (NewBasicnamevaluepair (Elementid,elementvalue)); } }
/** * Get the document instance for the corresponding URL *
@param
URL *
@return
*/
private
static
document getdocument (String URL) {Document document =
null
;
try
{document =
Jsoup.connect (URL). get ();
catch
(IOException e) {E.printstac Ktrace ();
return
document; }
Document document = getdocument (URL); if NULL ) { Listnew arraylist<string>(); Elementids.add ("__viewstate"); Elementids.add ("__viewstategenerator"); Elementids.add ("__eventvalidation"); for (String elementid:elementids) { addformhiddenelementvalue (formparams, document, ElementID); } }
Java uses Jsoup components to extract ViewState related parameters for ASP. NET WebForm Development Web page