开发者

visual studio c# webclient

开发者 https://www.devze.com 2023-01-22 13:09 出处:网络
Can i use like webclient or webrequest (I dont know) to do the following: click a button, once its click it send a string lets say \"Hello\" to a website\'s textbox开发者_如何学运维,

Can i use like webclient or webrequest (I dont know) to do the following:

click a button, once its click it send a string lets say "Hello" to a website's textbox开发者_如何学运维,

for example: button1 click, write "Hello" on textbox1 on website http://Test.com


There two general ways to deal with websites - either you are speaking straight HTTP in your C# program (this is WebRequest) or you use COM/Interop to control a browser.
If you are looking at HTML, then you need to use Interop to remote control a browser. Other alternatives to look at are Selenium.


WebClient is a class in System.Net namespace

you can download the content throught webclient by writing a method like

  public static string downloadcontent(string urlofpage)
        {
            WebClient client = new WebClient();

            string content = client.DownloadString(urlofpage);

            return content;
        }

this method return you a page who you want to download.

if you need something else then tell me by comment

0

精彩评论

暂无评论...
验证码 换一张
取 消