1

I have code: var request =

(HttpWebRequest)WebRequest.Create("http://www.dba.dk/ajax/vip/telephonenumber/gettelephonenumber/?externalid=1033601271");

            string stringData = "externalid=1033601271";
            var data = Encoding.ASCII.GetBytes(stringData);

            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
            request.ContentLength = data.Length;
            var newStream = request.GetRequestStream();
            newStream.Write(data, 0, data.Length);
            newStream.Close();
            WebResponse response = request.GetResponse();
            MessageBox.Show(((HttpWebResponse)response).StatusDescription);
            response.Close();

With this I recieving 400 Bad Request from server. I think that I need to define Request Body: - I checked on firefox Network Analyzer it should be something like this: externalId=1033601271&__RequestVerificationToken=Xd5coguwXJArf6-5mQNl8eXOoBpUEltnpq2SvVfLSfo6Fe5MAw4VoaWT89NPEFJPONppjePDF5mWVO1CzMbGqqWA1KS2M8ZXmpJ0DNExcSCrxCIPPF_pBjP7lkRbt-rs9HrpHQ2

How I can define it in my code ? Also How I can read response from server to string variable ?

mdieod
  • 49
  • 2
  • 12

0 Answers0