Http Web Request Problem

Jun 7 2012 9:51 AM

This Code is Run Local System is Successfully but Upload in server this code not working please help me....

    public string PushToTallyCreateMaster(string strPost)
    {
        string Err = "";
        int Success = 0;
        string strAddress = "";
        string result = "";
        StreamWriter myWriter = null;
        bool DestIsRunning = true;
        strAddress = "http://111.111.1.111:9090/";
        HttpWebRequest objRequest =
        (HttpWebRequest)WebRequest.Create(strAddress);
        objRequest.Method = "POST";
        objRequest.ContentType = "xml";

        try
        {
            myWriter = new StreamWriter(objRequest.GetRequestStream());
            myWriter.Write(strPost);
            DestIsRunning = true;
        }
        catch (Exception ex)
        {

        }
        finally
        {
            if (myWriter != null)
            {
                myWriter.Close();
            }
        }
        try
        {
            HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
            StreamReader sr = null;
            sr = new StreamReader(objResponse.GetResponseStream());
            result = sr.ReadToEnd();
            sr.Close();
            XmlDocument Doc = new XmlDocument();
            Doc.LoadXml(result);
            string ans = result;
            XmlNode node = Doc.DocumentElement;
            node = Doc.SelectSingleNode("//ERRORS");
            node = Doc.SelectSingleNode("//ERRORMSG");
            if (node != null)
            {
                Err = node.Name.ToString();
            }
            //string n = node.InnerText.ToString();
            //if (n == "1")
            //{
            //    Success = 1;
            //}
            //node = Doc.SelectSingleNode("//ALTERED");
            //if (node.InnerText == "1")
            //{
            //    Success = 1;
            //}
            //node = Doc.SelectSingleNode("//COMBINED");
            //if (node.InnerText == "1")
            //{
            //    Success = 1;
            //}
            
        }
        catch (Exception ex)
        {

        }
        return Err;
    }

Answers (1)