Ciao a tutti !
ho questo problema con un link in una pagina index.asp
questo è il link
richiamo un file asp che mi crea un file csv correttamente e me lo salva sul server. il problema è che quel link dalla pagina index.asp mi restituisce al browser il file asp csv.asp vuoto e non il file corretto. come posso risolvere?
e questo è il contenuto di csv.asp
codice:
giorno=day(date)
mese=month(date)
anno=year(date)
ambito="vicidial"
nomefile=""&giorno&""&""&mese&""&""&anno&""&"-"&ambito&""
nome = ""&nomefile&".csv"
public function IsEmail(strEmail)
Dim objRegExp
Set objRegExp = New RegExp
objRegExp.Pattern = "^[a-z0-9._-]+\@[a-z0-9._-]+\.[a-z0-9]{2,4}$"
objRegExp.IgnoreCase = True
IsEmail = objRegExp.Test(strEmail)
end function
strXls = chr(34) & "ID" & chr(34) & ","
strXls = strXls & chr(34) & "codice_cliente" & chr(34) & ","
strXls = strXls & chr(34) & "numero_contratto" & chr(34) & ","
strXls = strXls & chr(34) & "email" & chr(34) & "," & VbCrlf
Set conn = Server.CreateObject("ADODB.Connection")
sql = "select id, codice_cliente, numero_contratto, email from tracciato where not isnull(email) ORDER BY id DESC"
dsnpath = "DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)}; "
dsnpath = dsnpath & "DBQ=" & server.mappath("/database/provvisorio.mdb")
conn.open dsnpath
Set rs = Server.CreateObject("ADODB.Recordset")
Set Rs=Conn.Execute(SQL)
Do Until RS.EOF
if rs("email")<>"" then
if IsEmail(rs("email")) then
strXls = strXls & chr(34) & Rs("ID") & chr(34) & ","
strXls = strXls & chr(34) & Rs("codice_cliente") & chr(34) & ","
strXls = strXls & chr(34) & Rs("numero_contratto") & chr(34) & ","
strXls = strXls & chr(34) & Rs("email") & chr(34) & "," & VbCrlf
end if
end if
rs.MoveNext
loop
set rs = Nothing
conn.Close
Set conn = Nothing
path = ("/client-a/csv/")
completo = path & nome
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.CreateTextFile(server.mappath(completo))
file.WriteLine(strXls)
file.Close
Set file = Nothing
Set fso = Nothing
perchè non mi invia il file csv al browser?