<% ' test adf: redirect per poter generare le statistiche su ebook riferiti esternamente 'response.write request.querystring("file") dim UA_GA,UA_GA2 if instr(Request.ServerVariables("HTTP_host"),"172.16.7") <> 0 then '## sviluppo UA_GA = "UA-2681749-24" UA_GA2 = "" else '## produzione su AISM UA_GA = "UA-3470040-22" UA_GA2 = "UA-21928504-1" end if 'Response.Write "UA_GA=" & UA_GA 'Response.End %> <% 'if (HttpContext.Current.User.Identity.Name <> "") then %> <% 'end if %> <% Dim fso,strPDF,urlPdf dim file,myFile,AnomeFile,nomeFile file = Request.QueryString("file") 'strPDF = server.MapPath("/") & "\manager\UploadFile\2\SS2\" & file strPDF = server.MapPath("/") & file AnomeFile = split(file,"/") nomeFile = AnomeFile(ubound(AnomeFile)) 'Response.Write "strPDF=" & strPDF & "
" 'Response.Write "nomeFile=" & nomeFile 'Response.End urlPdf = "http://" & Request.ServerVariables("http_host") & file Set fso = CreateObject("Scripting.FileSystemObject") 'Response.Write strPDF & "
" '##################################################### '## controllo se file esiste if fso.FileExists(strPDF) then 'Response.Write strPDF & "
" Set myFile = fso.GetFile(strPDF) dim fileSize,estensione fileSize = myFile.size estensione = fso.GetExtensionName(strPDF) 'Response.Write strPDF & "
" 'Response.Write "HTTP_REFERER=" & Request.ServerVariables("HTTP_REFERER") & "
" 'Response.Write "file esiste" & "
" 'Response.Write "fileSize=" & fileSize & "
" 'Response.Write "estensione=" & estensione & "
" 'Response.End '##################################################### '## controllo HTTP_REFERER <> www.aism.it if instr(Request.ServerVariables("HTTP_REFERER"),"www.aism.it")=0 then 'if instr(Request.ServerVariables("HTTP_REFERER"),"172.16.7.36")=0 then '##################################################### '## simulo CLICK sul file %> <% else%> <%end if '## FINE controllo HTTP_REFERER = www.aism.it %> <% '##################################################### '## APRO il File if Request.QueryString("open")=1 then '##################################################### '## carico file con BinaryWrite Response.Clear Set oFileStream = Server.CreateObject("ADODB.Stream") oFileStream.Open oFileStream.Type = 1 'Binary oFileStream.LoadFromFile strPDF 'Server.ScriptTimeout = 18000 'Session.Timeout=30 Response.Buffer = true '##################################################### '## imposto mime type secondo estensione file select case lcase(estensione) case "pdf" Response.contenttype = "application/pdf" case "epub" Response.contenttype = "application/epub+zip" case "mobi" Response.contenttype = "application/x-mobipocket-ebook" case "doc" Response.contenttype = "application/msword" case "txt" Response.contenttype = "text/html" case "rtf" Response.contenttype = "application/rtf" case "xls" Response.contenttype = "application/ms-excel" case "zip" Response.contenttype = "application/zip" case "rar" Response.contenttype = "application/rar" 'case "jpg" ' Response.contenttype = "image/jpeg" 'case "gif" ' Response.contenttype = "image/gif" 'case "png" ' Response.contenttype = "image/png" case else Response.contenttype = "application/pdf" end select Response.AddHeader "Content-Disposition", "inline; filename=" + nomeFile Response.AddHeader "Accept-Header", fileSize Response.BinaryWrite(oFileStream.Read) Response.Flush 'Response.End response.Clear 'Response.Charset = null oFileStream.Close Set oFileStream= Nothing end if end if '## FINE controllo se file esiste %>