ASP.NET Problem - Driving me nuts!

Associate
Joined
2 Sep 2007
Posts
2,001
Hi All

I am developing a website which allows our students to enrol online. The payments are made through Barclays Epdq system. The student gets to a certain step of the enrolment form and when they click on the pay button I send the info which Barclays need (returnurl, merchantname, an encrypted value) they fill in their card info and they are sent back to my returning page. (this works).

Now Barclays gave me the code to put in the returning page. This code works but the problem is I don't want to write the information to a file but to a database I know how to write to a database. Here is the problem, for testing purposes I thought right lets output some of the stuff written to the file. See in bold. It will not output what's in the form variable under any circumstances. This has never been a problem for me in the past. Then I thought right put a textbox or label on the page and output to that for e.g.

Label1.Text = Request.Form("oid")
or
TextBox1.Text = Request.Form("oid")

Neither of the above work. Then I thought right put the values into session variables then to a redirect to another page on my site and pull the info I need from the sess variables but Server.Transfer refuses to work. I mean WTF. This is driving me nuts. Any ideas?



Code:
Public Class Response
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim fs, fname, path, timestamp

        If Request.ServerVariables("request_method") = "POST" Then

            [B]Response.Write (Request.Form("oid"))[/B]

            fs = Server.CreateObject("Scripting.FileSystemObject")

            path = "c:\" 'set your logfile directory path here
            timestamp = Day(Date.Now) & "-" & Month(Date.Now) & "-" & Year(Date.Now)
            timestamp = timestamp & "--" & Hour(Now) & "-" & Minute(Now) & "-" & Second(Now)

            fname = fs.CreateTextFile(path & timestamp & "-" & Request.Form("oid") & ".log", True)

            fname.WriteLine("OrderID - " & Request.Form("oid"))
            fname.WriteLine("Transaction Status - " & Request.Form("transactionstatus"))
            fname.WriteLine("Total - " & Request.Form("total"))
            fname.WriteLine("ClientID - " & Request.Form("clientid"))
            fname.WriteLine("Transaction Time Stamp - " & Request.Form("datetime"))
            fname.Close()

            fname = Nothing
            fs = Nothing
        End If
    End Sub
End Class
 
Last edited:
Looks alright to me, assuming Barclays aren't doing something strange.. you can dump the whole request object to a file with something like:

System.Web.HttpContext.Current.Request.SaveAs(Server.MapPath(".") & "\dump.txt", true)

Might help you see what's going on.
 
Looks alright to me, assuming Barclays aren't doing something strange.. you can dump the whole request object to a file with something like:

System.Web.HttpContext.Current.Request.SaveAs(Server.MapPath(".") & "\dump.txt", true)

Might help you see what's going on.


Cheers will try that I'm also going to use the trace features in ASP.NET to try and see what is going.
 
Finally worked it out, my own stupid fault for not reading the documentation thoroughly sent from the Barclays. You have two things, a return URL this is the page which the banks sends the user back to and a post URL this is the information which the banks sends the post data to. I was using the same URL for post and return so what was happening is the bank would post the info, it would write to the file and then the bank would send another request to the same url but this was a get request, this is why I couldn't do a request.form because the form collection was empty.

Lesson for anyone doing bank stuff make sure you go through the documentation with a fine tooth comb
 
Back
Top Bottom