Hi all!
I have the following scenario to implement:
I have an ASP.NET Web site. On a click of a button in my site the user is redirected to a 3rd party site. When the user does some actions in this 3rd party site, the site starts sending http post requests to my site with a special message every 1 minute.
Now, the problem is that I should handle and process these requests, but I do not know how to do it. Please note that the requests that are sent from the 3rd party site DO NOT open my site by the http post requests. These requests are some kind of background requests, i.e. they do not open a page directly, so they should be handled using another approach.
I have the solution in Java. It is called Servlet. By the help of the servlet I can do the thing that I want in Java. However, I need the same functionality in ASP.NET? Does anybody have a solution for this?
Thanks a lot!
P.S. Just for your reference, here is the Java code for the servlet:
package payment;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import beans.action.PaymentBean;
public class EPayRequestCatcher extends javax.servlet.http.HttpServlet
implements javax.servlet.Servlet {
static final long serialVersionUID = 1L;
public EPayRequestCatcher() {
super();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String encoded = request.getParameter("encoded");
PaymentUtil util = new PaymentUtil();
if (encoded != null) {
String decoded = util.getDecodedB64Data(encoded);
int invStart = decoded.indexOf("=") + 1;
int invEnd = decoded.indexOf(":", invStart);
String invoice = decoded.substring(invStart, invEnd);
System.out.println(""+invoice);
String checksum = request.getParameter("checksum");
PaymentBean bean = new PaymentBean();
String responseStatus = bean.getEpayRequest(encoded, checksum);
if (!responseStatus.equals("")) {
String responseData = "INVOICE=" + invoice + ":STATUS=" + responseStatus + "\n";
System.out.println(responseData);
response.getWriter().append(responseData);
}
} else {
return;
}
}
}
enter code here enter code here