如题,小鸟知道如何保存这些数据,如:
HttpContext.Current.Request.SaveAs("c:\\1.txt",false);
但不知道如何获取这些数据至变量中,请各位高手帮助一下。
(请不要从这个文件中记取,只是直接获取至变量中)

解决方案 »

  1.   


            System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
            string str = sr.ReadToEnd();
            Response.Write(str);
      

  2.   

    楼上方法正确,但获取的字符串是乱码,怎么解决呢?
    我用
       HttpContext.Current.Request.SaveAs("c:\\1.txt",false);

       System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
       string str = sr.ReadToEnd();
      中的str保存至c:\2.txt中,1.txt不是乱码,可是2.txt是乱码,怎么才能解决呢?