Need to convert the code below to asp.net. The issue I having is in asp.net you can't have a runat="server" on a script tag and have another language for the page. Which in my case is vb.
hex_str = hex_str + LCase(CStr(Hex(Asc(Mid(Str, i, 1)))))
Next
hash = SHA256(hex_str)
%>
All
the functions that start with get are javascript functions in that script file. This so I can create an encryption key to hookup with first data(credit card processor).
MikeFinley
Member
2 Points
4 Posts
classic asp to asp.net issue
Jul 11, 2012 03:16 PM|LINK
Need to convert the code below to asp.net. The issue I having is in asp.net you can't have a runat="server" on a script tag and have another language for the page. Which in my case is vb.
<script src="~/Scripts/FirstData.js" type="text/javascript" language="javascript" runat="server" ></script>
<%
formattedDate = getFormattedDate()
chargetotal = Request.Form("total")
subtotal = Request.Form("total")
storename = getStoreName()
sharedsecret = getSharedSecret()
TimeZone = getTimeZone()
Str = storename + formattedDate + chargetotal + sharedsecret
hex_str = ""
For i = 1 To Len(Str)
hex_str = hex_str + LCase(CStr(Hex(Asc(Mid(Str, i, 1)))))
Next
hash = SHA256(hex_str)
%>
All the functions that start with get are javascript functions in that script file. This so I can create an encryption key to hookup with first data(credit card processor).
javascript asp
Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: classic asp to asp.net issue
Jul 11, 2012 03:34 PM|LINK
<script runat=server language=vb>
sub page_load
//vb code here
end sub
</script>
MikeFinley
Member
2 Points
4 Posts
Re: classic asp to asp.net issue
Jul 11, 2012 04:20 PM|LINK
I change the code to this:
<script src="~/Scripts/FirstData.js" type="text/javascript" language="javascript" ></script>
<script type="text/VB">
formattedDate = getFormattedDate()
chargetotal = Request.Form("total")
subtotal = Request.Form("total")
storename = getStoreName()
sharedsecret = getSharedSecret()
TimeZone = getTimeZone()
Str = storename + formattedDate + chargetotal + sharedsecret
hex_str = ""
For i = 1 To Len(Str)
hex_str = hex_str + LCase(CStr(Hex(Asc(Mid(Str, i, 1)))))
Next
hash = SHA256(hex_str)
</script>
<input type="hidden" name="timezone" id="timezone" value="PST"/>
<input type="hidden" name="authenticateTransaction" value="false" />
<input size="50" type="hidden" name="txntype" value="sale" />
<input size="50" type="hidden" name="txndatetime" id="txndatetime" value="formattedDate"/>
<input size="50" type="hidden" name="chargetotal" id="chargetotal" value="chargetotal"/>
<input size="50" type="hidden" name="subtotal" id="subtotal" value="subtotal"/>
<input size="50" type="hidden" name="sharedsecret" id="sharedsecret" value="sharedsecret"/>
<input size="50" type="hidden" name="trxOrigin" value="ECI" />
<input size="50" type="hidden" name="hash" id="hash" value="hash"/>
<input size="50" type="hidden" name="storename" id="storename" value="storename"/>
But the value aren't getting populated in the hidden fields.