There are many ways to pass data to another page.
If both of your projects are C#, then you can use DataTable/ByteArray as one of the possible solution to do this.
At your main project, you can do something like this:
DataTable dt = new DataTable();
dt.Columns.Add("transaction_id");
dt.Columns.Add("user_id");
dt.Columns.Add("amount", typeof(decimal));
dt.Rows.Add("AA0001", "1234", 450.90m);
byte[] ba = ConvertToBytes(dt);
string data = Convert.ToBase64String(ba);
string dataEncoded = Server.UrlEncode(data);
Response.Redirect("http://www.centralprojet.com/PaymentRequest.aspx?q=" + dataEncoded);
And then, at your central project, at the Page_Load() method, you can do something like this:
string dataEncoded = Request.QueryString["q"];
string data = Server.UrlDecode(dataEncoded);
byte[] ba = Convert.FromBase64String(data);
DataTable dt = ConvertToObject<DataTable>(ba);
string transaction_id = dt.Rows[0]["transaction_id"] + "";
string user_id = dt.Rows[0]["user_id"] + "";
decimal amount = (decimal)dt.Rows[0]["amount"];
If you wish the process to be done in backend without redirecting to another page, then you do this silently without notifying the user/browser.
DataTable dt = new DataTable();
dt.Columns.Add("transaction_id");
dt.Columns.Add("user_id");
dt.Columns.Add("amount", typeof(decimal));
dt.Rows.Add("AA0001", "1234", 450.90m);
byte[] ba = ConvertToBytes(dt);
WebClient wc = new WebClient();
byte[] baResult = wc.UploadData("http://www.centralproject.com/PaymentRequest.aspx", ba);
string result = System.Text.Encoding.UTF8.GetString(baResult);
Then, at your CentralProject, you can silently process the data and return the result using backend too:
byte[] ba = Request.BinaryRead(Request.ContentLength);
DataTable dt = ConvertToObject<DataTable>(ba);
string transaction_id = dt.Rows[0]["transaction_id"] + "";
string user_id = dt.Rows[0]["user_id"] + "";
decimal amount = (decimal)dt.Rows[0]["amount"];
Response.Write("success");
Here is the code block for converting object to byte array:
public static byte[] ConvertToBytes(Object obj)
{
using (MemoryStream ms = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, obj);
return ms.ToArray();
}
}
public static T ConvertToObject<T>(byte[] bytes)
{
using (MemoryStream memStream = new MemoryStream(bytes))
{
BinaryFormatter bf = new BinaryFormatter();
var obj = (T)bf.Deserialize(memStream);
return obj;
}
}