OK, I have a client doing a POST to a server with some data. The server receives the post, and answers with a redirect. The problem is that the client does not redirects. Also, I've tried to check the StatusCode of the response the client gets, and it is always the same "OK". Instead of the redirect code. What am I missing?
In the client side I have something like this:
StringBuilder sb;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost/serv/Default.aspx");
request.Method = "POST";
byte[] data = Encoding.ASCII.GetBytes(GetDATA());
request.ContentType = "text/xml";
request.ContentLength = data.Length;
Stream stream = request.GetRequestStream();
stream.Write(data, 0, data.Length);
request.AllowAutoRedirect = true;
request.MaximumAutomaticRedirections = 10;
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
response.Close(); } catch(Exception ex) {}
In the server side I have just this line:
HttpContext.Current.Response.Redirect("http://www.google.com", true);
In this case, the client receives an answer and does not do nothing.
Thanks.