Grid Export Proxy

The path to a server-side script that will receive the contents of an exported file, when local browser save-as functionality is not available. Such browsers are IE8 and IE9.

...
exportOptions: {
    proxy: '/download/proxy',
    excel: {
        fileName: "suigrid.xlsx",
        author: "John Smith"
    }
},
...

An example ASP.NET MVC WebAPI code of the server-side proxy for saving the file is shown below.

public HttpResponseMessage Save([FromBody] SaveData saveData)
{
    var data = Convert.FromBase64String(saveData.Base64Content);
    var contentType = saveData.ContentType;

    // strip the content encoding and other additional headers from the type
    contentType = Regex.Replace(contentType, ";.*$", "", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase);

    var result = new HttpResponseMessage(HttpStatusCode.OK)
    {
        Content = new StreamContent(new MemoryStream(data))
    };

    result.Content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
    if (contentType.Contains("xml"))
    {
        result.Content.Headers.ContentType.CharSet = "UTF-8";
    }

    result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
    {
        FileName = saveData.FileName
    };

    return result;
}