passing variable from asp.net to asp | Newbie | | Join Date: Oct 2009
Posts: 12
| |
Desperately need help....
here's the snippet of my code that im trying to solve since last week...
icePayment.aspx -
If (Left(Request.Form("return_url"), 7) <> "http://") Then
-
errorInput = errorInput & "Invalid return URL path! <BR>"
-
errorExist = True
-
Response.Redirect("InvalidUrlError.aspx")
-
Else
-
Session( "res") = "1"
-
TextBox2.Text = Session(Response.Redirect(Request.Form("res")"retu rn_url"))
payResult.asp -
<% if ( Request.QueryString(Session("res") ) = "1") then %>
-
Thanks!
-
<% else %>
-
sorry
-
<% end if %>
However,it could not be captured in payResult.asp
Ive tried using Request.form(Session("res"), Session("res") in payResult.asp but still it doesnt work...
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Hello Ryna,
If I understand your question/problem you have a scenario where your user is on a dotNet page and you want to redirect them to a Classic asp page and also pass in a variable to the Classic asp page too?
If that’s the case then pass the variable within the query string like this: -
Response.Redirect("payResult.asp?res=" & Session("res"))
-
Hope that helps,
CroCrew~
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
hi crowcrew...
its not working...it shows page error(The page cannot be displayed)
=(
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Hello ryna,
So, I/we understand the situation better could you please post the code for both the pages? A 404 (page cannot be displayed) could be many things.
But, please before pasting your code for each page make sure you wrap the code of each page inside [code] tags.
Thanks,
CroCrew~
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
Here's the code..
icePayment.aspx -
Imports System.Data
-
Imports System.Data.SqlClient
-
-
Partial Class icePayment
-
Inherits System.Web.UI.Page
-
-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
-
Dim conn As New SqlConnection("data source=IFCDU2-WS23\SQLEXPRESS;initial catalog=icebank;integrated security=true")
-
conn.Open()
-
-
Dim response_text As String
-
'Dim redirectStr As String
-
Dim input(9) As Object
-
Dim errorInput As String
-
Dim errorExist As Boolean
-
Dim inputName As Object ' Object
-
Dim i As Integer
-
Dim j As Integer
-
Dim k As Integer
-
-
errorInput = ""
-
errorExist = False
-
inputName = New Object() {"merchant_id", "amount", "card_type", "card_num", "expireMon", "expireYr", "return_url", "ref_code", "card_name"}
-
-
'get input from Form
-
For i = 0 To 8
-
Input(i) = Request.Form(inputName(i))
-
Next
-
'Check the Input is Empty
-
For j = 0 To 8
-
If IsNothing(Input(j)) Then
-
errorInput = errorInput & inputName(j) & " is blank.<BR>"
-
errorExist = True
-
End If
-
Next
-
'Check the Input is Numeric
-
For k = 0 To 5
-
If Not (IsNumeric(Input(k))) Then
-
errorInput = errorInput & inputName(k) & " is not numeric.<BR>"
-
errorExist = True
-
End If
-
Next
-
If Not (errorExist) Then
-
-
End If
-
-
Dim response_code As Integer
-
'Dim Msg As String
-
-
Dim merchantSql As New SqlCommand("select * FROM iceMerchant WHERE merchantID = '" & Request.Form("merchant_id") & "'", conn)
-
-
Dim merchant As String = Request.Form("merchant_id")
-
Dim merchantDr As SqlDataReader
-
merchantDr = merchantSql.ExecuteReader()
-
-
-
response_code = 0
-
If merchantDr.Read() Then
-
response_code = 0
-
-
If merchant <> Trim(merchantDr("merchantID")) Then
-
response_text = "Invalid Merchant ID"
-
'Response.Redirect("MerchantError.aspx")
-
End If
-
-
Else
-
End If
-
merchantDr.Close()
-
conn.Close()
-
-
conn.Open()
-
Dim credit As String = Trim(Request.Form("card_num"))
-
Dim cardName As String = Trim(Request.Form("card_name"))
-
Dim cardType As String = (Request.Form("card_type"))
-
'Dim cardType As String = CDbl(Request.Form("card_type")) / 1
-
Dim amount As String = Trim(Request.Form("amount"))
-
Dim ref_code As String = Trim(Request.Form("ref_code"))
-
Dim desc As String
-
Dim time As Date
-
Dim randomNo As Single
-
Dim trans_date As String
-
Dim trans_code As String
-
Dim expireMonSql As Integer
-
Dim expireYrSql As Integer
-
Dim credit_limit As Object
-
Dim total_credit As Object
-
Dim credit_balance As Object
-
Dim merchant_balance As Object
-
Dim userID As Object
-
Dim mBalance As Object
-
Dim debit_account As Object
-
Dim credit_account As Object
-
Dim expireMonFM As Object = Trim(Int(Request.Form("expireMon")))
-
Dim expireYrFM As Object = Trim(Int(Request.Form("expireYr")))
-
'Dim creditSql As New SqlCommand("select iceUser.userID, fullName, account_id, creditCardNo, cardType, expiryDate, totalcredit, creditlimit, creditBalance FROM iceUser INNER JOIN ( account_summary INNER JOIN iceCredit ON account_summary.account_id = iceCredit.creditCardNo) ON iceUser.userID = account_summary.userID where creditCardNo = '" & Request.Form("card_num") & "' ", conn)
-
Dim creditSql As New SqlCommand("select iceUser.userID, fullName, account_id, creditCardNo, cardType, expiryDate, totalcredit, creditlimit, creditBalance, iceMerchant.merchantID, iceMerchant.merchantBalance FROM iceMerchant, iceUser INNER JOIN ( account_summary INNER JOIN iceCredit ON account_summary.account_id = iceCredit.creditCardNo) ON iceUser.userID = account_summary.userID where creditCardNo = '" & Trim(Request.Form("card_num")) & "' ", conn)
-
'Dim creditSql As New SqlCommand("select iceUser.userID, fullName, account_id, creditCardNo, cardType, expiryDate, totalcredit, creditlimit, creditBalance, iceMerchant.merchantID, iceMerchant.merchantBalance FROM iceMerchant, iceUser INNER JOIN ( account_summary INNER JOIN iceCredit ON account_summary.account_id = iceCredit.creditCardNo) ON iceUser.userID = account_summary.userID ", conn)
-
-
Dim creditDr As SqlDataReader
-
creditDr = creditSql.ExecuteReader()
-
-
If creditDr.Read() Then
-
response_code = 0
-
-
If Not IsNumeric(credit) Or credit = "" Or credit <> creditDr("creditCardNo") Then
-
response_text = "Invalid Credit Card No"
-
-
Else
-
If cardName = "" Or cardName <> Trim(UCase(creditDr("fullName"))) Then
-
response_text = "Invalid Card Holder's Name"
-
-
' Label1.Text = cardName & Trim(UCase(creditDr("fullName")))
-
Else
-
'If cardType <> CDblcreditDr("cardType")) / 1 Then
-
If cardType <> (creditDr("cardType")) Then
-
response_text = "Invalid Card Type"
-
-
-
Else
-
expireMonSql = Month(Convert.ToDateTime(creditDr("expiryDate")))
-
expireYrSql = Year(Convert.ToDateTime(creditDr("expiryDate")))
-
credit_limit = Trim(creditDr("creditLimit"))
-
total_credit = Trim(creditDr("totalCredit"))
-
-
If Not IsNumeric(expireMonFM And expireYrFM) Or (((CDbl(expireMonFM) - expireMonSql) <> 0) Or ((CDbl(expireYrFM) - expireYrSql) <> 0)) Then
-
response_text = "Invalid Credit Card"
-
-
-
ElseIf ((CDbl(amount) - CDbl(credit_limit)) > 0) Then
-
response_text = "Card limit is reached!"
-
-
Else
-
response_code = 1
-
credit_balance = Trim(creditDr("creditBalance"))
-
debit_account = Trim(creditDr("creditCardNo"))
-
credit_account = Trim(creditDr("merchantID"))
-
merchant_balance = Trim(creditDr("merchantBalance"))
-
userID = Trim(creditDr("userID"))
-
-
-
If (response_code = 1) Then
-
-
If (CInt(credit_balance) = 0) Then
-
credit_limit = CDbl(credit_limit) - CDbl(amount)
-
credit_balance = -CDbl(amount)
-
-
Else
-
credit_balance = CDbl(credit_balance) - CDbl(amount)
-
-
-
If (credit_balance >= 0) Then
-
credit_limit = total_credit
-
-
Else
-
credit_limit = total_credit + credit_balance
-
-
End If
-
End If
-
-
'mBalance = merchant_balance
-
'mBalance = mBalance + CDbl(amount)
-
'conn.Close()
-
'conn.Open()
-
-
''update merchant balance
-
'Dim updateMerchant As String
-
'updateMerchant = "update iceMerchant set merchantBalance = '" & mBalance & "' where merchantID = '" & merchant & "'"
-
'Dim cmdMerchant As New SqlCommand(updateMerchant, conn)
-
'cmdMerchant.ExecuteNonQuery()
-
-
'conn.Close()
-
'conn.Open()
-
-
''edit iceCredit table
-
'Dim updateCredit As String
-
'updateCredit = "update iceCredit set creditBalance = '" & credit_balance & "',creditLimit = '" & credit_limit & "' where creditCardNo ='" & credit & "' "
-
-
'Dim cmdCredit As New SqlCommand(updateCredit, conn)
-
'cmdCredit.ExecuteNonQuery()
-
-
-
'Randomize(Timer())
-
'randomNo = 0
-
'Do While randomNo <= 1000
-
' randomNo = Int((9999 * Rnd()) + 1)
-
'Loop
-
'time = TimeOfDay()
-
'trans_date = Today() & " " & TimeOfDay()
-
'trans_code = "ICE-"
-
'trans_code = trans_code & randomNo & Second(time) & "-" & Int(Timer())
-
'Dim c1 As String = "Credit Card Transaction @"
-
'Dim c2 As String = "</BR> Ref. Code: "
-
'desc = c1 & time & c2 & ref_code
-
-
'conn.Close()
-
'conn.Open()
-
-
''insert(transaction)
-
'Dim updateTrans As String
-
'updateTrans = "insert into iceTransaction(trans_code, account_id, trans_amt, trans_date, trans_desc,tID) values ('" & trans_code & "','" & debit_account & "', '" & amount & "','" & trans_date & "','" & desc & "','" & userID & "')"
-
-
'Dim cmdTrans As New SqlCommand(updateTrans, conn)
-
'cmdTrans.ExecuteNonQuery()
-
''Request.Form("response_code") = 1
-
'response_text = "Transaction is success!!"
-
''redirectStr = Request.Form("return_url")
-
-
End If
-
-
End If
-
-
If (Left(Request.Form("return_url"), 7) <> "http://") Then
-
errorInput = errorInput & "Invalid return URL path! <BR>"
-
errorExist = True
-
Response.Redirect("inputerror.aspx")
-
Response.Redirect("InvalidUrlError.aspx")
-
Else
-
-
Session("res") = response_code
-
Session("text") = response_text
-
Response.Redirect((Request.Form("return_url")))
-
End If
-
-
If (errorExist) Then
-
response_code = 0
-
response_text = errorInput
-
End If
-
End If
-
-
End If
-
-
End If
-
-
End If
-
'End If
-
-
-
creditDr.Close()
-
conn.Close()
-
-
End Sub
-
-
End Class
-
-
payResult.asp - <% if ( Request.Form(Session("res")) = 1) then %>
-
Thank You for buying GOODS from our online Store!
-
-
<% else %>
-
I'm sorry,but there was a problem with this transaction.<br />
-
The server response was:<br />
-
-
<% = Request.Form(Session("text")) %> <br />
-
Go back to check Out page to enter information again<br />
-
-
<% end if %>
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
There is no code that is redirecting to PayResult.asp
is that comming in form the Request.Form("return_url")?
Before the "Dim conn" line in your Page_Load add the following code: -
Response.Write("Here: " & Request.Form("return_url"))
-
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
What do you get before the post and then what do you get after the post.
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Comment out the Response.Redirects on the page too so you don’t get the error
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Hello ryna,
Try substituting your code in “icePayment.aspx” with this code and run your solution and tell us what you get.
icePayment.aspx -
Imports System.Data
-
Imports System.Data.SqlClient
-
-
Partial Class icePayment
-
Inherits System.Web.UI.Page
-
-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
Dim conn As New SqlConnection("data source=IFCDU2-WS23\SQLEXPRESS;initial catalog=icebank;integrated security=true")
-
conn.Open()
-
-
Dim response_text As String
-
Dim input(9) As Object
-
Dim errorInput As String
-
Dim errorExist As Boolean
-
Dim inputName As Object
-
Dim i As Integer
-
Dim j As Integer
-
Dim k As Integer
-
-
errorInput = ""
-
errorExist = False
-
inputName = New Object() {"merchant_id", "amount", "card_type", "card_num", "expireMon", "expireYr", "return_url", "ref_code", "card_name"}
-
-
For i = 0 To 8
-
Input(i) = Request.Form(inputName(i))
-
Next
-
-
For j = 0 To 8
-
If IsNothing(Input(j)) Then
-
errorInput = errorInput & inputName(j) & " is blank.<BR>"
-
errorExist = True
-
End If
-
Next
-
-
For k = 0 To 5
-
If Not (IsNumeric(Input(k))) Then
-
errorInput = errorInput & inputName(k) & " is not numeric.<BR>"
-
errorExist = True
-
End If
-
Next
-
-
Dim response_code As Integer
-
Dim merchantSql As New SqlCommand("select * FROM iceMerchant WHERE merchantID = '" & Request.Form("merchant_id") & "'", conn)
-
-
Dim merchant As String = Request.Form("merchant_id")
-
Dim merchantDr As SqlDataReader
-
merchantDr = merchantSql.ExecuteReader()
-
-
response_code = 0
-
If merchantDr.Read() Then
-
response_code = 0
-
If merchant <> Trim(merchantDr("merchantID")) Then
-
response_text = "Invalid Merchant ID"
-
End If
-
End If
-
merchantDr.Close()
-
conn.Close()
-
-
conn.Open()
-
Dim credit As String = Trim(Request.Form("card_num"))
-
Dim cardName As String = Trim(Request.Form("card_name"))
-
Dim cardType As String = (Request.Form("card_type"))
-
Dim amount As String = Trim(Request.Form("amount"))
-
Dim ref_code As String = Trim(Request.Form("ref_code"))
-
Dim desc As String
-
Dim time As Date
-
Dim randomNo As Single
-
Dim trans_date As String
-
Dim trans_code As String
-
Dim expireMonSql As Integer
-
Dim expireYrSql As Integer
-
Dim credit_limit As Object
-
Dim total_credit As Object
-
Dim credit_balance As Object
-
Dim merchant_balance As Object
-
Dim userID As Object
-
Dim mBalance As Object
-
Dim debit_account As Object
-
Dim credit_account As Object
-
Dim expireMonFM As Object = Trim(Int(Request.Form("expireMon")))
-
Dim expireYrFM As Object = Trim(Int(Request.Form("expireYr")))
-
Dim creditSql As New SqlCommand("select iceUser.userID, fullName, account_id, creditCardNo, cardType, expiryDate, totalcredit, creditlimit, creditBalance, iceMerchant.merchantID, iceMerchant.merchantBalance FROM iceMerchant, iceUser INNER JOIN ( account_summary INNER JOIN iceCredit ON account_summary.account_id = iceCredit.creditCardNo) ON iceUser.userID = account_summary.userID where creditCardNo = '" & Trim(Request.Form("card_num")) & "' ", conn)
-
-
Dim creditDr As SqlDataReader
-
creditDr = creditSql.ExecuteReader()
-
-
If creditDr.Read() Then
-
response_code = 0
-
If Not IsNumeric(credit) Or credit = "" Or credit <> creditDr("creditCardNo") Then
-
response_text = "Invalid Credit Card No"
-
Else
-
If cardName = "" Or cardName <> Trim(UCase(creditDr("fullName"))) Then
-
response_text = "Invalid Card Holder's Name"
-
Else
-
If cardType <> (creditDr("cardType")) Then
-
response_text = "Invalid Card Type"
-
Else
-
expireMonSql = Month(Convert.ToDateTime(creditDr("expiryDate")))
-
expireYrSql = Year(Convert.ToDateTime(creditDr("expiryDate")))
-
credit_limit = Trim(creditDr("creditLimit"))
-
total_credit = Trim(creditDr("totalCredit"))
-
-
If Not IsNumeric(expireMonFM And expireYrFM) Or (((CDbl(expireMonFM) - expireMonSql) <> 0) Or ((CDbl(expireYrFM) - expireYrSql) <> 0)) Then
-
response_text = "Invalid Credit Card"
-
ElseIf ((CDbl(amount) - CDbl(credit_limit)) > 0) Then
-
response_text = "Card limit is reached!"
-
Else
-
response_code = 1
-
credit_balance = Trim(creditDr("creditBalance"))
-
debit_account = Trim(creditDr("creditCardNo"))
-
credit_account = Trim(creditDr("merchantID"))
-
merchant_balance = Trim(creditDr("merchantBalance"))
-
userID = Trim(creditDr("userID"))
-
If (response_code = 1) Then
-
If (CInt(credit_balance) = 0) Then
-
credit_limit = CDbl(credit_limit) - CDbl(amount)
-
credit_balance = -CDbl(amount)
-
Else
-
credit_balance = CDbl(credit_balance) - CDbl(amount)
-
If (credit_balance >= 0) Then
-
credit_limit = total_credit
-
Else
-
credit_limit = total_credit + credit_balance
-
End If
-
End If
-
End If
-
End If
-
-
If (Left(Request.Form("return_url"), 7) <> "http://") Then
-
errorInput = errorInput & "Invalid return URL path! <BR>"
-
errorExist = True
-
Response.Write("Going to redirect to user to: inputerror.aspx")
-
Response.Write("Going to redirect to user to: InvalidUrlError.aspx")
-
Response.End
-
Else
-
Session("res") = response_code
-
Session("text") = response_text
-
Response.Write("Going to redirect to user to: return_url" & Request.Form("return_url"))
-
Response.End
-
End If
-
-
If (errorExist) Then
-
response_code = 0
-
response_text = errorInput
-
End If
-
End If
-
End If
-
End If
-
End If
-
-
creditDr.Close()
-
conn.Close()
-
End Sub
-
End Class
-
CroCrew~
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
this statement Request.Form("return_url")) is redirecting to payResult.asp
when I execute the code it did when to payResult.asp but it show:
<% else %>
I'm sorry,but there was a problem with this transaction.<br />
The server response was:<br />
eventhough its successfully update and insert to database...
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Hello ryna,
Yes, that is because DotNet “Session” variables will not pass across to Classic ASP pages. So your If—Then statement will fall into the “else” because the condition is “False”.
Did you copy and paste my last post over your code? I need to know what the output is when you run and submit your form with it to help you.
CroCrew~
|  | Site Moderator | | Join Date: Oct 2006 Location: The Great White North
Posts: 5,137
| | | re: passing variable from asp.net to asp
Ryna, I gave you this same answer in your other thread on the topic. Please do not double post your question because it makes it very hard for us to answer your question and it makes it hard for you to get the answer to your problem too (for example right now you probably didn't see the answer in your other thread).
Please refrain from double posting your questions in the future.
-Frinny
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
Yes croCrew, I did copy and paste your code..
The output is: Going to redirect to user to: return_url payResult.asp
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
to Frinavale,Noted.
=)
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Hello ryna,
Try substituting both pages now with the below two pages and run your solution and tell us what you get.
icePayment.aspx -
Imports System.Data
-
Imports System.Data.SqlClient
-
-
Partial Class icePayment
-
Inherits System.Web.UI.Page
-
-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
Dim conn As New SqlConnection("data source=IFCDU2-WS23\SQLEXPRESS;initial catalog=icebank;integrated security=true")
-
conn.Open()
-
-
Dim response_text As String
-
Dim input(9) As Object
-
Dim errorInput As String
-
Dim errorExist As Boolean
-
Dim inputName As Object
-
Dim i As Integer
-
Dim j As Integer
-
Dim k As Integer
-
-
errorInput = ""
-
errorExist = False
-
inputName = New Object() {"merchant_id", "amount", "card_type", "card_num", "expireMon", "expireYr", "return_url", "ref_code", "card_name"}
-
-
For i = 0 To 8
-
Input(i) = Request.Form(inputName(i))
-
Next
-
-
For j = 0 To 8
-
If IsNothing(Input(j)) Then
-
errorInput = errorInput & inputName(j) & " is blank.<BR>"
-
errorExist = True
-
End If
-
Next
-
-
For k = 0 To 5
-
If Not (IsNumeric(Input(k))) Then
-
errorInput = errorInput & inputName(k) & " is not numeric.<BR>"
-
errorExist = True
-
End If
-
Next
-
-
Dim response_code As Integer
-
Dim merchantSql As New SqlCommand("select * FROM iceMerchant WHERE merchantID = '" & Request.Form("merchant_id") & "'", conn)
-
-
Dim merchant As String = Request.Form("merchant_id")
-
Dim merchantDr As SqlDataReader
-
merchantDr = merchantSql.ExecuteReader()
-
-
response_code = 0
-
If merchantDr.Read() Then
-
response_code = 0
-
If merchant <> Trim(merchantDr("merchantID")) Then
-
response_text = "Invalid Merchant ID"
-
End If
-
End If
-
merchantDr.Close()
-
conn.Close()
-
-
conn.Open()
-
Dim credit As String = Trim(Request.Form("card_num"))
-
Dim cardName As String = Trim(Request.Form("card_name"))
-
Dim cardType As String = (Request.Form("card_type"))
-
Dim amount As String = Trim(Request.Form("amount"))
-
Dim ref_code As String = Trim(Request.Form("ref_code"))
-
Dim desc As String
-
Dim time As Date
-
Dim randomNo As Single
-
Dim trans_date As String
-
Dim trans_code As String
-
Dim expireMonSql As Integer
-
Dim expireYrSql As Integer
-
Dim credit_limit As Object
-
Dim total_credit As Object
-
Dim credit_balance As Object
-
Dim merchant_balance As Object
-
Dim userID As Object
-
Dim mBalance As Object
-
Dim debit_account As Object
-
Dim credit_account As Object
-
Dim expireMonFM As Object = Trim(Int(Request.Form("expireMon")))
-
Dim expireYrFM As Object = Trim(Int(Request.Form("expireYr")))
-
Dim creditSql As New SqlCommand("select iceUser.userID, fullName, account_id, creditCardNo, cardType, expiryDate, totalcredit, creditlimit, creditBalance, iceMerchant.merchantID, iceMerchant.merchantBalance FROM iceMerchant, iceUser INNER JOIN ( account_summary INNER JOIN iceCredit ON account_summary.account_id = iceCredit.creditCardNo) ON iceUser.userID = account_summary.userID where creditCardNo = '" & Trim(Request.Form("card_num")) & "' ", conn)
-
-
Dim creditDr As SqlDataReader
-
creditDr = creditSql.ExecuteReader()
-
-
If creditDr.Read() Then
-
response_code = 0
-
If Not IsNumeric(credit) Or credit = "" Or credit <> creditDr("creditCardNo") Then
-
response_text = "Invalid Credit Card No"
-
Else
-
If cardName = "" Or cardName <> Trim(UCase(creditDr("fullName"))) Then
-
response_text = "Invalid Card Holder's Name"
-
Else
-
If cardType <> (creditDr("cardType")) Then
-
response_text = "Invalid Card Type"
-
Else
-
expireMonSql = Month(Convert.ToDateTime(creditDr("expiryDate")))
-
expireYrSql = Year(Convert.ToDateTime(creditDr("expiryDate")))
-
credit_limit = Trim(creditDr("creditLimit"))
-
total_credit = Trim(creditDr("totalCredit"))
-
-
If Not IsNumeric(expireMonFM And expireYrFM) Or (((CDbl(expireMonFM) - expireMonSql) <> 0) Or ((CDbl(expireYrFM) - expireYrSql) <> 0)) Then
-
response_text = "Invalid Credit Card"
-
ElseIf ((CDbl(amount) - CDbl(credit_limit)) > 0) Then
-
response_text = "Card limit is reached!"
-
Else
-
response_code = 1
-
credit_balance = Trim(creditDr("creditBalance"))
-
debit_account = Trim(creditDr("creditCardNo"))
-
credit_account = Trim(creditDr("merchantID"))
-
merchant_balance = Trim(creditDr("merchantBalance"))
-
userID = Trim(creditDr("userID"))
-
If (response_code = 1) Then
-
If (CInt(credit_balance) = 0) Then
-
credit_limit = CDbl(credit_limit) - CDbl(amount)
-
credit_balance = -CDbl(amount)
-
Else
-
credit_balance = CDbl(credit_balance) - CDbl(amount)
-
If (credit_balance >= 0) Then
-
credit_limit = total_credit
-
Else
-
credit_limit = total_credit + credit_balance
-
End If
-
End If
-
End If
-
End If
-
-
If (Left(Request.Form("return_url"), 7) <> "http://") Then
-
errorInput = errorInput & "Invalid return URL path! <BR>"
-
errorExist = True
-
Response.Write("Going to redirect to user to: inputerror.aspx")
-
Response.Write("Going to redirect to user to: InvalidUrlError.aspx")
-
Response.End
-
Else
-
Response.Redirect(Request.Form("return_url") & "?res=" & response_code & "&text=" & response_text)
-
End If
-
-
If (errorExist) Then
-
response_code = 0
-
response_text = errorInput
-
End If
-
End If
-
End If
-
End If
-
End If
-
-
creditDr.Close()
-
conn.Close()
-
End Sub
-
End Class
-
payResult.asp -
<%
-
If (Request.QueryString("res") = 1) Then
-
Response.Write("Thank You for buying GOODS from our online Store!")
-
Else
-
Response.Write("I'm sorry,but there was a problem with this transaction.<br />")
-
Response.Write("The server response was:<br />")
-
Response.Write(Request.QueryString("text") & "<br />")
-
Response.Write("Go back to check Out page to enter information again<br />")
-
End If
-
%>
-
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Sorry just made a change to "payResult.asp" Check that page again if you seen it before I made the edits.
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
hi CroCrew,
it show page not found (404)...
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Is "payResult.asp" in the same folder that "icePayment.aspx" is in? Are you getting a 404 when going to "payResult.asp"? Post the error that your getting.
|  | Site Moderator | | Join Date: Oct 2006 Location: The Great White North
Posts: 5,137
| | | re: passing variable from asp.net to asp
Ryna, a 404 error means that it can't find the page that you're redirecting to.
You should check to make sure that the URLs are correct.
Try using the .NET debugger (that comes with VisualStudio) to step through your code and make sure that the URLs are pointing to the right place. If you don't want to use the debugger for some reason you could try hard coding the URL of the payResult.asp page: - 'What are you doing here?????
-
If (Left(Request.Form("return_url"), 7) <> "http://") Then
-
errorInput = errorInput & "Invalid return URL path! <BR>"
-
errorExist = True
-
Response.Redirect("inputerror.aspx")
-
'The following line will not be executed..................
-
'Anything that comes after a Response.Redirect is not executed
-
Response.Redirect("InvalidUrlError.aspx")
-
Else
-
Session("res") = response_code
-
Session("text") = response_text
-
'Instead of this please try hard coding the return url
-
' Response.Redirect((Request.Form("return_url")))
-
'Try this instead
-
'(Make sure that the URL is correctly pointing to the payResult.asp page):
-
Response.Redirect("http://localhost/websiteDirectory/payResult.asp?res=" & response_code,True)
-
End If
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
hi croCrew...
my fault.The codes that you want me to test it works but
Response.Redirect(Request.Form("return_url") & "?res=" & response_code & "&text=" & response_text)
the one in bold there's curly line below...
it says variable"response_text" is used before it has been assigned a value.A null reference exception could result in at runtime.
it almost working..
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
when I enter the wrong credit card it did not show the error message
which is : response_text = "Invalid Credit Card No"
however when it is successful(enter correct information) it print out this line:
Response.Write("Thank You for buying GOODS from our online Store!")
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: passing variable from asp.net to asp
Hello ryna,
So, is this resolved? You have your answer?
CroCrew~
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
im afraid not yet croCrew..
still stuck oon receiving the response_text...
| | Newbie | | Join Date: Oct 2009
Posts: 12
| | | re: passing variable from asp.net to asp
Sir I need help in understanding this code..Any help will be appreciated :
Dim conn As New SqlConnection("data source=IFCDU2-WS23\SQLEXPRESS;initial catalog=icebank;integrated security=true")
|  | Similar ASP / Active Server Pages bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|