在C#中可以通过OpenFileDialog控件来获取保存文件的路径,在asp.net中怎么来获取啊?
我想保存页面上的数据到文件。

解决方案 »

  1.   

    js:  
      document.execCommand   ("SaveAs",true,"xx.htm");   
      

  2.   

    类似protected void Page_Load(object sender, EventArgs e)
        {
            Response.ClearContent();
            Response.ContentType = "application/octet-stream";
            Response.AddHeader("Content-Disposition", "attachment;FileName=123.txt");
            Response.Write("asdf");
            Response.End();
        }
      

  3.   

    server.mappath找到存放路径
    然后在指定到具体文件夹但这是保存在服务器上的
    你还要下载下来 到本地
      

  4.   

          string path = "../../UploadFiles/shipin/";
            Helper helper = new Helper();
            string strPath = helper.Upload(path, FU2, true, this.Page);
            if (strPath != "")
            {
                hl.Text = strPath;
                hl.NavigateUrl = path + strPath;
            }    public string Upload(string path, HtmlInputFile uploadcrtl, bool isimg, Page page)
        {
            if (IsFile(uploadcrtl, isimg, page))
            {
                FileInfo info = new FileInfo(uploadcrtl.PostedFile.FileName);
                string newname = info.Name;
                if (File.Exists(Server.MapPath(path + newname)))
                {
                    Alert("文件名已存在!请更改文件名后再上传!", page);
                    newname = null;
                }
                else
                {
                    uploadcrtl.PostedFile.SaveAs(Server.MapPath(path + newname));
                    Alert("上传成功!", page);
                }
                return newname;
            }
            else
            { return null; }
        }
      

  5.   

    用openfilename过度,用openfilepath获得