哪为大哥有asp.net下载的源代码(vb)?
小弟找了好久,没有一个有用的。希望大家给我提示,小弟刚刚学习asp.net

解决方案 »

  1.   

    用c#的
    fstring = 文件名
    string path=Server.MapPath("./")+"/xmwd/"+fstring; System.IO.FileInfo file = new System.IO.FileInfo(path); 
    Response.Clear(); 
    Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(file.Name)); 
    Response.AddHeader("Content-Length", file.Length.ToString()); 
    Response.ContentType = "application/octet-stream"; 
    Response.WriteFile(file.FullName); 
    Response.End(); 
    return;
      

  2.   

    绝对能用的 vb代码的下载程序<%@ import namespace="system.io"%>
    <script language="vb" runat="server">
    Sub page_load(sender As Object,e As eventargs)Dim path As String = "e:\web1\tan.mdb"
            Dim fileName As String
            fileName = System.IO.Path.GetFileName(path)
            Response.Write(fileName)
            Response.AddHeader("content-disposition", "attachment; filename=" & fileName & "")
            Dim objStream As Stream
            objStream = File.OpenRead(path)
            Dim fileLength As Integer
            fileLength = objStream.Length
            Dim fileDate(fileLength) As Byte
            objStream.Read(fileDate, 0, fileLength)
            Response.BinaryWrite(fileDate)End Sub</script>
    <html>
    <body>
    dddddd
    </body>
    </html>
      

  3.   

    nmlvjun(网事如风) 
      你好:你的代码不能用出错.能给个整体的好吗?