Bonjour,

j'essaie de me connecter à mon compte gmail avec la classe HttpWebRequest. Je me base sur le plugin LiveHttpHeaders de Firefox qui affiche la méthode de connexion utilisée par le plugin Gmail Manager mais je n'arrive pas à faire la même chose...
J'arrive sur une page de google "Page incorrecte".

Voici les infos de connexion de Gmail Manager, vues par LiveHTTPHeaders:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
https://www.google.com/accounts/ServiceLoginAuth
 
POST /accounts/ServiceLoginAuth HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Length: 193
Content-Type: application/x-www-form-urlencoded
ltmpl=default&ltmplcache=2&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D0&service=mail&rm=false&ltmpl=default&Email=test%40gmail.com&Passwd=motDePasse&rmShown=1&signIn=Sign+in
HTTP/1.x 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
Location: https://www.google.com/accounts/CheckCookie?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D0&service=mail&ltmpl=default&chtml=LoginDoneHtml
Content-Encoding: gzip
Date: Sun, 08 Feb 2009 12:44:05 GMT
X-Content-Type-Options: nosniff
Expires: Sun, 08 Feb 2009 12:44:05 GMT
Cache-Control: private, max-age=0
Content-Length: 258
Server: GFE/1.3
----------------------------------------------------------
https://www.google.com/accounts/CheckCookie?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D0&service=mail&ltmpl=default&chtml=LoginDoneHtml
 
GET /accounts/CheckCookie?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D0&service=mail&ltmpl=default&chtml=LoginDoneHtml HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: SID=DQAAAHQAAAAcd2EJM2dHsH1SijNWriGgr323MxbK4iLQ5bOXGWyg3SeNizocUr4ssHfzvVOttQVAvSDdZ5ZI6l9XMmfTOzfnwTRZUmj_dt3cWq_Fys6pA84RshXeNpf2beblAJIjjneECfTOXtOBfQx59ZVvnnxNF8NpnNm2Z4mMrauqP7ARtA, LSID=cl:DQAAAHcAAABcjhtedGvyWBoJ6szxC1j7oD7Y28UrE5ebLIiiTSB3x26pNN1IUPTJjgWTNJV2SR7akQrp4JXBj9b9lDDLuTy0XcCFgfCIdAD5GsvBJu66zMkQHEZiKiWi9m1yga5ueLPZIwHACxk0VuVRd6X0b9oReQRma8OA6mkpde8y2DDuMQ
 
HTTP/1.x 200 OK
Content-Type: text/html; charset=UTF-8
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: Mon, 01-Jan-1990 00:00:00 GMT
Content-Encoding: gzip
Date: Sun, 08 Feb 2009 12:44:05 GMT
X-Content-Type-Options: nosniff
Content-Length: 701
Server: GFE/1.3
----------------------------------------------------------
https://mail.google.com/mail/
 
GET /mail/ HTTP/1.1
Host: mail.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: SID=DQAAAHQAAAAcd2EJM2dHsH1SijNWriGgr323MxbK4iLQ5bOXGWyg3SeNizocUr4ssHfzvVOttQVAvSDdZ5ZI6l9XMmfTOzfnwTRZUmj_dt3cWq_Fys6pA84RshXeNpf2beblAJIjjneECfTOXtOBfQx59ZVvnnxNF8NpnNm2Z4mMrauqP7ARtA, LSID=cl|mail|s.FR:DQAAAHcAAABcjhtedGvyWBoJ6szxC1j7oD7Y28UrE5ebLIiiTSB3x26pNN1IUPTJjgWTNJV2SR7akQrp4JXBj9b9lDDLuTy0XcCFgfCIdAD5GsvBJu66zMkQHEZiKiWi9m1yga5ueLPZIwHACxk0VuVRd6X0b9oReQRma8OA6mkpde8y2DDuMQ
 
HTTP/1.x 302 Moved Temporarily
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Sun, 08 Feb 2009 12:44:05 GMT
Location: https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=1k96igf4806cy&ss=1&scc=1&ltmpl=default&ltmplcache=2
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Transfer-Encoding: chunked
Content-Encoding: gzip
Server: GFE/1.3
----------------------------------------------------------
https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=1k96igf4806cy&ss=1&scc=1&ltmpl=default&ltmplcache=2
 
GET /accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=1k96igf4806cy&ss=1&scc=1&ltmpl=default&ltmplcache=2 HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: SID=DQAAAHQAAAAcd2EJM2dHsH1SijNWriGgr323MxbK4iLQ5bOXGWyg3SeNizocUr4ssHfzvVOttQVAvSDdZ5ZI6l9XMmfTOzfnwTRZUmj_dt3cWq_Fys6pA84RshXeNpf2beblAJIjjneECfTOXtOBfQx59ZVvnnxNF8NpnNm2Z4mMrauqP7ARtA, LSID=cl|mail|s.FR:DQAAAHcAAABcjhtedGvyWBoJ6szxC1j7oD7Y28UrE5ebLIiiTSB3x26pNN1IUPTJjgWTNJV2SR7akQrp4JXBj9b9lDDLuTy0XcCFgfCIdAD5GsvBJu66zMkQHEZiKiWi9m1yga5ueLPZIwHACxk0VuVRd6X0b9oReQRma8OA6mkpde8y2DDuMQ
 
HTTP/1.x 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: Mon, 01-Jan-1990 00:00:00 GMT
Location: https://mail.google.com/mail/?ui=html&zy=l&pli=1&auth=DQAAAHkAAACieyfh2cWiDzMSNnWFbEu5KYywpcQDtXzeu8-CVNFoIkG1zDupINcGMwIMHaKFFpqbCKwqaYIa7pUmz4Eb0pcWqbPVj4D3vTPE3o2kwhhRHVksxQX0LPLCqevPtg0amRzkElcMvTLynLMkfiJQWBfBMzv0FaDnWjtINnnE8wdQnw&gausr=test%40gmail.com
Content-Encoding: gzip
Date: Sun, 08 Feb 2009 12:44:06 GMT
X-Content-Type-Options: nosniff
Content-Length: 370
Server: GFE/1.3
----------------------------------------------------------
https://mail.google.com/mail/?ui=html&zy=l&pli=1&auth=DQAAAHkAAACieyfh2cWiDzMSNnWFbEu5KYywpcQDtXzeu8-CVNFoIkG1zDupINcGMwIMHaKFFpqbCKwqaYIa7pUmz4Eb0pcWqbPVj4D3vTPE3o2kwhhRHVksxQX0LPLCqevPtg0amRzkElcMvTLynLMkfiJQWBfBMzv0FaDnWjtINnnE8wdQnw&gausr=test%40gmail.com
 
GET /mail/?ui=html&zy=l&pli=1&auth=DQAAAHkAAACieyfh2cWiDzMSNnWFbEu5KYywpcQDtXzeu8-CVNFoIkG1zDupINcGMwIMHaKFFpqbCKwqaYIa7pUmz4Eb0pcWqbPVj4D3vTPE3o2kwhhRHVksxQX0LPLCqevPtg0amRzkElcMvTLynLMkfiJQWBfBMzv0FaDnWjtINnnE8wdQnw&gausr=test%40gmail.com HTTP/1.1
Host: mail.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: SID=DQAAAHQAAAAcd2EJM2dHsH1SijNWriGgr323MxbK4iLQ5bOXGWyg3SeNizocUr4ssHfzvVOttQVAvSDdZ5ZI6l9XMmfTOzfnwTRZUmj_dt3cWq_Fys6pA84RshXeNpf2beblAJIjjneECfTOXtOBfQx59ZVvnnxNF8NpnNm2Z4mMrauqP7ARtA, LSID=cl|mail|s.FR|ss:DQAAAHcAAABee5jWg1c8cOZrBrwm68Ip1-1XjdrTIYdy3JndK0czudHaszvE-qj6Jo7lZgChzJ5T0NVUNz0LpAZk2EmOJP2oVhEuIMYhQHWnjIVUj4mlJx2SfvBJqrTuBcMu_feHK0-npWHS4gI1JY73RcI2oWUm5_diSAqLc0CQ0AVJyxnsRA
 
HTTP/1.x 302 Moved Temporarily
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Sun, 08 Feb 2009 12:44:06 GMT
Location: https://mail.google.com/mail/?auth=DQAAAHkAAACieyfh2cWiDzMSNnWFbEu5KYywpcQDtXzeu8-CVNFoIkG1zDupINcGMwIMHaKFFpqbCKwqaYIa7pUmz4Eb0pcWqbPVj4D3vTPE3o2kwhhRHVksxQX0LPLCqevPtg0amRzkElcMvTLynLMkfiJQWBfBMzv0FaDnWjtINnnE8wdQnw&gausr=test%40gmail.com&zx=ju2cc1jb89he
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Transfer-Encoding: chunked
Content-Encoding: gzip
Server: GFE/1.3
----------------------------------------------------------
https://mail.google.com/mail/?auth=DQAAAHkAAACieyfh2cWiDzMSNnWFbEu5KYywpcQDtXzeu8-CVNFoIkG1zDupINcGMwIMHaKFFpqbCKwqaYIa7pUmz4Eb0pcWqbPVj4D3vTPE3o2kwhhRHVksxQX0LPLCqevPtg0amRzkElcMvTLynLMkfiJQWBfBMzv0FaDnWjtINnnE8wdQnw&gausr=test%40gmail.com&zx=ju2cc1jb89he
 
GET /mail/?auth=DQAAAHkAAACieyfh2cWiDzMSNnWFbEu5KYywpcQDtXzeu8-CVNFoIkG1zDupINcGMwIMHaKFFpqbCKwqaYIa7pUmz4Eb0pcWqbPVj4D3vTPE3o2kwhhRHVksxQX0LPLCqevPtg0amRzkElcMvTLynLMkfiJQWBfBMzv0FaDnWjtINnnE8wdQnw&gausr=test%40gmail.com&zx=ju2cc1jb89he HTTP/1.1
Host: mail.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: SID=DQAAAHQAAAAcd2EJM2dHsH1SijNWriGgr323MxbK4iLQ5bOXGWyg3SeNizocUr4ssHfzvVOttQVAvSDdZ5ZI6l9XMmfTOzfnwTRZUmj_dt3cWq_Fys6pA84RshXeNpf2beblAJIjjneECfTOXtOBfQx59ZVvnnxNF8NpnNm2Z4mMrauqP7ARtA, LSID=cl|mail|s.FR|ss:DQAAAHcAAABee5jWg1c8cOZrBrwm68Ip1-1XjdrTIYdy3JndK0czudHaszvE-qj6Jo7lZgChzJ5T0NVUNz0LpAZk2EmOJP2oVhEuIMYhQHWnjIVUj4mlJx2SfvBJqrTuBcMu_feHK0-npWHS4gI1JY73RcI2oWUm5_diSAqLc0CQ0AVJyxnsRA
 
HTTP/1.x 302 Moved Temporarily
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Sun, 08 Feb 2009 12:44:06 GMT
Content-Type: text/html; charset=UTF-8
Location: https://mail.google.com/mail/?zx=ju2cc1jb89he&shva=1
X-Content-Type-Options: nosniff
Content-Length: 0
Server: GFE/1.3
----------------------------------------------------------
https://mail.google.com/mail/?zx=ju2cc1jb89he&shva=1
 
GET /mail/?zx=ju2cc1jb89he&shva=1 HTTP/1.1
Host: mail.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: SID=DQAAAHQAAAAcd2EJM2dHsH1SijNWriGgr323MxbK4iLQ5bOXGWyg3SeNizocUr4ssHfzvVOttQVAvSDdZ5ZI6l9XMmfTOzfnwTRZUmj_dt3cWq_Fys6pA84RshXeNpf2beblAJIjjneECfTOXtOBfQx59ZVvnnxNF8NpnNm2Z4mMrauqP7ARtA, LSID=cl|mail|s.FR|ss:DQAAAHcAAABee5jWg1c8cOZrBrwm68Ip1-1XjdrTIYdy3JndK0czudHaszvE-qj6Jo7lZgChzJ5T0NVUNz0LpAZk2EmOJP2oVhEuIMYhQHWnjIVUj4mlJx2SfvBJqrTuBcMu_feHK0-npWHS4gI1JY73RcI2oWUm5_diSAqLc0CQ0AVJyxnsRA, GXSP=S, GX=DQAAAHYAAABee5jWg1c8cOZrBrwm68Ip1-1XjdrTIYdy3JndK0czudHaszvE-qj6Jo7lZgChzJ4w41yOStI_raNuHAjxUOwPG6bflAxiMswUOOVweB6qP9yg2jMsmz2Jl7uaavif7bXq9P4cfz1BN_Gk3NWo1BGFHy70w-q4vORSr9Nad8-UTQ
 
HTTP/1.x 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Sun, 08 Feb 2009 12:44:07 GMT
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
Server: GFE/1.3
----------------------------------------------------------
https://mail.google.com/mail/?ui=1&search=inbox&view=tl&start=0&init=1
 
GET /mail/?ui=1&search=inbox&view=tl&start=0&init=1 HTTP/1.1
Host: mail.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: SID=DQAAAHQAAAAcd2EJM2dHsH1SijNWriGgr323MxbK4iLQ5bOXGWyg3SeNizocUr4ssHfzvVOttQVAvSDdZ5ZI6l9XMmfTOzfnwTRZUmj_dt3cWq_Fys6pA84RshXeNpf2beblAJIjjneECfTOXtOBfQx59ZVvnnxNF8NpnNm2Z4mMrauqP7ARtA, LSID=cl|mail|s.FR|ss:DQAAAHcAAABee5jWg1c8cOZrBrwm68Ip1-1XjdrTIYdy3JndK0czudHaszvE-qj6Jo7lZgChzJ5T0NVUNz0LpAZk2EmOJP2oVhEuIMYhQHWnjIVUj4mlJx2SfvBJqrTuBcMu_feHK0-npWHS4gI1JY73RcI2oWUm5_diSAqLc0CQ0AVJyxnsRA, GXSP=S, GX=DQAAAHYAAABee5jWg1c8cOZrBrwm68Ip1-1XjdrTIYdy3JndK0czudHaszvE-qj6Jo7lZgChzJ4w41yOStI_raNuHAjxUOwPG6bflAxiMswUOOVweB6qP9yg2jMsmz2Jl7uaavif7bXq9P4cfz1BN_Gk3NWo1BGFHy70w-q4vORSr9Nad8-UTQ
 
HTTP/1.x 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Sun, 08 Feb 2009 12:44:07 GMT
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
X-Content-Type-Options: nosniff
Content-Length: 8680
Server: GFE/1.3
----------------------------------------------------------
Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
                #region Premiere requete: authentification
                Uri uri = new Uri("https://www.google.com/accounts/ServiceLoginAuth");
                Debug.WriteLine("Depart: " + uri.OriginalString);
 
                // Crée la requete initiale à gmail.com avec les infos d'authentification
                HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create(uri);
                request1.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9) Gecko/2008052906 Firefox/3.0"; //"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; " + USERAGENT + " " + _instId.ToString() + ")";
 
 
                request1.KeepAlive = true;
                request1.MaximumAutomaticRedirections = 10;
                request1.AllowAutoRedirect = true;
 
 
                request1.Accept = "text/html,application/xhtml+xml";
                request1.ContentType = "application/x-www-form-urlencoded";
                request1.Method = "POST";
 
                // Crée l'espace de stockage des cookies pour cette requete
                request1.CookieContainer = new CookieContainer();
 
                // envoyer les infos d'authentification via requete POST:
                String authentificationPost = "ltmpl=default&ltmplcache=2&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D0&service=mail&rm=false&ltmpl=default&Email=test@gmail.com&Passwd=motDePasse&rmShown=1&signIn=Sign+in";
                Debug.WriteLine("POST: " + authentificationPost);
                Stream PostData = request1.GetRequestStream();
                byte[] auth_bytes = ASCIIEncoding.Default.GetBytes(authentificationPost);
                PostData.Write(auth_bytes, 0, auth_bytes.Length);
                PostData.Close();
 
                // récupérer le résultat
                HttpWebResponse response1 = (HttpWebResponse)request1.GetResponse();
 
// TraceReponse() affiche les traces de debug et renvoie le corps de page html récupérée dans GetResponseStream().
                string html = TraceResponse(response1);
 
                //
 
                #endregion
 
                #region 2è requete: redirection GET
 
                Regex regexRedirection = new Regex(@"meta http-equiv=""refresh"".+?url='(?<URL>.+?)'""", RegexOptions.Singleline);
                //Regex regexRedirection = new Regex(@"location.replace\(""(?<URL>.+?)""", RegexOptions.Singleline);
                Match resultat = regexRedirection.Match(html);
                if (resultat.Success) 
                {
                    uri = new Uri(resultat.Groups["URL"].Value);
                    Debug.WriteLine("Continue sur: " + uri.OriginalString);
 
 
                    HttpWebRequest request2 = (HttpWebRequest)WebRequest.Create(uri);
                    request2.UserAgent = request1.UserAgent;
                    request2.KeepAlive = true;
                    request2.MaximumAutomaticRedirections = 10;
                    request2.AllowAutoRedirect = true;
 
 
                    request2.Accept = request1.Accept;
                    request2.Method = "GET";
                    request2.CookieContainer = request1.CookieContainer;
 
                    // récupérer le résultat
                    HttpWebResponse response2 = (HttpWebResponse)request2.GetResponse();
                    html = TraceResponse(response2);
 
 
                }
 
                #endregion
Dans ma fenetre Debug, j'obtiens cela:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Depart: https://www.google.com/accounts/ServiceLoginAuth
POST: ltmpl=default&ltmplcache=2&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D0&service=mail&rm=false&ltmpl=default&Email=test@gmail.com&Passwd=motDePasse&rmShown=1&signIn=Sign+in
 
 
GET: OK (OK)
Response URI: https://www.google.com/accounts/CheckCookie?continue=https://mail.google.com/mail/?nsr=0&service=mail&ltmpl=default&chtml=LoginDoneHtml
Cookie LSID = EXPIRED
Cookie LSID = EXPIRED
Cookie LSID = cl|mail|s.FR:DQAAAHcAAABcg1cMR0vK5DJVJcimYRWVwXtij8C1Wf4tkIiZVl9KQty_CAYdI_PMnb2D-Wb2xiz1D6ugnAwbSBbKewDCmij7KuUDaLZhDJ5iA_rWZNe7P05AManMONepHm9AM-CEs8yh7gMEHKG8FJMJ1SGOVhAF5n7ppVVII10sqwV-8xRIjA
Cookie GAUSR = mail:test@gmail.com
Pragma:no-cache
Cache-Control:no-cache, no-store
Content-Type:text/html; charset=UTF-8
Expires:Mon, 01-Jan-1990 00:00:00 GMT
Set-Cookie:LSID=EXPIRED;Domain=.google.com;Path=/;Expires=Mon, 01-Jan-1990 00:00:00 GMT,LSID=EXPIRED;Path=/;Expires=Mon, 01-Jan-1990 00:00:00 GMT,LSID=EXPIRED;Domain=www.google.com;Path=/accounts;Expires=Mon, 01-Jan-1990 00:00:00 GMT,LSID=cl|mail|s.FR:DQAAAHcAAABcg1cMR0vK5DJVJcimYRWVwXtij8C1Wf4tkIiZVl9KQty_CAYdI_PMnb2D-Wb2xiz1D6ugnAwbSBbKewDCmij7KuUDaLZhDJ5iA_rWZNe7P05AManMONepHm9AM-CEs8yh7gMEHKG8FJMJ1SGOVhAF5n7ppVVII10sqwV-8xRIjA;Path=/accounts;Secure,GAUSR=mail:test@gmail.com;Path=/accounts;Secure
Date:Sun, 08 Feb 2009 14:28:24 GMT
X-Content-Type-Options:nosniff
Content-Length:1540
Server:GFE/1.3
Page: 
<html><head><title>Redirecting</title>
 
<meta http-equiv="refresh" content="0; url='http://www.google.fr/accounts/SetSID?ssdc=1&amp;sidt=7dNLVh8BAAA%3D.dohaBSqEFKhNpJQC6TNOa%2FfjghY7suanU%2BqNZR1JtkaXPsBMWxnQaeiH0NJ1uTXwLfvY2n1AC6zoaAai4LJmLMu%2B1sN5PcEl70O%2Fzs0Osf1B813%2FYmX1qrvQDnLmcN1XyDSISxUFtnifIS3GNUmbV%2FrSZEDVGfWxQ7skc3LHEKNJ%2FLkRHZcU27Reb2EPkXC6crgSCKSS5OVKzvGCSo2aZvUmix%2Ftbv3HBLxvbtAw%2FTNtnQdpfrc1b7gGpV24N2msVIqkKnAcqZ57265CqVlb4w%3D%3D.Dfut%2BuzYCgydVKe5Yt4sQw%3D%3D&amp;continue=https%3A%2F%2Fwww.google.com%2Faccounts%2FServiceLogin%3Fpassive%3Dtrue%26go%3Dtrue%26continue%3Dhttps%253A%252F%252Fmail.google.com%252Fmail%252F%253Fnsr%253D0%26service%3Dmail%26ltmpl%3Ddefault%26fss%3D1'"></head>
<body bgcolor="#ffffff" text="#000000" link="#0000cc" vlink="#551a8b" alink="#ff0000"><script type="text/javascript" language="javascript">
    location.replace("http://www.google.fr/accounts/SetSID?ssdc\x3d1\x26sidt\x3d7dNLVh8BAAA%3D.dohaBSqEFKhNpJQC6TNOa%2FfjghY7suanU%2BqNZR1JtkaXPsBMWxnQaeiH0NJ1uTXwLfvY2n1AC6zoaAai4LJmLMu%2B1sN5PcEl70O%2Fzs0Osf1B813%2FYmX1qrvQDnLmcN1XyDSISxUFtnifIS3GNUmbV%2FrSZEDVGfWxQ7skc3LHEKNJ%2FLkRHZcU27Reb2EPkXC6crgSCKSS5OVKzvGCSo2aZvUmix%2Ftbv3HBLxvbtAw%2FTNtnQdpfrc1b7gGpV24N2msVIqkKnAcqZ57265CqVlb4w%3D%3D.Dfut%2BuzYCgydVKe5Yt4sQw%3D%3D\x26continue\x3dhttps%3A%2F%2Fwww.google.com%2Faccounts%2FServiceLogin%3Fpassive%3Dtrue%26go%3Dtrue%26continue%3Dhttps%253A%252F%252Fmail.google.com%252Fmail%252F%253Fnsr%253D0%26service%3Dmail%26ltmpl%3Ddefault%26fss%3D1")
  </script></body></html>
Continue sur: http://www.google.fr/accounts/SetSID?ssdc=1&amp;sidt=7dNLVh8BAAA%3D.dohaBSqEFKhNpJQC6TNOa%2FfjghY7suanU%2BqNZR1JtkaXPsBMWxnQaeiH0NJ1uTXwLfvY2n1AC6zoaAai4LJmLMu%2B1sN5PcEl70O%2Fzs0Osf1B813%2FYmX1qrvQDnLmcN1XyDSISxUFtnifIS3GNUmbV%2FrSZEDVGfWxQ7skc3LHEKNJ%2FLkRHZcU27Reb2EPkXC6crgSCKSS5OVKzvGCSo2aZvUmix%2Ftbv3HBLxvbtAw%2FTNtnQdpfrc1b7gGpV24N2msVIqkKnAcqZ57265CqVlb4w%3D%3D.Dfut%2BuzYCgydVKe5Yt4sQw%3D%3D&amp;continue=https%3A%2F%2Fwww.google.com%2Faccounts%2FServiceLogin%3Fpassive%3Dtrue%26go%3Dtrue%26continue%3Dhttps%253A%252F%252Fmail.google.com%252Fmail%252F%253Fnsr%253D0%26service%3Dmail%26ltmpl%3Ddefault%26fss%3D1
 
GET: OK (OK)
Response URI: http://www.google.fr/accounts/SetSID?ssdc=1&amp;sidt=7dNLVh8BAAA=.dohaBSqEFKhNpJQC6TNOa/fjghY7suanU+qNZR1JtkaXPsBMWxnQaeiH0NJ1uTXwLfvY2n1AC6zoaAai4LJmLMu+1sN5PcEl70O/zs0Osf1B813/YmX1qrvQDnLmcN1XyDSISxUFtnifIS3GNUmbV/rSZEDVGfWxQ7skc3LHEKNJ/LkRHZcU27Reb2EPkXC6crgSCKSS5OVKzvGCSo2aZvUmix/tbv3HBLxvbtAw/TNtnQdpfrc1b7gGpV24N2msVIqkKnAcqZ57265CqVlb4w==.Dfut+uzYCgydVKe5Yt4sQw==&amp;continue=https://www.google.com/accounts/ServiceLogin?passive=true&go=true&continue=https%253A%252F%252Fmail.google.com%252Fmail%252F%253Fnsr%253D0&service=mail&ltmpl=default&fss=1
Cookie GoogleAccountsLocale_session = fr
X-Content-Type-Options:nosniff
Content-Length:2460
Cache-Control:private, max-age=0
Content-Type:text/html; charset=UTF-8
Date:Sun, 08 Feb 2009 14:28:24 GMT
Expires:Sun, 08 Feb 2009 14:28:24 GMT
Set-Cookie:GoogleAccountsLocale_session=fr
Server:GFE/1.3
Page: 
<html><head><title>Comptes Google</title>
<style type="text/css">
      .body { margin-left: 3em;
              margin-right: 5em;
              font-family: arial,sans-serif; }
 
      div.errorbox-good {}
 
      div.errorbox-bad {} 
 
      div.errormsg { color: red; font-size: smaller; font-family: arial,sans-serif;}
      font.errormsg { color: red; font-size: smaller; font-family: arial,sans-serif;} 
    </style>
</head>
<body dir="ltr" bgcolor="#ffffff" text="#000000" link="#0000cc" vlink="#551a8b" alink="#ff0000"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="right" nowrap><font face="Arial, sans-serif" size="-1">
<a href="http://www.google.com">Accueil Google</a>
|
 
<a href="https://www.google.com/accounts/Login">Connexion</a></font></td></tr>
<tr><td><img width="1" height="1" alt=""></td></tr></table>
<table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td colspan="2"><img width="1" height="2" alt=""></td></tr>
<tr><td id="logo_cell" valign="top" width="1%"><a href="https://www.google.com/accounts/"><img src="googleaccountslogo.gif" border="0" align="left" alt="Google"></a></td>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><img width="1" height="15" alt=""></td></tr>
<tr bgcolor="#3366cc"><td><img height="1" width="1" alt=""></td></tr>
<tr bgcolor="#e5ecf9"><td id="title_cell" style="padding-left: 4px; padding-bottom:3px; padding-top:2px; font-family:arial,sans-serif;"><b>Comptes Google</b></td></tr>
<tr><td colspan="2"><img width="1" height="5" alt=""></td></tr>
</table></td></tr></table>
<div class="body"><p>La page demand&eacute;e est incorrecte.
</p></div>
<style type="text/css">
.footer { padding-right: 5px;
          padding-left: 5px;
          padding-bottom: 5px;
          padding-top: 5px;
          font-size: 83%;
          border-top: #ffffff 1px solid;
          border-bottom: #ffffff 1px solid;
          background: #e5ecf9;
          text-align: center;
          font-family: arial,sans-serif;
}
</style>
<br><br>
<div class="footer" align="center"><font color="#666666">&copy;2009 Google</font>
-
<a href="http://www.google.com">Accueil Google</a>
-
<a href="https://www.google.com/accounts/TOS?hl=fr">Conditions d'utilisation</a>
-
<a href="http://www.google.com/intl/fr/privacy.html">Règles de confidentialité</a>
-
<a href="http://www.google.com/support/accounts?hl=fr">Aide</a></div></body></html>

Pourquoi je n'arrive pas à suivre le même chemin que Gmail Manager ?

Merci d'avance pour tout aide...