.net可以实现点击按钮时自动创建文件侠,然后下载某文件到该文件侠里?
不知道可不可以???
我想要的是在用户不知情的情况下点击按钮就自动执行了,不要弹出提示保存下载文件对话窗。
如果可以,得怎么做呢??

解决方案 »

  1.   


    Imports System
    Imports System.IO
    Imports Microsoft.VisualBasicPublic Class Test
        Public Shared Sub Main()
            ' Specify the directory you want to manipulate. 
            Dim path As String = "c:\MyDir"         Try 
                ' Determine whether the directory exists. 
                If Directory.Exists(path) Then
                    Console.WriteLine("That path exists already.")
                    Return 
                End If             ' Try to create the directory. 
                Dim di As DirectoryInfo = Directory.CreateDirectory(path)
                Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(path))            ' Delete the directory.
                di.Delete()
                Console.WriteLine("The directory was deleted successfully.")        Catch e As Exception
                Console.WriteLine("The process failed: {0}.", e.ToString())
            End Try 
        End Sub 
    End Class
      

  2.   

    asp.net??其实我也想啊,我很想建一个web页面让一个在银行工作的哥们看看,然后偷偷滴不带下载提示给他硬盘上塞点东西
      

  3.   

    哈哈。是啊。如果web可以偷偷的下载东西,那恐怕这款浏览器早被淘汰了。本身web就没这个操作本地的权限。这个不安全。元芳,你怎么看?
      

  4.   

    using Microsoft.VisualBasic;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Diagnostics;
    using System.IO;public class Test
    {
    public static void Main()
    {
    // Specify the directory you want to manipulate. 
    string path = "c:\\MyDir"; try {
    // Determine whether the directory exists. 
    if (Directory.Exists(path)) {
    Console.WriteLine("That path exists already.");
    return;
    } // Try to create the directory. 
    DirectoryInfo di = Directory.CreateDirectory(path);
    Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); // Delete the directory.
    di.Delete();
    Console.WriteLine("The directory was deleted successfully."); } catch (Exception e) {
    Console.WriteLine("The process failed: {0}.", e.ToString());
    }
    }
    }