Link to home
Start Free TrialLog in
Avatar of Keith McElroy
Keith McElroy

asked on

ashx c# GET works, POST fails

I want to upgrade this file to POST instead of GET and have hit a problem.

The following code works if Method is "GET" and fails if "POST"


Error is:

Error Information: Unhandled Exception



<%@WebHandler Language="C#" Class="APIHandler"%>






using System;
using System.Web;
using System.Xml;

using System.Net;
using System.IO;
using System.Text;

using System.Collections;
using System.Collections.Specialized;


public class APIHandler:IHttpHandler
{
   public bool IsReusable{get{return true;}}


   public void ProcessRequest(HttpContext context){


      HttpRequest request=context.Request;
      HttpResponse response=context.Response;

     
      String URLreq = "http://172.18.129.120/connect/default.asp"   ;

      HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(URLreq);
      myRequest.Method = "POST";
      WebResponse myResponse = myRequest.GetResponse();



   
   }



}



ASKER CERTIFIED SOLUTION
Avatar of louisfr
louisfr

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