Piccolo tutorial su come permettere il download di un file salvato nel server.
creare una web form chiamata "download.aspx" ed incollare questo codice:
Dalle vostre web form richiamate questa pagina in questo modo:codice:Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim filepath As String = Request.Params("file") If Not filepath Is Nothing Then If File.Exists(filepath) Then Dim filename As String = Path.GetFileName(filepath) Response.Clear() Response.ContentType = "application/octet-stream" Response.AddHeader("Content-Disposition", _ "attachment; filename=""" & filename & """") Response.Flush() Response.WriteFile(filepath) End If End If End Sub
oppurecodice:<a href="download.aspx?file=c:\percorso\file.estenzione">
L'ho testato con il service pack 2 di Win XP e funziona.codice:Response.Redirect("download.aspx?file=c:\percorso\file.estenzione")
Se trovate bug ditelo.
Fonte
Ciao ciao!


					
					
					
						
  Rispondi quotando
						
 ma non voglio diventare un servericida recidivo 
 come si può fare a non suicidare il server? 
 
 
