Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

However, this browser should not only display the image, it should also, in a sm

ID: 3736927 • Letter: H

Question

However, this browser should not only display the image, it should also, in a small window above the image, display the HTTP response line and all HTTP headers received from the server serving the HTTP request. For instance, an HTTP request for http://classes.bus.oregonstate.edu/ba371/reitsma/images/cob.png, results in the following response line and headers being returned by COB's Web server:

Simple HTTP Image Browser Browser mage URL:http:// lasses bus.oregonstate.edu/ba371/reitsma/mages/cob.png Status Code: 200:OK Accept-Ranges: bytes Content-Length: 59587 Content-Type: image/png Date: Mon, 19 Mar 2018 23:32:04 GMT ETag: "a7b8794edb63d31:0 Last-Modified: Wed, 22 Nov 2017 21:46:08 GMT Image:

Explanation / Answer

It is very simple you can use the following form.cs file to reproduce the above functonality.


using System;

using System.Drawing;

using System.IO;

using System.Net;

using System.Windows.Forms;

namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)

{

string sURL = textBox1.Text;

WebRequest req = WebRequest.Create(sURL);

WebResponse res = req.GetResponse();


string headers = res.Headers.ToString();

Stream imgStream = res.GetResponseStream();

Image img1 = Image.FromStream(imgStream);

imgStream.Close();

pictureBox1.Image = img1;
richTextBox1.Text = headers;

}

  
}

}
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote