0

I want to post data to a website by using cs query lib. My purpose is parsing viewstate value and post with my string. I can parse viewstate value correctly but when I post data it returns null value.

public string Post(string URL, NameValueCollection data)
    {

        string Result = "";
        int limit = 0;

        do
        {

            try
            {
              Result = Encoding.UTF8.GetString(this.UploadValues(URL, data));

                break;
            }

This is how I post data to a website. If I send wrong viewstate value it returns me your session timeout. However if I send everything correctly it returns me nothing. Can you tell me what is wrong with my code?

Alex
  • 781
  • 10
  • 23
user3297904
  • 59
  • 2
  • 8
  • Do you actually mean viewstate? You shouldn't be trying to emulate viewstate, and it would be virtually impossible to say that you are doing it "correctly". As for the rest: if the site isn't responding with the expected values, then simply: you aren't *sending* the correct values. Frankly, you would be much better off using a published API endpoint rather than trying to spoof a web-browser (and on a lot of sites, you would currently be violating the TOS) – Marc Gravell May 14 '14 at 06:37
  • you mean website close my session because im violating the TOS – user3297904 May 14 '14 at 06:57
  • No, the TOS thing is an aside, as in "you probably shouldn't be doing that anyway". The point is: that almost certainly isn't a supported or intended usage of whatever website you are targeting, so if it doesn't work: meh – Marc Gravell May 14 '14 at 08:12
  • acctualy, it was working but i changed my pc and reinstall the visiual stdio and then it didnt work. i checked values hidden elements in html code and i saw that some values was changed.I rearrenge my code but it isnt working – user3297904 May 14 '14 at 10:39

0 Answers0