Question

I have a user registration aspx page(1st page) which saved user information(username, email address, full name etc) in database table with pending status and redirect user to another PaypalPayment.aspx page(2nd page) where i have paypal button to pay user registration fee. When user pay via paypal i get user email address and user full name of paypal account and redirect it to PaypalRegistrationSuccessful.aspx (3rd page) with email address and full name of user paypal account. as i have user email address and user full name from paypal account so i want to update database user registration table from pending to approved user status because user already paid via paypal. I have tried to pass values from 1st page to 3rd page to update database table and user status from pending to approved but my 3rd page not getting values from 1st page. Here is my code and query string etc

On my registration aspx page(1st page) :

protected void btnSaveRegistration_Click(object sender, EventArgs e)
        {
oApicultureManager.CourseRegistrationPaypal(oCourseRegistrationPaypal);

                Response.Redirect("PDT/PaypalPayment.aspx");
Response.Redirect("PDT/PaypalRegistrationSuccessful.aspx?UserName=" + this.txtUserName.Text + "&UserEmail=" + this.txtEmail.Text);
}

On my PaypalPayment.aspx page(2nd page) HTML :

<form action="<%= ConfigurationManager.AppSettings["PayPalSubmitUrl"] %>" method="post">
    <input type="hidden" name="cmd" value="_xclick" />
    <input type="hidden" name="business" value="<%= ConfigurationManager.AppSettings["PayPalUsername"] %>" />
    <input type="hidden" name="item_name" value="course test fee" />
    <input type="hidden" name="amount" value="172.46" />
    <input type="hidden" name="return" value="http://localhost:59651/PDT/PaypalRegistrationSuccessful.aspx" />
    <input type="hidden" name="custom" value="Registration started: <%= DateTime.Now.ToString() %>" />
    <input type="image" src="https://www.sandbox.paypal.com/fr_CA/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !" />
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
    </form>

on my PaypalRegistrationSuccessful.aspx (3rd page) :

if (!Page.IsPostBack)
            {
  username = Request.QueryString["UserName"];
                useremail = Request.QueryString["UserEmail"];

//other code etc

}

Can any one tell me why i am getting null values on 3rd page? or other good way to do this ?

Was it helpful?

Solution

http://msdn.microsoft.com/en-us/library/vstudio/ms178581(v=vs.100).aspx

You might try saving the information in a session variable, e.g.

Session["UserName"] = userName;
Session["Email"] = email;

and then that will save those throughout the life of the session. On the last page you can grab them using

var userName = Session["UserName"].ToString();
var email = Session["Email"].ToString();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top