I have three ASPX pages:
1. "WebForm1.aspx" is interactive, responsible for calling a web site
(https://www.payMe.com) with $$$. It is working fine.
2. "WebForm2.aspx" is non-interactive, a listener in my site to capture a
"STATUS_CD" returned by www.payMe.com. It is working fine.
3. "WebForm3.aspx" is interactive page, responsibe to display the STATUS
CODE "POSTED" by "WebForm2.aspx".
4. My goal is to use "WebForm2.aspx" to call "WebForm3.aspx" automatically
when it was POSTED by www.payMe.com without user involvement. But it did not
work and there was no error detected/displayed. To get around, in
"WebForm2.aspx", I had to write the status code to a local text file, then
in "WebForm1.aspx" (still present on the user's Browser while all these
behind-the-scence things are taking place), used a buttonClick event handler
to call "WebForm3.aspx" with the same code as shown below in
"WebForm2.aspx".
5. My code (c#) for "WebForm2.aspx" (listener page) is shown below:
************************************************** ****************
using several .netClasses;
namespace TestMe
{
public class WebForm2: System.Web.UI.Page //This page is a listener,
therefore, it is not interactive
{
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
if(Request.Form.Keys.Count==0)
{
//Show Error: Failed on POST status returned from
www.payME.com;
return;
}
string sKey=""; //Name="STATUS_CODE"
string sVal=""; //Value="OK" or "NOT OK"
string sQ=@""""; //constant used for string concat.
//Step# 1 - Extract one Status code sent by
https://www.payME.com.
//This step always works
sKey=Request.Form.Keys[0].ToString();
sVal=Request[sKey].ToString();
//Step# 2 - Using "POST" method to send status code to
Action="WebForm3.aspx".
//This did not work, nor error was detected/shown.
//To make it work, comment these lines below and write the
status code to the disk,
//then have "WebForm1.aspx" reads the data from the disk and
call "WebForm3.aspx" to display it.
//Please note: These lines below will always work in
"WebForm1.aspx".
Response.Clear();
Response.Write("<HTML><HEAD></HEAD>");
Response.Write("<BODY onLoad="Document.Form1.submit()"+sQ+">");
Response.Write("<FORM NAME="+sQ+"Form1"+sQ+"
METHOD="+sQ+"Post"+sQ+" ACTION="+sQ+"Webform3.aspx"+sQ+" >");
//Place KeyName,Value pair here.
Response.Write("<INPUT NAME="+q+sKey+q+" TYPE="+sQ+"HIDDEN"+sQ+"
VALUE="+q+sVal+q+">");
//Finish
Response.Write("</FORM>");
Response.Write("</BODY></HTML>");
Response.End();
}
}
}
}
************************************************** ****************
Questions:
1. How do I force "WebForm2.aspx" to call "WebForm3.aspx" without having to
write the data to disk and read it back from the disk ?
2. Why the code in "WebForm2.aspx" above works fine in "WebForm1.aspx"
buttonClick Event ? Is it because it is interactive while "WebForm2.aspx" is
not ?
Thanks for your help
John Webbs