user1968030
user1968030

Reputation:

Return XSLT in mvc.net

I want return XSLT format in mvc what is the mime type for this?

 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;
        }
    } 

Upvotes: 0

Views: 173

Answers (2)

tpeczek
tpeczek

Reputation: 24125

You can use text/xsl for that purpose:

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;
    }
} 

Upvotes: 0

Tomalak
Tomalak

Reputation: 338326

The File helper's signature is

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

This should be enough info to answer your question.

Upvotes: 1

Related Questions