我正在从UNC路径下载文件,它在本地主机上工作正常,但是当在IIS 7上托管时,它会出现以下错误:
我在MVC中返回文件的行为是:
[ValidateInput(false)]
public FileResult GetFile()
{
Request.ValidateInput();
string fileLocation = ConfigurationManager.AppSettings["UNCPath"];
string fileName = HttpUtility.UrlDecode(Request.QueryString["fileName"]);
string path = Path.Combine(fileLocation, fileName);
string getFileExtension = Path.GetExtension(fileName);
string contentType = MimeTypeMap.GetMimeType(getFileExtension);
return File(path, contentType, fileName);
}
在Web confing中,我有UNCPath,如\ network \ drivef ...