Stop a httpwebrequest?

耗尽温柔 提交于 2019-12-11 15:55:18

问题


I made a httpwebrequest in a sub. The form on my program has a start button which calls the sub. I want to add a Stop button to it to stop the httwebrequest if the user so chooses.

How would I do this?


回答1:


Call Abort on the HttpWebRequest.

BEWARE that this might cause some strange behaviour... for example: depending on how you made the request and in what state it is this might lead to a deadlock.




回答2:


You could use the HttpWebRequest.Abort() method to stop your HTTP request.

Please see the following MSDN link for an example.



来源:https://stackoverflow.com/questions/9150738/stop-a-httpwebrequest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!