Opensearch firefox suggestions with ASP.NET MVC C#
After a long while looking for a solution on the Internet and over here, here is my problem, hopefully you would be able to help me:

I am creating a searchtool plugin for firefox for my web application, built with Asp.NET MVC C#. The plugin is currently working except for the list of suggestions. To be able to show suggestions, the plugin is meant to receive a Json array from the website where the search occurs. The XML configuration file of the plugin for the suggestions is :

    <Url type="application/x-suggestions+json" method="GET" template="http://localhost:49597/Suggests">
    	<Param name="search" value="{searchTerms}"/>

The **Suggests** method of the web application returns a Json array in the format requested by the plugin for it to be read, which is :

    ["o",["one","occasion","admin login","administration"]]

Here is the method :

    public JsonResult Suggests(String search)
    {
        List<String> listResultat = new List<String>();
        List<Object> list2= new List<Object>();

// Whole code retrieving data from the database

        list2.Add(search);
        list2.Add(listResultat.Distinct());

        return this.Json(list2.Distinct(), JsonRequestBehavior.AllowGet);
    }

**search** being the parameter from the URL.

When I try getting the Json through the URL http://localhost:49597/Suggests?search=o, it asks me to download the file. The file content is actually right and the text is correctly formatted.
I tried adding parameters to the Json return such as Encoding or "application/json" but in vain. I also tried using ActionResult instead of JsonResult, still the same.

I tried looking closer with Fiddler and actually how the plugin interacts with the website, it seems the call to the method Suggests works, the Json is generated and contains the right data but for some reason, the plugin doesn't show it. I'm missing of something and can't figure out what..

    //Request headers
        GET /Suggests?search=o HTTP/1.1
        Accept: text/html, application/xhtml+xml, */*
        Accept-Language: en-GB
        User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
        Accept-Encoding: gzip, deflate
        Connection: Keep-Alive
        Host: localhost:49597
        Cookie: bookmark1=10559

    //Response headers
        HTTP/1.1 200 OK
        Server: ASP.NET Development Server/9.0.0.0
        Date: Thu, 04 Aug 2011 10:48:07 GMT
        X-AspNet-Version: 2.0.50727
        X-AspNetMvc-Version: 2.0
        Cache-Control: private
        Content-Type: application/json; charset=utf-8
        Content-Length: 5
        Connection: Close


Thank you for your ideas and help,

Rene
Opensearch firefox suggestions with ASP.NET MVC C#
===

After a long while looking for a solution on the Internet and over here, here is my problem, hopefully you would be able to help me:

I am creating a searchtool plugin for firefox for my web application, built with Asp.NET MVC C#. The plugin is currently working except for the list of suggestions. To be able to show suggestions, the plugin is meant to receive a Json array from the website where the search occurs. The XML configuration file of the plugin for the suggestions is :

    <Url type="application/x-suggestions+json" method="GET" template="http://localhost:49597/Suggests">
    	<Param name="search" value="{searchTerms}"/>

The **Suggests** method of the web application returns a Json array in the format requested by the plugin for it to be read, which is :

    ["o",["one","occasion","admin login","administration"]]

Here is the method :

    public JsonResult Suggests(String search)
    {
        List<String> listResultat = new List<String>();
        List<Object> list2= new List<Object>();

// Whole code retrieving data from the database

        list2.Add(search);
        list2.Add(listResultat.Distinct());

        return this.Json(list2.Distinct(), JsonRequestBehavior.AllowGet);
    }

**search** being the parameter from the URL.

When I try getting the Json through the URL http://localhost:49597/Suggests?search=o, it asks me to download the file. The file content is actually right and the text is correctly formatted.
I tried adding parameters to the Json return such as Encoding or "application/json" but in vain. I also tried using ActionResult instead of JsonResult, still the same.

I tried looking closer with Fiddler and actually how the plugin interacts with the website, it seems the call to the method Suggests works, the Json is generated and contains the right data but for some reason, the plugin doesn't show it. I'm missing of something and can't figure out what..

    //Request headers
        GET /Suggests?search=o HTTP/1.1
        Accept: text/html, application/xhtml+xml, */*
        Accept-Language: en-GB
        User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
        Accept-Encoding: gzip, deflate
        Connection: Keep-Alive
        Host: localhost:49597
        Cookie: bookmark1=10559

    //Response headers
        HTTP/1.1 200 OK
        Server: ASP.NET Development Server/9.0.0.0
        Date: Thu, 04 Aug 2011 10:48:07 GMT
        X-AspNet-Version: 2.0.50727
        X-AspNetMvc-Version: 2.0
        Cache-Control: private
        Content-Type: application/json; charset=utf-8
        Content-Length: 5
        Connection: Close


Thank you for your ideas and help,

Rene