How to set User Agent for HttpRequest?

Posted: 3 years ago Quote #130
Sorry, I just come In the office, have you figured it out how to use the headers? You just set the properties in the configuration.

config.UserAgentHeader = "myCrawler";

Best regards
Crawler-Lib Developer
Posted: 3 years ago Quote #131
It's  OK.

var Testrequest = await new HttpRequest(
                       new HttpRequestConfig {
                            Url = new Uri(""),
                            UserAgentHeader = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0",
                            AwaitProcessing = AwaitProcessingEnum.All

I obtain this result.
  "headers": {
    "Accept-Charset": "utf-8,ISO-8859-1;q=0.8,*;q=0.5",
    "Accept-Encoding": "gzip,deflate",
    "Host": "",
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0"

Rem :
Tom, Why don't create a Headers property with an initialize list?
So we could add elements like the User Agent
eg : Headers.Add(new KeyValuePair<string, string>("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0")

Posted: 3 years ago Quote #132
You can Add() to the headers as you described, you have to initialize the list first:

var config = new HttpRequestConfig { Headers = new List<KeyValuePair<string, string>>() };
config.Headers.Add(new KeyValuePair<string, string>("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0");
var request = await new HttpRequest(config);

This avoid the allocation of a empty Headers list when none is needed in the specific context.

The style sheet for the code sections in this forms are crap! We must fix this.
Crawler-Lib Developer
Posted: one year ago Quote #263
nfl vikings jerseys, lunette ray ban pas cher, abercrombie fitch, hollister clothing store, adidas shoes, coach factory, juicy couture clothings, michael kors, oakley sunglasses cheap, new balance outlet, nfl lions jerseys, ralph lauren, rolex watches, mcm handbags, nfl broncos jerseys, kate spade outlet online, ralph lauren, nfl bears jerseys, barbour jackets, tory burch sale, burberry outlet online, replica handbags, ray bans, longchamp handbags, ray bans, mlb jerseys, burberry outlet online, replica watches, nike, air jordans, givenchy outlet online, ugg, montre femme, guess, michael kors, nhl jerseys, hogan, uggs on sale, washington wizards jerseys, dsquared2, babyliss, nfl browns jerseys, huarache, ray ban, burberry online shop, cheap michael kors, dre beats, michael kors, nike, mlb jerseys, celine bags, adidas schuhe, asics gel, longchamp, new balance, true religion jeans women, ugg australia, jimmy choo, memphis grizzlies jerseys, barbour jacket outlet, cheap oakley sunglasses, replica watches, ralph lauren outlet, uggs boots, coach factory, ray ban outlet, burberry outlet, [url=http://www.pandora.