当下载时就会出现这样的错:
The page cannot be displayedCannot find server or DNS Error
Internet Explorer

解决方案 »

  1.   

    我在XP下面下载的一个6M大的文件,就可以;
    当我到2003下载时就不行了,是不是有限制大小,或者象上传文件一样可以对WebConfig进行配置呢?:我又试了在2003上把文件改小点发现就可以下载!请高手指教!
      

  2.   

    具体应该是这样的,我的一个WEB网页在XP下对要下载的文件进行了Response.Write(path)时可以成功,但把它放到2003下面就不行,可是把文件改小点又可以.
      

  3.   

    还是用切分法了.
    public static void DownLoadtoClient(string _path,System.Web.UI.Page _page)
    { System.IO.Stream iStream = null; // Buffer to read 10K bytes in chunk:
    byte[] buffer = new Byte[10000]; // Length of the file:
    int length; // Total bytes to read:
    long dataToRead; // Identify the file to download including its path.
    string filepath  = _path;
    try
    {
    if(File.Exists(_path)) {
    // Open the file.
    iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open,
    System.IO.FileAccess.Read,System.IO.FileShare.Read);
    // Total bytes to read:
    dataToRead = iStream.Length; _page.Response.ContentType = "application/octet-stream";
    _page.Response.AddHeader("Content-Disposition", "attachment; filename=" + CExcelManager.GetFileName());
    _page.Response.AppendHeader("Content-Length",dataToRead.ToString());
    // Read the bytes.
    while (dataToRead > 0) {
    // Verify that the client is connected.
    if (_page.Response.IsClientConnected) {
    // Read the data in buffer.
    length = iStream.Read(buffer, 0, 10000); // Write the data to the current output stream.
    _page.Response.OutputStream.Write(buffer, 0, length); // Flush the data to the HTML output.
    _page.Response.Flush(); buffer= new Byte[10000];
    dataToRead = dataToRead - length;
    }
    else {
    //prevent infinite loop if user disconnects
    dataToRead = -1;
    }
    }
    }
    }
    catch (Exception ex)
    {
    // Trap the error, if any.
    _page.Response.Write("Error : " + ex.Message);
    }
    finally
    {
    if (iStream != null)
    {
    //Close the file.
    iStream.Close();
    }
    }