Here website will list some data based on dropdown-filter, so i am trying to fetch those data by passing static dropdown values, but i think due to view state i am unable to grab those data.
Anyone have any idea how to grab asp.net website data which is using viewstate?
i am getting below error
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Python Script
import requests
from bs4 import BeautifulSoup
def get_viewstate():
url = "http://xlnindia.gov.in/frm_G_Cold_S_Query.aspx?ST=GJ"
req = requests.get(url)
data = req.text
bs = BeautifulSoup(data)
return bs.find("input", {"id": "__VIEWSTATE"}).attrs['value']
url = "http://xlnindia.gov.in/frm_G_Cold_S_Query.aspx?ST=GJ"
data = {"__VIEWSTATE": get_viewstate(),"ST":'GJ', "ddldistrict":'AMR', "ddltaluka":'' ,"btnSearch":'Search'}
req = requests.post(url, data)
bs = BeautifulSoup(req.text)
print(bs.prettify())