L
L
libera2016-02-27 13:17:52
WPF
libera, 2016-02-27 13:17:52

C# get request with image output?

WebRequest reqGET = WebRequest.Create(@"http://ya.ru/");
            WebResponse resp = reqGET.GetResponse();
            Stream stream = resp.GetResponseStream();
            StreamReader sr = new StreamReader(stream);
            string s = sr.ReadToEnd();
            textBox.Text = s;

Well, everything is clear, a simple request.
Everything comes out fine.
But you need to print n code. Write to a variable.
<img id="formlogin-captcha-image" src="/profile/captcha?v=56d176bfcee6f" alt="">

Here is the code you need to find and cut out captcha?v=56d176bfcee6f from there and display it in textbox1.text

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2016-02-27
@dmitryKovalskiy

There is a great tool for parsing html code for .NET - HtmlAgilityPack

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question