The page has a javascript PayPal form on it that, when submitted, takes the user to the payment page at paypal. This works just fine. The user is then returned to a different page on my website. The problem is that once the sale is confirmed I have to write
a row to SQL server docuemnting the purchase. The form passes back the product and amount paid, but to save it I need the user ID. THe user must login to make the purchase - anad I thought that I could set s Sessio variable to persist the variable. But when
the user gets pack from PAy PAl the session variable is NULL. MAybe because they left the site for the payment. There is also a custom variable in the Paypal form that could be assigned the user ID, but how do you set a Javascript variable using C#?
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="custom" value="1003">
The 1003 is the value that I need to set.
But when the user gets pack from PAy PAl the session variable is NULL
Check the return URL sent to PayPal is should be same as the website URL (sometimes browser create different ASP.NET_SessionId for url with www and without www means ASP.NET_SessionId for www.example.com and example.com will be different and that is because
you are not getting session values)
dieseldave
how do you set a Javascript variable using C#?
define riderid/useridas public variable on code behind and
dieseldave
Member
384 Points
432 Posts
SET Javascript variable from C#
Jan 10, 2013 12:58 AM|LINK
The page has a javascript PayPal form on it that, when submitted, takes the user to the payment page at paypal. This works just fine. The user is then returned to a different page on my website. The problem is that once the sale is confirmed I have to write a row to SQL server docuemnting the purchase. The form passes back the product and amount paid, but to save it I need the user ID. THe user must login to make the purchase - anad I thought that I could set s Sessio variable to persist the variable. But when the user gets pack from PAy PAl the session variable is NULL. MAybe because they left the site for the payment. There is also a custom variable in the Paypal form that could be assigned the user ID, but how do you set a Javascript variable using C#?
userid = Membership.GetUser(uname).ProviderUserKey.ToString(); riderid = mm.getriderid(userid);raju dasa
Star
14392 Points
2447 Posts
Re: SET Javascript variable from C#
Jan 10, 2013 05:04 AM|LINK
Hi,
Try this suggestion:
http://weblogs.asp.net/bleroy/archive/2004/08/03/Don_2700_t-redirect-after-setting-a-Session-variable-_2800_or-do-it-right_2900_.aspx
rajudasa.blogspot.com || blog@opera
urenjoy
Star
12171 Points
1824 Posts
Re: SET Javascript variable from C#
Jan 10, 2013 05:35 AM|LINK
http://stackoverflow.com/questions/14092465/sand-box-redirection-destroys-sessions
http://stackoverflow.com/questions/1491296/assign-a-javascript-variable-from-c-sharp
http://stackoverflow.com/questions/4398338/create-javascript-variable-in-code-behind-of-asp-net
alankarp
Contributor
2042 Points
345 Posts
Re: SET Javascript variable from C#
Jan 10, 2013 05:47 AM|LINK
Check the return URL sent to PayPal is should be same as the website URL (sometimes browser create different ASP.NET_SessionId for url with www and without www means ASP.NET_SessionId for www.example.com and example.com will be different and that is because you are not getting session values)
define riderid/userid as public variable on code behind and
Profile