Private string readcookie (httpconnection conn) throws oewick {string key; string value; string [] substrs;
For (int i = 0; (key = conn.getHeaderfieldKey (i))! = NULL; i) {key = key.tolowercase (); if (key.equals ("set-cookie") {value = Conn.getHeaderfield (i); while (value! = null) {subster (value, ';'); if (Substrs [0] .StartSwith ("jsessionid =") || // java subsstrs [0 ] .startswith ("phpsessid") || // php subsstrs [0] .startswith ("sessionid") // ASP) {Return Substrs [0];} value = subsstrs [1];}}} return null;}