Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi all,

I am developing payment gateway application using vb.net with the help of asp.net, the thing is i done this application perfectly but i got some page redirecting issue, my payment flow should like this, (registerd user only can able to click payment button) that is user can click the payment button its sudently go to payment page ,in this i can pass the value through post method only.In this page user can able to submit their account details .once they submit the pay button, the page has been redirect to mypaysuccess.aspx were i mentioned in the code. But my point is that page cannot be redirect to mypaysuccess.aspx which is redirecting to anothor page that is signin.aspx but it should i need to redirect mypaysuccess.aspx only .also the same user once again do the above flow with the same browser then its working fine the page has been redirect to mypaysuccess.aspx page.So this is my problem. please find out my application code which i declared in the mentioned payment page.please give me a drop of solution which is very helpful for me your thoughts...

payment button click page:
VB
Protected Sub ibRegister_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibRegister.Click
        Try
            Dim result() As String = New String(5) {}
            Dim objCls As clsCommon = New clsCommon()
            Dim amount As String
            amount = drpAmount.Text.Trim().Substring(1)
            result = objCls.beforetrans(Session("user_name").ToString(), Session("user_id").ToString(), Session("user_email").ToString(), Convert.ToInt32(amount))
            ttid = result(0)
            ttkey = result(1)
            Session.Add("user_amount", amount)
            'Session.Add("user_ttid", ttid)
            'Session.Add("user_ttkey", ttkey)

            HttpContext.Current.Response.Clear()
            HttpContext.Current.Response.Write("<html><head>")
            HttpContext.Current.Response.Write(String.Format("</head><body onload=""document.form1.submit()"">"))
            HttpContext.Current.Response.Write(String.Format("<form name=""form1"" method=""Post"" action=""https://payments.securetrading.net/process/payments/choice"">"))
            HttpContext.Current.Response.Write(String.Format("<input name=""sitereference"" type=""hidden"" value=""test_payment2342"">"))
            HttpContext.Current.Response.Write(String.Format("<input name=""currencyiso3a"" type=""hidden"" value=""GBP"">"))
            HttpContext.Current.Response.Write(String.Format("<input name=""mainamount"" type=""hidden"" value=""" + amount + """>"))
            HttpContext.Current.Response.Write(String.Format("<input name=""version"" type=""hidden"" value=""1"">"))
            HttpContext.Current.Response.Write(String.Format("<input name=""orderreference"" type=""hidden"" value=""" + Session("user_id").ToString() + """>"))
            HttpContext.Current.Response.Write(String.Format("<input name=""ttid"" type=""hidden"" value=""" + ttid + """>"))
            HttpContext.Current.Response.Write(String.Format("<input name=""ttkey"" type=""hidden"" value=""" + ttkey + """>"))

            HttpContext.Current.Response.Write("</form>")
            HttpContext.Current.Response.Write("</body></html>")
            HttpContext.Current.Response.End()
    
        Catch ex As Exception
        End Try
    End Sub

mypaysuccess.aspx page:
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Response.Cache.SetCacheability(HttpCacheability.NoCache)

        If Session("user_id") <> Nothing Then
            If Not Page.IsPostBack Then

                If Session("user_type") = 1 Then
                    'show_adminmenus()
                End If
                lbluserwelcome.Text = "Welcome " & Session("user_name") & " " & Session("user_surname") & " to home"
            End If
        Else
            Session.Abandon() 'abandon that user session
            Server.Transfer("~/signin.aspx")
        End If

        Dim result() As String
        Dim clsobj As clsCommon = New clsCommon
        result = clsobj.fnGetCustomerAccountinfo(Session("user_id"))
        If result(0) = 1 Then
            lblBalance.Text = "My Account Balance is:;" & result(2)
        Else
            lblBalance.Text = "Unable to retrieve your balance  at the moment .Please try again later"
        End If
    End Sub
Posted
Updated 12-Oct-12 0:33am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900