0

我想在 mvc 中返回 XSLT 格式,这个 mime 类型是什么?

 public FileResult DownloadTemplate(string templateCode)
    {
        try
        {
            var template = _manager.GetTemplateByCode(templateCode);
            const string fileName = "Template";
            return File(template.Value, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
        }
        catch (Exception ex)
        {
            return null;
        }
    } 
4

2 回答 2

1

助手的File签名是

FileContentResult File(byte[] fileContents, string contentType, string fileDownloadName)

这应该足以回答您的问题。

于 2013-01-15T08:06:45.900 回答
0

您可以text/xsl为此目的使用:

public FileResult DownloadTemplate(string templateCode)
{
    try
    {
        var template = _manager.GetTemplateByCode(templateCode);
        const string fileName = "Template";
        return File(template.Value, "text/xsl", fileName);
    }
    catch (Exception ex)
    {
        return null;
    }
} 
于 2013-01-15T08:12:11.587 回答