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(Se ssion("res"), Session("res") in payResult.asp but still it doesnt work...
23 3605 CroCrew 564
Recognized Expert Contributor
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~
hi crowcrew...
its not working...it shows page error(The page cannot be displayed)
=(
CroCrew 564
Recognized Expert Contributor
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~
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 %>
CroCrew 564
Recognized Expert Contributor
There is no code that is redirecting to PayResult.asp
is that comming in form the Request.Form("r eturn_url")?
Before the "Dim conn" line in your Page_Load add the following code: -
Response.Write("Here: " & Request.Form("return_url"))
-
CroCrew 564
Recognized Expert Contributor
What do you get before the post and then what do you get after the post.
CroCrew 564
Recognized Expert Contributor
Comment out the Response.Redire cts on the page too so you don’t get the error
CroCrew 564
Recognized Expert Contributor
Hello ryna,
Try substituting your code in “icePayment.asp x” 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~
this statement Request.Form("r eturn_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...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {
document.images.src = eval("mt" +menu+ ".src")
}
alert("imgOff_hidemenu");
hideMenu=setTimeout('Hide(menu,num)',500);
|
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of code...
TCHAR myArray;
DoStuff(myArray);
|
by: Mike MacSween |
last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime
ago.
Then remembered that arguments are passed by reference, by default.
Does the fact that this slowed me down indicate:
a) That I don't know enough
b) Passing arguments by ref is bad
|
by: Scott Zabolotzky |
last post by:
I'm trying to pass a custom object back and forth between forms.
This custom object is pulled into the app using an external reference
to an assembly DLL that was given to me by a co-worker. A query-string
flag is used to indicate to the page whether it should instantiate
a new instance of the object or access an existing instance from
the calling page.
On the both pages I have a property of the page which is an
instance of this custom...
|
by: John Pass |
last post by:
Hi,
In the attached example, I do understand that the references are not changed
if an array is passed by Val. What I do not understand is the result of line
99 (If one can find this by line number) which is the last line of the
following sub routine:
' procedure modifies elements of array and assigns
' new reference (note ByVal)
Sub FirstDouble(ByVal array As Integer())
Dim i As Integer
| |
by: MSDNAndi |
last post by:
Hi,
I get the following warning:
"Possibly incorrect assignment to local 'oLockObject' which is the argument
to a using or lock statement. The Dispose call or unlocking will happen on
the original value of the local."
My code is:
using System;
using System.Collections.Generic;
|
by: Andrew Bullock |
last post by:
Hi,
I have two classes, A and B,
B takes an A as an argument in its constructor:
A a1 = new A();
B b = new B(a1);
|
by: James Robertson |
last post by:
I am new to the ASP and VB thing so be kind. Question I have is that
I have created an ASPX web site to use as an E-Mail page. But I want
to use this for a lot of users. Can I create the link on the WEB site
to mail to passing a variable from the WEB site to the ASPX web site
to E-Mail to? Hope I explained this correctly.
This is a response from another group.
There was no way for you to know it, but this is a classic asp newsgroup....
|
by: DaTurk |
last post by:
If I call this method, and pass it a byte by ref, and initialize
another byte array, set the original equal to it, and then null the
reference, why is the original byte array not null as well? I thought
passing by reference, your passing the address in memory.
public bool DoSomething(ref byte data)
{
byte retVal = null;
try
|
by: =?Utf-8?B?U3VqZWV0?= |
last post by:
If there are long strings (like 1MB or 2MB) is it more performant to pass
those by ref to methods or by value?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |