EDN Admin
Well-known member
Can some body please show me how to download a file from a button_click event and when the file has finished downloading to transfer to another web page. vb.net
e.g
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff <font size="2" color="#0000ff
Dim
</font></font><font size="2" color="#0000ff
</font>
<span style="font-size:x-small myFilepath <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small String<span style="font-size:x-small =
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "c:ClientsCL592australiapos.com.auPublic_htmldownloadsSAMSAM.msi"
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Dim<span style="font-size:x-small myFileName
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small String<span style="font-size:x-small =
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "SAM.msi"
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Try
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Dim<span style="font-size:x-small file
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small System.IO.FileInfo =
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small New<span style="font-size:x-small System.IO.FileInfo(myFilepath)
Response.Clear()
<span style="font-size:x-small <font size="2
Response.ContentType =
</font>
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "application/x-msi"
<span style="font-size:x-small <font size="2
Response.AddHeader(
</font>
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "Content-Disposition"<span style="font-size:x-small ,
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "attachment; filename="<span style="font-size:x-small & file.Name)<font size="2
Response.AddHeader(
</font>
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "Content-Length"<span style="font-size:x-small , file.Length.ToString())
<span style="font-size:x-small
Response.WriteFile(file.FullName)
<span style="font-size:x-small when done transfer to another web page<font size="2
</font>
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Catch<span style="font-size:x-small ex
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small Exception
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Try
View the full article
e.g
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff <font size="2" color="#0000ff
Dim
</font></font><font size="2" color="#0000ff
</font>
<span style="font-size:x-small myFilepath <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small String<span style="font-size:x-small =
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "c:ClientsCL592australiapos.com.auPublic_htmldownloadsSAMSAM.msi"
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Dim<span style="font-size:x-small myFileName
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small String<span style="font-size:x-small =
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "SAM.msi"
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Try
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Dim<span style="font-size:x-small file
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small System.IO.FileInfo =
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small New<span style="font-size:x-small System.IO.FileInfo(myFilepath)
Response.Clear()
<span style="font-size:x-small <font size="2
Response.ContentType =
</font>
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "application/x-msi"
<span style="font-size:x-small <font size="2
Response.AddHeader(
</font>
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "Content-Disposition"<span style="font-size:x-small ,
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "attachment; filename="<span style="font-size:x-small & file.Name)<font size="2
Response.AddHeader(
</font>
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "Content-Length"<span style="font-size:x-small , file.Length.ToString())
<span style="font-size:x-small
Response.WriteFile(file.FullName)
<span style="font-size:x-small when done transfer to another web page<font size="2
</font>
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Catch<span style="font-size:x-small ex
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small Exception
<span style="font-size:x-small <font size="2
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Try
View the full article