|
Simple request FAILS after 6.5.5.1 to 6.7.20.1 update -- Mich --
I have a method that performs an HTTPWebRequest and returns the Response to my AJAX JS function. Worked flawlessly using 6.5.5.1. But when I try to use 6.7.20.1, I get a res.error of "Input String is not the Correct Format". I am passing the URI and Querystring params in the initial Callback and processing those through the VB method. It appears that these param strings have changed somehow. Did something change in how these strings are passed to the Server Side methods? NOTE: When I revert back to 6.5.5.1, everything is fine again. VB excerpt: <AjaxPro.AjaxMethod()> _ Public Function MagicSubmit(ByVal uri As String, ByVal pstdata As String) As String Dim context As HttpContext = HttpContext.Current Dim request As HttpRequest = context.Request Dim str As String Dim siteURI As New Uri(uri) Dim lcUrl As String = uri Dim loHttp As HttpWebRequest = CType(WebRequest.Create(lcUrl), HttpWebRequest) loHttp.Timeout = 600000 If ((context.Request.QueryString("OUTSD")) <> "Y") Then Dim cookieCols As New HttpCookieCollection loHttp.CookieContainer = New CookieContainer() cookieCols = request.Cookies For Each str In cookieCols Dim hCook = request.Cookies(str) Dim cookie As Cookie = New Cookie(hCook.Name, hCook.Value, hCook.Path) loHttp.CookieContainer.Add(siteURI, cookie) Next End If Dim lcPostData As String = pstdata loHttp.Method = "POST" Dim lbPostBuffer As Byte() = System.Text.Encoding.GetEncoding(1252).GetBytes(lcPostData) loHttp.ContentLength = lbPostBuffer.Length Dim loPostData As Stream = loHttp.GetRequestStream() loPostData.Write(lbPostBuffer, 0, lbPostBuffer.Length) loPostData.Close() Dim loWebResponse As HttpWebResponse = CType(loHttp.GetResponse(), HttpWebResponse) Dim enc As Encoding = System.Text.Encoding.GetEncoding(1252) Dim loResponseStream As StreamReader = New StreamReader(loWebResponse.GetResponseStream(), enc) Dim lcHtml As String = loResponseStream.ReadToEnd() loWebResponse.Close() loResponseStream.Close() Return lcHtml End Function My Javascript: function dotnetcallback(x){ x.value == null || x.error != null ? alert(x.error.Message + '\n' + x.error.Name + '\n' + x.error.Description): onDownloadDone(x.value.trim()); alert(x.value); } function CallNow(path, args) AjaxPro.timeoutPeriod=600*1000; MagicCall.Magictools.Submits.MagicSubmit(path, args , dotnetcallback); } I then pass: path= http://mysite/myprg args= PARAM1=Val1&PARAM2=Val2&Etc=Etc The VB method builds the URI and the post data from these arguments and performs the webrequest. As I said, it has worked GREAT with 6.5.5.1. Any ideas? TIA, Ken Krickbaum |
|
-- Mich --
In addition, I have discovered that the response is being generated correctly. So, my original assumption that the incoming string params are changed is WRONG! It appears that the problem is when the "Return lcHtml" returns the Large String back to the CB JS function for processing. Any help is appreciated. TIA, Ken |
|
-- Mich --
OK, I have figured out that it seems to be in the string that is returned. I sometimes have special chars includded and they are not returning to the JS function correctly. Example Return: UpdateField('PURCHTRADENUMBER','123460000201'); UpdateField('PURCHNAME','KEN KRICKBAUM'); UpdateField('PURCHCONTACT','KEN JAY'); UpdateField('PURCHSTATUS','Active'); UpdateField('PURCHAVAIL','6565.84'); CallMag('INTPostCashFees1','-AS,TotCash,TotCredits,TotOut,Purchaser,-A,-N,PayType'); <!--UpdateField('',' ');--> The above block must come back EXACTLY as shown (line feeds and all). Don't ask me why, it is a VERY, VERY long story. Anyway, why would 6.5.5.1 handle this return string just fine, but not the lastest version? Thanks, Ken |
|
-- Mich --
Wow, yep, another update: The part of the string that is causing the problem is: ' ' So, my previous question still stands. Why? |
|
-- Mich --
Ok, simplified. I have determined the cause of my problem, but still don't know WHY! I have some funky chars in my return string. The returned string is from another DLL that I have no control over. In 6.5.5.1, the entire string would return as the DLL provided it (funky chars and all). Now, in 6.7.20.1, it BOMBS with a res.error.MEssage of "Input String is not the Correct Format". When I dupe the return value and remove these chars, then all is fine. However, I cannot do this "on the fly" as there are many variations and combinations of these screwed up chars. It would be nice if the Callback return value would simply PASS back the entire string REGARDLESS of what is in it (like 6.5.5.1 did) Am I missing something here? Thanks, Ken |
|
-- Mich --
FOUND IT!!! The NAK char (0x15 dec:21 oct:25 = Negative acknowledge) This char WILL BLOW A METHOD OUT OF THE WATER! At least with my methods. Now, I an replacing the bad char before returning using a regex (\u0015) with BLANK! Works fine now, as far as I can tell. Still weird though why the change from 6.5.5.1 not burping at all at this NAK. Ken |