hi,
i m use ccavenue payment gateway in asp.net c# 3.5 verson
ccavenue provide me non encrypted files checkout.aspx and redirecturl.aspx for payment gateway. its working fine on my local system. when these file uploaded on window server 2008 R2 64 bit. on live server redirecturl.aspx page not showing returning value after payment successfully or transaction decliend.
my redirecturl.aspx page code below
<script language="C#" runat=server>
void Page_Load (Object sender, EventArgs e) {
populate(sender, e);
}
public string verifychecksum(string MerchantId, string OrderId, string Amount, string AuthDesc, string WorkingKey, string checksum)
{
string str, retval, adlerResult;
long adler;
str = MerchantId + "|" + OrderId + "|" + Amount + "|" + AuthDesc + "|" + WorkingKey;
adler = 1;
adlerResult = adler32(adler, str);
if (string.Compare(adlerResult, checksum, true) == 0)
{
retval = "true";
}
else
{
retval = "false";
}
return retval;
}
private string adler32(long adler, string strPattern)
{
long BASE;
long s1, s2;
char[] testchar;
long intTest = 0;
BASE = 65521;
s1 = andop(adler, 65535);
s2 = andop(cdec(rightshift(cbin(adler), 16)), 65535);
for (int n = 0; n < strPattern.Length; n++)
{
testchar = (strPattern.Substring(n, 1)).ToCharArray();
intTest = (long)testchar[0];
s1 = (s1 + intTest) % BASE;
s2 = (s2 + s1) % BASE;
}
return (cdec(leftshift(cbin(s2), 16)) + s1).ToString();
}
private long power(long num)
{
long result = 1;
for (int i = 1; i <= num; i++)
{
result = result * 2;
}
return result;
}
private long andop(long op1, long op2)
{
string op, op3, op4;
op = "";
op3 = cbin(op1);
op4 = cbin(op2);
for (int i = 0; i < 32; i++)
{
op = op + "" + ((long.Parse(op3.Substring(i, 1))) & (long.Parse(op4.Substring(i, 1))));
}
return cdec(op);
}
private string cbin(long num)
{
string bin = "";
double num2 = num;
do
{
bin = (((num2 % 2)) + bin).ToString();
num2 = (long)Math.Floor(num2 / 2);
} while (!(num2 == 0));
long tempCount = 32 - bin.Length;
for (int i = 1; i <= tempCount; i++)
{
bin = "0" + bin;
}
return bin;
}
private string leftshift(string str, long num)
{
long tempCount = 32 - str.Length;
for (int i = 1; i <= tempCount; i++)
{
str = "0" + str;
}
for (int i = 1; i <= num; i++)
{
str = str + "0";
str = str.Substring(1, str.Length - 1);
}
return str;
}
private string rightshift(string str, long num)
{
for (int i = 1; i <= num; i++)
{
str = "0" + str;
str = str.Substring(0, str.Length - 1);
}
return str;
}
private long cdec(string strNum)
{
long dec = 0;
for(int n = 0; n< strNum.Length; n++)
{
dec = dec + (long)(long.Parse(strNum.Substring( n, 1)) * power(strNum.Length - (n + 1))) ;
}
return dec;
}
void populate(Object sender, EventArgs e)
{
string WorkingKey , Order_Id ,Merchant_Id,Amount,AuthDesc,Checksum,newChecksum,status;
//Assign following values to send it to verifychecksum function.
//put in the 32 bit working key in the quotes provided here
WorkingKey = "xxxxxxx";
Merchant_Id= "xxxxxx";
Order_Id= Request.Form["Order_Id"];
Amount = Request.Form["Amount"];
AuthDesc = Request.Form["AuthDesc"];
//////////////////////// ERROR...This variable(status) is not declared anywhere
status = Request.Form["Status"];
////////////////////// This comment is given by Majestic People, Coimbatore
////////////////////// The following variable "checksum" is declared as "Checksum" at the top
Checksum = Request.Form["Checksum"];
Response.Write(Merchant_Id + "<br>");
Response.Write(Order_Id + "<br>");
Response.Write(Amount + "<br>");
Response.Write(AuthDesc + "<br>");
Response.Write(status + "<br>");
Response.Write(Checksum + "<br>");
//Checksum = verifychecksum(Merchant_Id , Order_Id, Amount , AuthDesc ,WorkingKey, Checksum);
Checksum = verifychecksum(Merchant_Id, Order_Id, Amount, AuthDesc, WorkingKey, Checksum);
Response.Write(Checksum + "<br>");
if ((Checksum == "true") && (AuthDesc == "Y"))
{
Message.Text = "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful. We will be shipping your order to you soon.";
/*
Here you need to put in the routines for a successful
transaction such as sending an email to customer,
setting database status, informing logistics etc etc
*/
}
else if ((Checksum == "true") && (AuthDesc == "N"))
{
Message.Text = "<br>Thank you for shopping with us. However,the transaction has been declined.";
/*
Here you need to put in the routines for a failed
transaction such as sending an email to customer
setting database status etc etc
*/
}
else if ((Checksum == "true") && (AuthDesc == "B"))
{
Message.Text = "<br>Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail";
/*
Here you need to put in the routines/e-mail for a "Batch Processing" order
This is only if payment for this transaction has been made by an American Express Card
since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders"
*/
}
else
{
Message.Text = "<br>Security Error. Illegal access detected";
/*
Here you need to simply ignore this and dont need
to perform any operation in this condition
*/
}
}
</script>
<body>
<center>
<form method="post" runat="server">
<asp:label id="Message" runat="server"/>
</form>
</center>
</body>
</html>
so please help . its urgent
Thanks in advance