For certain characters when putting in query string parameters they need to be URL encoded or they will cause problem to the web service.
I faced this problem with the # character, encoding it and use %23 instead solved the problem.
An archive of solutions of programming problems I have faced in my career
For certain characters when putting in query string parameters they need to be URL encoded or they will cause problem to the web service.
I faced this problem with the # character, encoding it and use %23 instead solved the problem.
Today while testing the Ext JS application I was writing on various browsers, something strange happened. The app works on IE and Chrome, while on Firefox it breaks.
It turns out if not configured correctly WebAPI will return data depending on the Accept HTTP header sent by browsers, and different browsers sent different HTTP Accept header.
More details in the SO answer: http://stackoverflow.com/a/31934984
Firefox prefers XML, so Web API try to serialize data in XML format to return to Firefox.
IE and Chrome doesn’t prefer one over other, so Web API chooses Json.
I solved this issue in Firefox by configuring the web api to always return JSON by adding the following line to WebApiConfig.cs
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(“text/html”));
The default behaviour of Ext JS proxy ajax writer seems to be to always use POST. Whenever trying to create/update/delete a record, a JSON object will be sent to the server in the request payload through POST.
It might be possible to configure the proxy and writer to use other HTTP methods like PUT and DELETE, but I haven’t seen any documentation on this yet.
The Id field is always included. So there are 3 cases
If the server is written in ASP.NET Web API, it’s important to read the request body and process it manually instead of using a parameter in the method and let the framework do the deserialization automatically, because then it will not be possible to count the number of properties the object original has, the deserialized object has all properties with default values for missing ones.
This issue occurred today while I was trying to run an Ext JS application from IIS, because .json files are not accepted by IIS I tried to add this file extension to the application. But instead I got a 500 error when trying to browse the application.
After some digging and searching the MIME types section of the website and all other applications, I couldn’t find the conflicting extension.
I was able to solve the issue by editing the application’s web.config file, right before the mimeMap tag, add a remove tag like following:
<staticContent>
<remove fileExtension=“.json“/>
<mimeMap fileExtension=“.json“ mimeType=“application/json“ />
</staticContent>
I still have no idea why this works, but it works.
Web API 2 runs on .NET 4.5 and above. That’s the difference.
Not entirely sure why, but when using ajax proxies, specifying the URL is not enough, the data won’t be displayed on lists/panels.
A reader must also be defined in the proxy, otherwise the data will not be read correctly
proxy: {
type: ‘ajax’,
url: ‘data.json’,
reader:{
type:’json’,
rootProperty: ‘DATA’
}
}
Make sure that
Today I learned how Jsonp work, it basically makes use of HTML’s script tag to retrieve the JSON data from a different domain/origin.
The returned data is in the form of func({…}) where func is any function that can be defined before hand in the client. A script element will be added to the DOM that loads the data and execute it like any normal JavaScript file. Since there is no restriction imposed in the script element, it can load from any server in different domains/ports, unlike Ajax.
Basically it’s a hack. More details in the Stackoverflow answer: http://stackoverflow.com/a/2887218/5539403
I faced this problem today after installing sencha cmd. Even after adding the path to sencha cmd to the user environment path variable, trying to run it from the command line showed only an empty line.
After a while I managed to resolve the problem by adding the path to the system PATH environment variable.
If the app was generated using Sencha Cmd without specializing either option ‘–classic’ or ‘–modern’, the app will be generated with both and the views will be in both folders ‘classic’ and ‘modern’
When I encountered this issue, it was because of the grid panel. According to this Stackoverflow answer http://stackoverflow.com/a/21740832/5539403 it is because the grid panel tries to shrink-wrap its content but there was no content at the time the layout run is executed.
I fixed it by setting the width of the grid panel somehow.