{"id":89,"date":"2013-04-04T07:27:14","date_gmt":"2013-04-04T07:27:14","guid":{"rendered":"http:\/\/blog.chen-hongyi.com\/?p=89"},"modified":"2013-04-04T08:23:38","modified_gmt":"2013-04-04T08:23:38","slug":"getting-json-from-asp-net","status":"publish","type":"post","link":"https:\/\/chen-hongyi.com\/?p=89","title":{"rendered":"Getting JSON from  ASP.Net"},"content":{"rendered":"<p>1. The chef said, I should use a normal aspx to solve this task, and write sth, like reponse.write(&#8220;accpeti encoding : txt\/json&#8221;), it is ugly. Please read this atricle from Johnny Code (<a title=\"Open in new window\" href=\"http:\/\/johnnycode.com\/2012\/07\/16\/getting-json-from-asp-net-beautiful-good-bad-ugly\/\" target=\"_blank\">http:\/\/johnnycode.com\/2012\/07\/16\/getting-json-from-asp-net-beautiful-good-bad-ugly\/)<\/a>. Why it is ugly.<\/p>\n<p>2 by defualt .net response only to POST Request and return XML. as wrapper. You should add the following http header in your request.<\/p>\n<p>Content-Type: application\/json; charset=utf-8<\/p>\n<p>An end the chef want to sue handler to solve the URL rewrite problme, show me some code in web.config to define a handler.<br \/>\nI found this article about add handler in web.config <a title=\"Link\" href=\"http:\/\/www.yongfa365.com\/Item\/configuration-configSections-SingleTagSectionHandler-DictionarySectionHandler-NameValueSectionHandler.html\">(http:\/\/www.yongfa365.com\/Item\/configuration-configSections-SingleTagSectionHandler-DictionarySectionHandler-NameValueSectionHandler.html)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. The chef said, I should use a normal  &hellip; <a href=\"https:\/\/chen-hongyi.com\/?p=89\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[27],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-asp-net-webservice-handler-web-config"],"_links":{"self":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=89"}],"version-history":[{"count":2,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions"}],"predecessor-version":[{"id":94,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions\/94"}],"wp:attachment":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}