Link to home
Start Free TrialLog in
Avatar of Manoj Patil
Manoj PatilFlag for India

asked on

Send data using Post method from asp.net to EPOS Device

Hello Experts,
My aim is to send data to the EPOS device from asp.net page when requested. I am having following code

string URLAuth = "http://xyz.com/FarmerUpload.aspx";
  string postString = string.Format("inputEmailHandle={0}&name={1}&inputPassword={2}", FarmerCode, FarmerData);

  const string contentType = "application/x-www-form-urlencoded";
  System.Net.ServicePointManager.Expect100Continue = false;

  CookieContainer cookies = new CookieContainer();
  HttpWebRequest webRequest = WebRequest.Create(URLAuth) as HttpWebRequest;
  webRequest.Method = "POST";
  webRequest.ContentType = contentType;
  webRequest.CookieContainer = cookies;
  webRequest.ContentLength = postString.Length;
  webRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1";
 webRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
  webRequest.Referer = "http://xyz.com/FarmerUpload.aspx";

Open in new window


But I am unable to send data to the EPOS Device (This device is configured to receive the data in POST method only)
I am able to get the data sent from EPOS device using query string. Based on that I need to send the data.
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manoj Patil

ASKER

Thanks.