ASP.NET MVC アプリケーションでのアクションのダウンロードに問題があり、開発マシンでは問題なく動作しますが、アプリケーションを IIS に発行するとき、またはテスト サーバーからテストするとき、エラーも例外もありません。ページの下部に「witing for localhost...」という白いウィンドウしかありません
私のコントローラーアクション
public ActionResult DownloadDocument(int idDocument)
{
try
{
DocumentVM Document = ServiceApplicatif.getDocumentById(idDocument);
//Get document from virtual path
string FileName = ServiceFileUtilities.GetFileById(Document.StreamId);
DownloadResult drs = new DownloadResult //it's a file and it works
{
RootPath = rootDocuments, //rootDocuments is a path to filetable
ContentLength = Document.Length,
ContentType = Document.MimeType,
FileDownloadName = FileName,
FileName = FileName
};
return drs;
}
catch (Exception ex)
{
throw new Exception("Erreur : " + ex.message.toString());
}
}
私の見解は単純です
<button onclick="myFunction()">Click me</button>
そして私のJQuery関数
function myFunction() {
var pageURL = url; //url with idDocument which is right
OpenPopupCenter(url, 'myWin', 600, 800);
}
function OpenPopupCenter(pageURL, title, w, h) {
var left = (screen.width - w) / 2;
var top = (screen.height - h) / 4; // for 25% - devide by 4 | for 33% - devide by 3
var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no,adressbar=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
targetWin.document.title = "Document";
}