I'm developing a java application for a GPRS modem (Siemens TC65). I call several times a method to do a HttpConnection to different URLs. Sometimes it works fine but sometimes I get redirected by my operator (HTTP code 302). I follow the URL provided in the Location header it returns 200 but it's not the page that I want.
If I use the SIM card in a gsm pen and access with a browser, sometimes the same redirect occurs but i eventually reach the desired page. The problem is the modem doesn't execute Javascript, so I analysed what the javascript does and the procedure is the following:
page1 -> page2 -> page3 -> desired page
Page1 and page2 do some base64 coding of the URL and parameters, page3 is a .aspx. So everytime I get a redirection I encode64 my URL and send to the .aspx page, the .aspx page returns 302 with the desired page decoded in the Location header. It even returns a cookie with ASP.NET_SessionId which I save and send in the next request.
But even if i do all of this and follow the URL returned by the .aspx (which is the same as I begin with) it just starts from the beginning and I get an endless loop of redirects.
I can post the code but I don't think it has any problem since it works fine, sometimes... The problem is the successive redirects by the operator and not running a browser.
Anything i should do differently when trying to follow a redirection from an aspx server?
Anyone had any similar problem? I would greatly appreciate any help.
Thanks in advance! Hugo