khoeds | POST /QuickPlace... Accept: image/gif... Referer: http://... Accept-Language: fr Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible;...) Host: webtc... Content-Length: 1209 Connection: Keep-Alive Cache-Control: no-cache Authorization: Basic "..." Je voudrai recréer cet en-tête et ce qui me pose problème c'est : "Autorization"
J'utilise HttpWebRequest, mais malgré avoir rempli un objet pour l authorisation elle reste vide dans ethereal ce qui me laisse penser que l authorisation ne marche pas.
quelqu un sait il comment cela fonctionne
Code :
- ASCIIEncoding encoding=new ASCIIEncoding();
- //string postData="%%ModDate="+ModDate;
- string postData = "test";
- //postData += ("&username="+strName);
- byte[] data = encoding.GetBytes(postData);
- // Prepare web request...
- HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://webtc.paris.ensam.fr/QuickPlace/am-pfewiki/Main.nsf/2a1fb3846ca143220525670800167222/406ac6104bd821d30525670800167200/?EditDocument" );
- //myRequest.PreAuthenticate=true;
- myRequest.Method = "POST";
- myRequest.Accept="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*";
- myRequest.Referer= "http://webtc.paris.ensam.fr/QuickPlace/am-pfewiki/Main.nsf/2a1fb3846ca143220525670800167222/406ac6104bd821d30525670800167200/?EditDocument";
- myRequest.ContentType="application/x-www-form-urlencoded";
- //myRequest.TransferEncoding = "gzip, deflate";
- myRequest.ContentLength = data.Length;
- myRequest.KeepAlive = true;
- //myRequest.UserAgent="Basic b2R1Zm91cjazeWZlZHVmZQ==";
- //myRequest.Acceptlanguage
- NetworkCredential myCred = new NetworkCredential("nomuser","monpass","" );//SecurelyStoredDomain = param 3
- CredentialCache myCache = new CredentialCache();
- myCache.Add(new Uri("http://www.paris.ensam.fr/QuickPlace/am-pfewiki" ), "Basic", myCred);
- myRequest.Credentials = myCache;
- //WebResponse myWebResponse = myRequest.GetResponse();
- Stream newStream=myRequest.GetRequestStream();
- // Send the data.
- newStream.Write(data,0,data.Length);
- newStream.Close();
|
Message édité par khoeds le 10-02-2005 à 11:19:38
|