A
A
Alyosha2018-05-30 10:45:20
Computer networks
Alyosha, 2018-05-30 10:45:20

Why is sending a GET request not working?

Why when I type in https://helpdesk.domain/api/Task/number in the browser , the result is displayed as it should, but when in my program

WebRequest req = WebRequest.Create("https://helpdesk.домен/api/Task/номер");
            //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            req.Credentials = new NetworkCredential("Логин", "пароль");
            WebResponse resp = req.GetResponse();
            Stream stream = resp.GetResponseStream();
            StreamReader sr = new StreamReader(stream);
            string Out = sr.ReadToEnd();
            sr.Close();
            Console.WriteLine(Out);
            Console.ReadLine();

then he writes to me
Удаленный сервер возвратил ошибку: (400) Недопустимый запрос."

How is it invalid if I send essentially the same GET request?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Eremin, 2018-05-30
@EreminD

open chrome
press F12
go to network section
now submit your request in chrome
see what the headers were in the request
maybe something needs to be added

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question