RNG隐藏字段参数
本文关键字:参数 字段 隐藏 RNG | 更新日期: 2023-09-27 18:01:42
我有一个注册表格,我正在接受用户输入并将信息传递给支付网站。支付网站有几个隐藏字段,这样它就可以区分每个用户是唯一的,而不是依赖于用户提供的唯一名称。这就是"unique_id"字段我想要一个随机数作为参数。我该如何做到这一点,以便每次用户点击该代码所附加的按钮时,它都会执行RNG并将该数字传递给外部支付网站?
…
protected void submitButton_Click(object sender, EventArgs e)
{
Random randnum = new Random();
int num = randnum.Next();
{
NameValueCollection PostFields = new NameValueCollection();
PostFields.Add("LMID", "345573");
PostFields.Add("unique_id", RANDOM NUMBER HEEDS TO GO HERE);
PostFields.Add("sTotal", "150.00");
PostFields.Add("webTitle", "Conference");
PostFields.Add("Trans_Desc", "Conference Registration");
PostFields.Add("contact_info", "Contact admin");
PostFields.Add("BILL_CUSTOMER_FIRSTNAME", labelFirstName.Text);
PostFields.Add("BILL_CUSTOMER_LASTNAME", labelLastName.Text);
PostFields.Add("BILL_ADDRESS1", labelAddress.Text);
PostFields.Add("BILL_CITY", labelCity.Text);
PostFields.Add("BILL_STATE", labelState.Text);
PostFields.Add("BILL_ZIP", labelZip.Text);
PostFields.Add("BILL_CUSTOMER_PHONE", labelTelephone.Text);
PostFields.Add("BILL_CUSTOMER_EMAIL", labelEmail.Text);
RedirectAndPOST(this.Page, "payment website url", PostFields);
}
…
这对我来说很好:
Random random = new Random(); int num = random.Next();
NameValueCollection PostFields = new NameValueCollection();
PostFields.Add("LMID", "093204");
PostFields.Add("unique_id", num.ToString());