Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

web services wcf

The remote server returned an error: (302) Redirect.

I have below source codes and return above error message. Not sure why. Anyone can help? Below is just sample of WCF. No error when complied.

     public void QuoteReceiver()
        {
            System.IO.MemoryStream memoryStream = null;
            XmlTextWriter xmlTextWriter = null;
            StreamReader streamReader = null;
            string xmlOutput = string.Empty;
            try
            {
                memoryStream = new MemoryStream();
                xmlTextWriter = new XmlTextWriter(memoryStream, System.Text.Encoding.UTF8);
                //xmlTextWriter.WriteStartDocument();
                xmlTextWriter.Formatting = Formatting.Indented;
                xmlTextWriter.WriteStartElement("Root");
                xmlTextWriter.WriteElementString("Id", "1001");
                xmlTextWriter.WriteElementString("Status", "Closed");
                xmlTextWriter.WriteElementString("SourceID", "S001");
                xmlTextWriter.WriteFullEndElement();
                xmlTextWriter.Flush();
                memoryStream.Position = 0;
                streamReader = new StreamReader(memoryStream);
                xmlOutput = streamReader.ReadToEnd();
                xmlTextWriter.Close();
                streamReader.Close();
                WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Redirect;
                WebOperationContext.Current.OutgoingResponse.Headers.Add("Location", "http://www.google.com?Id=" + xmlOutput);        
               
            }
            catch (Exception ex)
            {
               
            }
            //return xmlOutput;
        }
ASKER CERTIFIED SOLUTION
Avatar of Jeevan Bordoloi
Jeevan Bordoloi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITsolutionWizard

ASKER

The purpose of the wcf is just taking some information like first name and last name and put them into xml format. Then pass the values into particular domain like www.myResponseWebsite.com?id=data

So to answer your question, I can just pass the value on querystring.