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
|
public static CookieCollection callingGetAppli() {
HttpWebRequest request;
try {
request = (HttpWebRequest)HttpWebRequest.Create(<LURLDeMaDeuxiemePage>);
} catch (UriFormatException) {
request = null;
}
if (request == null)
throw new ApplicationException("Invalid URL: " + <LURLDeMaDeuxiemePage>);
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(new Cookie("JSESSIONID", JSessionID, "/", <domaineSouhaite>));
request.CookieContainer.Add(new Cookie("SMSESSION", MSSession, "/", <domaineSouhaite>));
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
// Le contenu me donne bien le contenu attendu dont l'authentification a persisté
string content = reader.ReadToEnd();
return response.Cookies;
} |
Partager