Skip to content

Instantly share code, notes, and snippets.

@hujj0615
Created December 19, 2012 08:00
Show Gist options
  • Save hujj0615/4335167 to your computer and use it in GitHub Desktop.
Save hujj0615/4335167 to your computer and use it in GitHub Desktop.
httpclient set http head
HttpRequestBase r;
r.setHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");
r.setHeader( "Accept","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash," +
" application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application," +
" application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*");
r.setHeader("Accept-Encoding", "gzip, deflate");
r.setHeader("Accept-Language", "zh-cn");
r.setHeader("Content-Type", "application/x-www-form-urlencoded");
r.setHeader("Cache-Control", "no-cache");
r.setHeader("Connection", "Keep-Alive");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment