Given what we all know about the 12030++ problems, what do you think it is about your code that doesn't seem to break IE?
Well, I'm still testing it fervently throwing every machine I have at it with different flavours of IE to see if my theory is right. In the meantime, let me explain what I've found regarding the 12030(et al) errors...
First time I encountered this problem, it wasn't limited to SSL (I am testing a theory with SSL later today).
Like most developers, I hunted around for a cause/solution and found for once the web was sadly lacking, this annoyed me (you have no idea how much) as I've NEVER let a problem beat me before, I've always found either a solution or an acceptable work-around and I was damned i if something as silly as an intermittent error was gonna stop me.
At first, I believed the problem was due to how the page was being addressed, e.g. absolute, relative etc and for a while fixing this cured my problem and so I moved on.
Earlier this week however, a slight change to my application caused this error to rear it's ugly head again and so I decided to investigate the problem in isolation with a view to finding a cure and publishing the code (if any) to help anyone else out there suffering this nuisance.
Back to the drawing board I went, and started a new AJAX Requestor from scratch, testing with various browsers along every step of the way, after reaching a certain point, my old friend 12030 popped up to say hello. This was great, it was just what I'd been waiting for.
I examined the request and response, along with the contents of the data stream being sent to the server (or lack thereof) and discovered several things.
1. The error can be caused by poorly formatted addresses, specifically those addresses that are relative to the current path but don't begin with './'
2. The problem can be reproduced almost 100% if using the POST method (I don't think I saw it once using GET)
3. The frequency of the problem altered if the request header contained different name/value pairs
4. The problem wasn't restricted to a specific version of the MS ActiveX component (in fact IE7 uses a built-in requestor like FF etc)
So my experimenting began, I created a simple test page to fetch the results of the data submitted to the server so they could be compared on the odd occasion the request didn't actually generate an error. This was a very useful exercise because that's how I discovered some subtle differences.
The data being sent to the server (when it actually returned a result) didn't match the data I'd submitted, especially the FORM data (which never arrived) and the HEAD data (which seemed to differ).
A lot of tinkering, investigating and general playing around, after reading various iterations of RFC2616 and several discussions about it, I discovered there were certain REQUIRED header tags to be used for POSTing data - Furthermore, a few optional ones I could also experiment with.
I also found the format of POSTed data was critical, not just the fact it had to conform to the usual URL encoding (assuming this is the method entered in the HEAD) but a simple character out of place when submitting the data could also cause a problem (e.g. the rsulting data looked exactly like a normal QueryString but the big different is, it DOESN'T start with a '?').
Finally, after all the tinkering, playing, reading, experimenting and swearing (12030 was rapidly losing the 'friend' status I gave it earlier) I found a combination that didn't generate any errors.
Knowing I'd been here before, I decided to try and break it by changing the method of addressing used to retrieve the test page. I tried absolute (http://...), nope - it still worked... So I tried relative to the root (/Path/...) that worked too... Grrrr.... So out of desperation I tried a convoluted combination of every type I could think of (something like
http://Host/Path1/.././Path2/./../Path3/File.ext) and even that worked fine...
Ever wanted a problem to occur and it just wouldn't? And so I posted the code here for all to play with, I've tested it with IE, FF, NS, Safari and Opera and so far, no problem. I've tested it with FORM data, QUERY data, both and neither (the requestor changed the method automatically) and so far, it hasn't broken. Today I plan to test it using SSL but I'm fairly confident...
So what is this magical combination?
1. Only use POST if you're actually submitting FORM data (no data but still using POST upsets it, use GET if there's not data or only QUERY data to send).
2. When submitting FORM data, ensure there is no preceding '?' (e.g. ?P1=V1&P2=V2 is wrong, but P1=V1&P2=V2 is fine)
3. If POSTing data, set the HEADer of your request using the following:
Content-Type: application/x-www-form-urlencoded (This should also be set when using the GET method)
Content-Length: (Length of FORM data)
Content-Disposition: form-data; name="YourAppName"
If you set the request HEADer to exactly match the contents of the request being submitted, the ActiveX object submitting the request doesn't seem to get upset and the server happily sees and reads everything you've sent...
So please feel free to have a play with the code I've submitted above and post back results of any experiments, I'd particularly like to hear from anyone who still suffers any 12030 errors etc and the configuration they used to create them, I'll be damned if this little friend of mine is going to beat me... You started the challenge on another thread Perk, I'm simply picking up the gauntlet...