Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 2.0 / 3.5 / 4.0
Download
lunedì 13 settembre 2010 - 15.53
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
Elenco Tags
VB.NET
|
.NET 3.5
memmo77
Profilo
| Expert
683
messaggi | Data Invio:
lun 13 set 2010 - 15:53
Salve a tutti cercavo di far aprire al click di un bottone la finestra per il download di un file e ho provato questo:
Response.ContentType = ".xls"
Response.AppendHeader("content-disposition", "attachment; filename=nome.xls")
Response.WriteFile(Server.MapPath(Session("vpath_xls") & "nome.xls"))
Response.End()
L'errore che mi restituisce è:
{Valutazione della proprietà non riuscita.}
alx_81
Profilo
| Guru
8.814
messaggi | Data Invio:
lun 13 set 2010 - 20:58
>Salve a tutti cercavo di far aprire al click di un bottone la
>finestra per il download di un file e ho provato questo:
Ciao
>Response.ContentType = ".xls"
>Response.AppendHeader("content-disposition", "attachment; filename=nome.xls")
>Response.WriteFile(Server.MapPath(Session("vpath_xls") & "nome.xls"))
>Response.End()
prova ad utilizzare nel ContentType "application/vnd.ms-excel"
--
Alessandro Alpi | SQL Server MVP
MCP|MCITP|MCTS|MCT
http://www.alessandroalpi.net
http://blogs.dotnethell.it/suxstellino
http://mvp.support.microsoft.com/profile/Alessandro.Alpi
memmo77
Profilo
| Expert
683
messaggi | Data Invio:
mar 14 set 2010 - 09:31
Nulla da fare ho modificato:
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("content-disposition", "attachment; filename=file.xls")
Response.WriteFile(Server.MapPath(Session("vpath_xls") & "file.xls"))
Response.End()
Potrebbe dipendere dal fatto che nella pagina ho uno scriptmanager per gestire ajax?
Grazie
memmo77
Profilo
| Expert
683
messaggi | Data Invio:
mar 14 set 2010 - 09:40
Ho risolto così:
ScriptManager.RegisterStartupScript(Me, Me.GetType, "download", "document.location.href = qs['vpath_xls'] + 'file.xls';", True)
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !