Exemple #1
0
 public void OnResponse(RequestEndArg arg)
 {
     foreach (var cookie in arg.Response.Cookies)
     {
         this.Cookies.AddOrUpdate(cookie.Name, cookie.Value);
     }
 }
Exemple #2
0
 public void OnResponse(RequestEndArg arg)
 {
     if (arg.Response.Headers.Any(x => x.Name.Equals("location", StringComparison.OrdinalIgnoreCase)))
     {
         var location = arg.Response.Headers["location"];
         if (System.Uri.IsWellFormedUriString(location, UriKind.Absolute))
         {
             if (arg.Url.Host != new System.Uri(location).Host)
             {
                 var request = arg.Request.Client.GetRequest(location);
                 request.AddHeader("referer", arg.Request.Url.Host);
                 arg.Manipulate(request.GetResponse(RequestMethod.Get, null));
                 return;
             }
         }
         arg.Manipulate(arg.Request.Client.GetRequest(location).GetResponse(RequestMethod.Get, null));
     }
 }