Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello.

I am trying to upload custom values to specific URL and get the result that is given from the web site.

The problem that is occurring is that I don't know how to simulate "press" the input type="button".

Is the value wrong or something

Here is the link [^](English version)

I use the Bulgarian version but that doesn't matter.

C#
WebClient myWebClient = new WebClient();
            myWebClient.Credentials = CredentialCache.DefaultCredentials;
            myWebClient.Headers.Add(HttpRequestHeader.UserAgent, "anything");
            myWebClient.Proxy = null;
            Uri uri = new Uri(@"http://validni.mvr.bg/nbds2/Web2.nsf/fVerification");

            NameValueCollection fromData = new NameValueCollection();
            const string DocTypePassport = "6730";
            const string DocumentNumber = "363511664";

            fromData.Add("_doClick", "C2257C590037DB52.a1a096ff9bbd6b84c22572a3005638f0/$Body/0.145E");
            fromData.Add("%%Surrogate_TypeDoc", "1");
            fromData.Add("TypeDoc", DocTypePassport);
            fromData.Add("Number", DocumentNumber);

            byte[] responceArray = myWebClient.UploadValues(uri, "POST", fromData);

            Console.WriteLine(Encoding.ASCII.GetString(responceArray));



The problem is that I don't get result, that looks like this.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900