Consume an https service on asp.net c #

0

I would like you to help me I am trying to consume a service to my application asp.net c # a that the service I want to consume is .ashx

but when I add the service reference I get an error like the image I attached.

I would like you to help me or because it does not allow me to consume the service I want to consume is this:

link

protected void Page_Load(object sender, EventArgs e)
        {  
            string URLString = "https://robinacademia.com/p.ashx?o=63&e=2&f=pb&r=REQUEST_SESSION_ID&t=TRANSACTION_ID";

            XmlTextReader reader = new XmlTextReader(URLString);
            string resultado = "";
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // El nodo es un elemento.
                        resultado += "<" + reader.Name;

                        while (reader.MoveToNextAttribute()) // Lee los atributos.
                            Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                        resultado += ">";
                        resultado += "\n";
                        break;
                    case XmlNodeType.Text: //Muestra el texto en cada elemento.
                        resultado += reader.Value;
                        if (resultado == "<result>\n<code>\n1")
                        {
                            txtnumero1.Text = reader.Value;
                        }
                        else
                        {
                            txtnumero2.Text = reader.Value;
                        }
                        break;
                    case XmlNodeType.EndElement: //Muestra el final del elemento.
                        resultado += "</" + reader.Name;
                        resultado += ">";
                        break;
                }
            }
        }
    
asked by PieroDev 27.04.2018 в 17:16
source

1 answer

1

I have attached the code that I have tried and it works:

    string URLString = "https://robinacademia.com/p.ashx?o=63&e=2&f=pb&r=REQUEST_SESSION_ID&t=TRANSACTION_ID";
    //String URLString = "http://localhost/books.xml";
    XmlTextReader reader = new XmlTextReader(URLString);
    string resultado = "";
    while (reader.Read())
    {
        switch (reader.NodeType)
        {
            case XmlNodeType.Element: // El nodo es un elemento.
                resultado += "<" + reader.Name;

                while (reader.MoveToNextAttribute()) // Lee los atributos.
                    Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                resultado+= ">";
                resultado += "\n";
                break;
            case XmlNodeType.Text: //Muestra el texto en cada elemento.
                resultado += reader.Value;
                break;
            case XmlNodeType.EndElement: //Muestra el final del elemento.
                resultado += "</" + reader.Name;
                resultado += ">";
                break;
        }
    }
    
answered by 27.04.2018 / 18:12
source