Below is the code for whic m getting an error as out of bound.
Actually I collecting a response from the payment gateway. Earlier it wokrd fine for few days. Now suddenly I have comeup with this error. Can Any1 help me in resolving the issue? Its a bit urgent.
I have tried with ur suggestion, now the result page is empty, not showing up anything.
Few days back, I was able to recieve the response from payment gateway, do some backend insertion and finaly display the confirmation message to the user.
The page used to execute fine with no problems of index out of bound issue, but suddenly how it has come now m not getting and where to check.
With some search on web, i found some other ways to resolve where it mentioned that
1. recylicng the application pool.
I have tried that also, but still the same result.
Any other suggestions from anyone would be helpful.
I would like to add one more thing here. If i use breakpoint in the response page, it not getting step by step execution. If i am able to debug using step by step execution, then atleast i can have some idea of why it is giving such error.
Thanks to both of you for replying. i would definitely look into what you both have suggested. Meanwhile I would like to make apoint again that, the same code i ran on server without any problem.
Now if it is giving this error, then is der something wrong from the payment gateway response?. because the code i am using has been provided the payment gateway itself in the integration kit.
saleem2
Member
56 Points
222 Posts
Error :Index was outside the bounds of the array.
Dec 12, 2012 12:31 PM|LINK
string sQS; string[] aQS; string lsDetail1, lsDetail2, lsDetail; string pwd = "ebskey"; string DR = Request.QueryString["DR"].ToString(); DR = DR.Replace(' ', '+'); sQS = Base64Decode(DR); DR = RC4.Decrypt(pwd, sQS, false); lsDetail = "<TABLE align=center border=0 cellPadding=0 cellSpacing=2 width='100%'>"; lsDetail += "<tr><th width='90%'><h2 class='co'>EBS Payment Integration Page</h2></th></tr></table>"; lsDetail += "<center><h3>Response</H3></center>"; lsDetail += "<table align='center' width='600' cellpadding='2' cellspacing='2' border='0'>"; lsDetail += "<tr><th colspan='2'>Transaction Details</th><tr></table>"; Response.Write(lsDetail); aQS = DR.Split('&'); foreach (string param in aQS) { string[] aParam = param.Split('='); lsDetail1 = "<table align='center' width='600' cellpadding='2' cellspacing='2' border='0'>"; lsDetail1 += "<td align='left'>" + aParam[0] + "</td></br>"; lsDetail2 = "<td align='left' width='50%'>" + aParam[1] + "</td>"; lsDetail2 += "</tr></table>"; lsDetail1 += lsDetail2; Response.Write(lsDetail1); lsDetail1 = ""; lsDetail2 = "";Line 49: lsDetail1 += "<td align='left'>" + aParam[0] + "</td></br>"; Line 50: Line 51: lsDetail2 = "<td align='left' width='50%'>" + aParam[1] + "</td>"; Line 52: Line 53: lsDetail2 += "</tr></table>";Your help is appreciated.
Thanks,
Saleem
oned_gk
All-Star
31820 Points
6510 Posts
Re: Error :Index was outside the bounds of the array.
Dec 12, 2012 12:42 PM|LINK
saleem2
Member
56 Points
222 Posts
Re: Error :Index was outside the bounds of the array.
Dec 12, 2012 12:53 PM|LINK
Hi oned_gk,
Where should i check? Plz guide on that.
Thanks,
Saleem
saleem2
Member
56 Points
222 Posts
Re: Error :Index was outside the bounds of the array.
Dec 13, 2012 03:53 AM|LINK
Can any1 help, I am still working on the issue.
Thanks,
Saleem
oned_gk
All-Star
31820 Points
6510 Posts
Re: Error :Index was outside the bounds of the array.
Dec 13, 2012 06:02 AM|LINK
try
if (aParam.Count()>1) { lsDetail1 = "<table align='center' width='600' cellpadding='2' cellspacing='2' border='0'>"; lsDetail1 += "<td align='left'>" + aParam[0] + "</td></br>"; lsDetail2 = "<td align='left' width='50%'>" + aParam[1] + "</td>"; lsDetail2 += "</tr></table>"; lsDetail1 += lsDetail2; Response.Write(lsDetail1); lsDetail1 = ""; lsDetail2 = ""; }saleem2
Member
56 Points
222 Posts
Re: Error :Index was outside the bounds of the array.
Dec 13, 2012 07:45 AM|LINK
Hi oned_gk
I have tried with ur suggestion, now the result page is empty, not showing up anything.
Few days back, I was able to recieve the response from payment gateway, do some backend insertion and finaly display the confirmation message to the user.
The page used to execute fine with no problems of index out of bound issue, but suddenly how it has come now m not getting and where to check.
With some search on web, i found some other ways to resolve where it mentioned that
1. recylicng the application pool.
I have tried that also, but still the same result.
Any other suggestions from anyone would be helpful.
Thanks for your time.
Saleem
saleem2
Member
56 Points
222 Posts
Re: Error :Index was outside the bounds of the array.
Dec 13, 2012 07:50 AM|LINK
Hi All,
I would like to add one more thing here. If i use breakpoint in the response page, it not getting step by step execution. If i am able to debug using step by step execution, then atleast i can have some idea of why it is giving such error.
Thanks,
Saleem
furry
Member
584 Points
108 Posts
Re: Error :Index was outside the bounds of the array.
Dec 13, 2012 08:03 AM|LINK
It seems like you are having wrong value in "DR" [QueryString]
check for the following cases
i) may be some parameter is coming without value (e.g; value1=1&value2=&value3=3), Or
ii) may be some parameter is containing "&" sign in it, like if you are passing name/text in values.
both could break the algo of splitting the values.
oned_gk
All-Star
31820 Points
6510 Posts
Re: Error :Index was outside the bounds of the array.
Dec 13, 2012 08:03 AM|LINK
the problem from here :
string[] aParam = param.Split('=');I dont realy understand what you want with that.
Spilted value not realy splitted.
try
string[] aParam = param.Split("=");make sure you always get aParam[0] and aParam[1]
saleem2
Member
56 Points
222 Posts
Re: Error :Index was outside the bounds of the array.
Dec 13, 2012 08:14 AM|LINK
Hi
Thanks to both of you for replying. i would definitely look into what you both have suggested. Meanwhile I would like to make apoint again that, the same code i ran on server without any problem.
Now if it is giving this error, then is der something wrong from the payment gateway response?. because the code i am using has been provided the payment gateway itself in the integration kit.
please suggest.
Thanks,
Saleem