Results 1 to 5 of 5

Thread: How to build my string

  1. #1
    Join Date
    Aug 2007
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default How to build my string

    Hi, all

    I try to integrate secpay now, again after HSBC is so much hassle.

    Now as aspx pages only post to them self, I made a little function.

    Public Function sendToSecpay()

    Dim secSting As String = ""

    How to build my string?

    Dim encoding As New ASCIIEncoding()
    Dim postData As String = secSting
    Dim data As Byte() = encoding.GetBytes(postData)

    ' web request...
    Dim myRequest As Net.HttpWebRequest = DirectCast(Net.HttpWebRequest.Create("https://www.secpay.com/java-bin/ValCard"), Net.HttpWebRequest)
    myRequest.Method = "POST"
    myRequest.ContentType = "application/x-www-form-urlencoded"
    myRequest.ContentLength = data.Length
    Dim newStream As IO.Stream = myRequest.GetRequestStream()
    ' Send the data.
    newStream.Write(data, 0, data.Length)
    newStream.Close()
    End Function


    now in my old asp code I used;

    response.write "<form name='to_secpay' action='https://www.secpay.com/java-bin/ValCard' method='post'>"
    response.Write "<input type=""hidden"" name=""options"" value=""mail_merchants=stickers@simplystuck.com""> "
    response.Write "<input type=""hidden"" name=""order"" value=""" & strSecPayOrder & """>"
    response.Write "<input type=""hidden"" name=""billing"" value=""bill_name=" & request("bill_name") & ",bill_addr_1=" & request("bill_addr_1") & ", " & request("bill_addr_2") & ",bill_city=" & request("bill_city") & ",bill_state=" & request("bill_state") & ",bill_post_code=" & uCase(request("bill_post_code")) & ",bill_country=" & left(request("bill_country"),2) & ",bill_phone=" & request("bill_phone") & ",bill_email=" & request("bill_email") & """>"
    response.Write "<input type=""hidden"" name=""merchant"" value=""secpay"">"

    Now how do I form my secpay string?
    Do I build the string like;
    secSting = secSting & name="merchant" & value="secpay" secSting = secSting & name="options" & value= mail_merchants=stickers@simplystuck.com"
    Secpay only shows stone old code on there site.


    Any pointers?

    Mike

  2. #2
    Join Date
    Jan 2006
    Posts
    419
    Thanks
    2
    Thanked 16 Times in 16 Posts

    Default

    We have recently integrated with sec pay.

    I think from your code you are looking to create a form which is placed in the page which a user submits or javascript is used to auto submit the form. This then takes you to the secpay site where you pay. A visible payment experience.

    If this is the case you need to display the form on the .aspx page. Depending on how you are building the site will determine the solution. Are you building a web application or a website using asp.net.

    If a web application there is only meant to be one form per page but you could try adding a place holder on the page and then populating the place holder with the content of the form. If it works then great. (.net 2.0 may have removed the restriction of the number of forms per page).

    The above will work if you are building a web site.

    We integrated using web services rather than xml to create an invisible payment experience.

    What you are doing is good in terms of pci e.g. you do not need to be but customers may not like a visible experience.

  3. The Following User Says Thank You to askjim For This Useful Post:

    Simply_Mike (14th April 2008)

  4. #3
    Join Date
    Aug 2007
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Hi, Jim
    First, I am an old hand in VB6.
    I made the transition to VB.net sort of Ok but still believe that VB6 was and is superior.
    The web site programming is NOT my personal strong point.
    Now our new web site is done in visual studio 2005 as Web site (.net 2.0)
    On my checkout.aspx page I have a proceed button.
    First it does all the database work, entering the customer details in the customer table and the ordered items into the sales table.
    All fields required are present on the form as asp text boxes or as asp labels.
    http://simplystuck-net.domain-ref.http.astatine.lon.periodicnetwork.com/checkout.aspx?MyString=gubn0v55orxt3r2jkpzdxen5
    As aspx compiled pages can only post to pages within the application, I hoped that my little function could solve that. Still, the server does not go to the Secpay page.
    Bud as you say..
    To enter Credit Card information into our web site would be the more elegant solution and looks more professional.
    I have integrated secpay into our in house Phone Order desktop app via wdsl and web service.
    And it works since over one year like a charm.
    But in the web site I cannot get to grips with the web service.
    I made a MyProxyClass.vb file (auto-generated by wsdl) but I have no clue what goes into the webservice.asmx file or what other files are needed.
    Any heads up on that would be much appreciated.
    Best regards
    Mike

  5. #4
    Join Date
    Jan 2006
    Posts
    419
    Thanks
    2
    Thanked 16 Times in 16 Posts

    Default

    I did not do the secpay integration but secpay should have a url for the web service (a wsdl file). Can you post this. Then in the website you need to right click on the solution and choose add eb reference - on this dialog enter the url. Once this has been done within the code of the page you can then reference the functions within the web service. If you press Ctrl + J you should get a list of namespaces then you can find the one that resembles the web service and then choose it then put a . and choose a class / function until you find what you are after.

    You should be able to reuse most code that you did for the desktop app.

    If you have built a website then the pages are not normally compiled or less you publish the site. A web application will be compiled though.

    If you want to embed your payment page into the page it is possible. I will PM you a site which is an example of doing what you are after but with World Pay and also an invisible payment experience.

    James

  6. #5
    Join Date
    Apr 2006
    Location
    Bath
    Posts
    180
    Thanks
    1
    Thanked 9 Times in 6 Posts

    Default

    Your asmx file is an entry point to your webservice.
    You don't actually have to do anything, a .net webservice self builds the wsdl on all the public methods in your base class..

    Whats cool is that in visual studio you can add a web refference to your webservice - give it a namespace and in about 3 seconds you have full interaction with your webservice within your project code. you just declare what classes you want in your project that your away..

    Also when building a string of text I tend to use StringBuilder object and append each section together. But if your string contains variables its more efficiant to use string.concat("blah","blah",var,"blah") or string.format("some Text {0} more text {1}", var1, var2)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Strange secpay response string
    By Simply_Mike in forum Technical Support
    Replies: 5
    Last Post: 10th December 2007, 06:36 PM
  2. MySQL 5 Connection String
    By bracora.com in forum ASP.NET
    Replies: 1
    Last Post: 16th May 2006, 02:37 PM
  3. MySQL Connect String for ASP
    By holivar in forum ASP (VBScript)
    Replies: 16
    Last Post: 25th April 2006, 08:17 AM
  4. "String reference not set to " - Encrytion
    By jaimalchohan in forum ASP.NET
    Replies: 3
    Last Post: 28th November 2005, 07:15 PM
  5. .NET Appliction Stopped working after build
    By jaimalchohan in forum Technical Support
    Replies: 2
    Last Post: 9th November 2005, 12:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •