'This opens the download dialoge box and allows the user'
        'to download the excel sheet from the server'
        Response.Clear()
        Response.ContentType = "application/octet-stream"
        Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
        Response.Flush()
        'This command actually transfers the file'
        Response.WriteFile(FileAndPath)

解决方案 »

  1.   

    Marguess(留侯) :
    不知写的什么咚咚,WebForm方面我不懂,我可能现在也用不上呀,类似于瑞星下载方式,
      

  2.   

    用WebClient一个一个的上传Example
    [Visual Basic, C#, C++] The following example uploads the specified file to the specified URI using UploadFile. Any response returned by the server is displayed on the console.[Visual Basic] 
    Console.Write(ControlChars.Cr + "Please enter the URI to post data to : ")
    Dim uriString As String = Console.ReadLine()' Create a new WebClient instance.
    Dim myWebClient As New WebClient()Console.WriteLine(ControlChars.Cr + "Please enter the fully qualified path of the file to be uploaded to the URI")
    Dim fileName As String = Console.ReadLine()
    Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString)' Upload the file to the URI.
    ' The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method. 
    Dim responseArray As Byte() = myWebClient.UploadFile(uriString, fileName)' Decode and display the response.
    Console.WriteLine(ControlChars.Cr + "Response Received.The contents of the file uploaded are: " + ControlChars.Cr + "{0}", Encoding.ASCII.GetString(responseArray))[C#] 
    Console.Write("\nPlease enter the URI to post data to : ");
    String uriString = Console.ReadLine();// Create a new WebClient instance.
    WebClient myWebClient = new WebClient();Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
    string fileName = Console.ReadLine();
    Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);                        
    // Upload the file to the URI.
             // The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method.
    byte[] responseArray = myWebClient.UploadFile(uriString,fileName);// Decode and display the response.
    Console.WriteLine("\nResponse Received.The contents of the file uploaded are: \n{0}",Encoding.ASCII.GetString(responseArray));[C++] 
    Console::Write(S"\nPlease enter the URI to post data to : ");
    String*  uriString = Console::ReadLine();// Create a new WebClient instance.
    WebClient* myWebClient = new WebClient();Console::WriteLine(S"\nPlease enter the fully qualified path of the file to be uploaded to the URI");
    String* fileName = Console::ReadLine();
    Console::WriteLine(S"Uploading {0} to {1} ...", fileName, uriString);
    // Upload the file to the URI.
    // The 'UploadFile(uriString, fileName)' method implicitly uses HTTP POST method.
    Byte responseArray[] = myWebClient->UploadFile(uriString, fileName);// Decode and display the response.
    Console::WriteLine(S"\nResponse Received::The contents of the file uploaded are: \n {0}", Encoding::ASCII->GetString(responseArray));[Visual Basic, C#, C++]
      

  3.   

    注意你的主机上将被上传至的文件夹必须有write权限
      

  4.   

    http://msdn.microsoft.com/msdnmag/code03.aspx
    上有例子
      

  5.   

    Sunmast(速马) :
    你弄错了把
    我这里不需要上传
      

  6.   

    我有现成的实现方式,涉及到.net 的反射、文件下载、Xml等技术,
    具体为:
            1.用.net提供的WebClient等类实现对服务端的访问
            2.用客户端和服务端的两个Xml文件分别记录两端相同文件的版本等信息
            3.利用反射得到组件版本等信息,比较C/S两端的组件版本,需要的话,则
              将服务端对应的版本动态下载到本地,覆盖旧文件。
    msn:[email protected]
      

  7.   

    服务器端读取本地端一个目录下的所有文件,如何把这些文件打包(不打包也可以)方便地向客户端发送!客户端接收到后保存到某一个路径,并检测完整性(若打包如何自动解包)? 类似于瑞星杀毒软件,我看到有很多方式,Ftp,TcpListener,stream,Socket,我现在是一头雾水
    也不知用那种方式最好?,很多的概念,我晕菜,
    关键经理让我年前做完,5551。客户下载服务器端最新文件
    2。保存到客户端本地目录
    3。检测完整性
    4。自动补丁升级
    5。覆盖原有旧文件
    6。检测服务器Sql数据库表,与本地端mdb数据库表内容比较,有差异,客户端升级(怎么传数据库数据到客户端升级)
      

  8.   

    各位听清楚了,他是C/S模式的,请不要把XML上的注释往上贴哦。
      

  9.   

    6。检测服务器Sql数据库表,与本地端mdb数据库表内容比较,有差异,客户端升级(怎么传数据库数据到客户端升级)用程序自动执行服务器上的SQL脚本