我想把我的旧mvc5项目移到mvc6.
旧代码是:
旧代码是:
public string ContentType { get { if (!string.IsNullOrEmpty(FileName)) return MimeMapping.GetMimeMapping(FileName); return null; } }
错误是
The name ‘MimeMapping’ does not exist in the current context
解决方法
以下代码应该工作:
string contentType; new FileExtensionContentTypeProvider().TryGetContentType(FileName,out contentType); return contentType ?? "application/octet-stream";
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。