I have a website that works perfectly under built-for specification but with the increased use of SIM card dongles I’ve (I won’t be the first to be pulling his hair out over this) encountered a site-killing issue... (ok ok ok... a days’ work perhaps)
When the mobile provider gets a request for a file it's passed through a very clever application which essentially strips it down to 'just' functional. This is returned and the file works as expected even though it has been modified slightly (or heavily in the case of images).
The clever software which does this re-writes the request header also, which is causing the serialiser to ignore the response as it's not of the correct content type... I think anyway.
normal request : Content-Type application/json; charset=utf-8 SIM proxy request : Content-Type text/xml; charset=utf-8
issue number one with this is the request requires a verb in the web.config enabling GET/POST (easy added)
issue number two with this, the GET request is built like so www.site.com?a.asmx/function?value="a value" the JSON serialiser understand this is a string type so it removes the appended quotation marks and accepts the parameter, when the serialiser isn't used it will actually add more quotation marks "\"a value\"". (Easy fixed)开发者_开发问答
Issue number three the return value is XML and not JSON. Requires allot of work but can be fixed should i not be able to find another way.
I've just been reading the W3 for the HTTP header 'Cache-Control' and apparently I can send 'no-transform' and (assuming they conform) the proxy will ignore it. That would be fantastic.
Question is... How do I change the header value of a GET request via Sys.Net.WebServiceProxy.invoke()?
Also has any one any experience with this? the internet reveals little discussion on the topic.
Many Thanks in advance of any responses and sorry for the wall of text for a one line question... just fingers crossed someone has encountered this before.
There is one work around.
Edit the file where Sys.Net.WebServiceProxy.invoke
function is kept.
and put following line :
request.get_headers()['Cache-Control'] = 'no-transform';
after
var request = new Sys.Net.WebRequest();
精彩评论