0

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

2 Answers 2

1

The File helper's signature is

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

This should be enough info to answer your question.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.