well. after login if i try to browse a page it says session is invalid
etc. (as a custom message in turkish)
i am capturing https traffic using fiddler. i didn 't see any session
or cookie in both request or response header or detail. there is only
a token string. and i am parsing and sending it also. and i am not
doing anything about session or cookie management.
i am sending username and password using post method. and response is
login ok. (also a custom message) i can open another page later. but
at third page it says invalid session. (also a custom message)
how can servlet realize i 'm not using internet explorer. cause if i
use internet explorer everything is fine.
and what do i need to do to simulate that i 'm a web browser etc .
(apart from theese)
HttpWebRequest request = null;
Uri uri = new Uri(url);
request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
if (this.Referer != "" && this.Referer != null)
{
request.Referer = this.Referer;
}
request.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/xaml+xml,
application/vnd.ms-xpsdocument, application/x-ms-xbap,
application/x-ms-application, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword,
application/x-silverlight, */*";
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30;
InfoPath.2)";
request.KeepAlive = true;
request.ContentType = "application/x-www-form-urlencoded";
request.Headers.Add("Cache-Control", "no-cache");
request.Headers.Add("Accept-Encoding: gzip, deflate");
request.Headers.Add("Accept-Language: en-us,tr-TR;q=0.5");
request.Headers.Add("UA-CPU: x86");
request.ProtocolVersion = HttpVersion.Version11;
request.ContentLength = postData.Length;
request.AllowAutoRedirect = true;
using (Stream writeStream = request.GetRequestStream())
{
Encoding encoding = Encoding.GetEncoding("ISO-8859-9");
byte[] bytes = encoding.GetBytes(postData);
writeStream.Write(bytes, 0, bytes.Length);
}
using (HttpWebResponse response =
(HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader readStream = new
StreamReader(responseStream, Encoding.GetEncoding("ISO-8859-9")))
{
result = readStream.ReadToEnd();
}
}
}