Sets the specified header to the specified value.
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
class MainClass
{
public static void Main()
{
HttpWebRequest myHttpWebRequest = (HttpWebRequest) WebRequest.Create("http://www.msn.com");
WebHeaderCollection myWebHeaderCollection = myHttpWebRequest.Headers;
myWebHeaderCollection.Set("Cache-Control", "no-cache");
HttpWebResponse myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse();
myHttpWebResponse.Close();
}
}
Related examples in the same category