vb.net - Trouble with async webrequest -
in first page launch async webrequest on page loaded event.
private sub loadrecent() dim request httpwebrequest = httpwebrequest.create("") request.method = "get" request.begingetresponse(new asynccallback(addressof responserecent), request) end sub private sub responserecent(byval asynchronousresult iasyncresult) dim webrequest httpwebrequest = directcast(asynchronousresult.asyncstate, httpwebrequest) dim webresponse httpwebresponse = webrequest.endgetresponse(asynchronousresult) dim stream new streamreader(webresponse.getresponsestream()) dim responsestring = stream.readtoend end sub
using code, loadrecent()
successfull launched on page loaded. let's suppose have button in first page brings me in page. if press button brought first page again , loadrecent()
fired well. problem response of webrequest same of first time have been fired (and can tell not possible). it's should dispose async webrequest after made it.
Comments
Post a Comment