10

I am starting to use the new ASP.NET Web API. When I open a sample service method call using a browser like FF or Chrome, it returns the xml correctly in the browser. However, in Internet Explorer (7-9) it brings up a prompt:

Do you want to open or save read (58 bytes) from [servername]?

When I select Open, it asks which program to open with, and then it will display the xml in that program. I was hoping since the methods accept the GET method that it would just return the results in the browser, however that doesn't seem to be the case with IE. I have run into this sort of issue before with ASP.NET MVC when returning JSON, however I'm not even returning JSON in this case.

How do I tell IE to return the results in the browser like FF and Chrome do?

Justin
  • 17,670
  • 38
  • 132
  • 201

3 Answers3

4

I know it's bit late to post another answer, but it might be helpful to others who are really keen on making IE to show ASP.NET Web API results in it's own window. I tried the solution listed on following SOF thread and it worked for me.

How can I convince IE to simply display application/json rather than offer to download it?

Now Web API results in JSON format are being displayed in my IE window.

Community
  • 1
  • 1
4

I've noticed that too. It is actually returning the results as JSON. To view the result of the call go into the developer tools (F12), then go to Network, click start monitoring and resend your request. You should see the result appear in the trace list. You can then double click it and select View Body to see the response body.

Antony Scott
  • 21,690
  • 12
  • 62
  • 94
0

It is not sort of a big deal. IE does not know how to handle those formats. In chrome, it doesn't view the JSON in a nice way as well. I installed an extension called JSONView on Google Chrome, now I have a nice view.

IMO, don't care about that. For testing purposes, I always use Fiddler which is nicer and your have full control over the request in terms of headers and other stuff.

tugberk
  • 57,477
  • 67
  • 243
  • 335
  • 1
    It is a big deal if you have to support IE – nickbw Jul 06 '14 at 23:01
  • @nickbw do you want your users to view your json output on IE? – tugberk Jul 07 '14 at 08:52
  • I wish they would all use chrome, however some of them use older versions of IE and the only way I have been able to use the json response is by changing the content type to "text/plain", and then parsing the response. – nickbw Jul 18 '14 at 00:57