List<string> list = new List<string>(); Random rand = new Random(); for (int i = 0; i < 1000; i++) { string Vchar = "0,1,2,3,4,,C,D,E,F,G,H,I,5,6,7,8,9,A,BJ,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"; string[] VcArray = Vchar.Split(','); string checkCode = string.Empty; for (int j = 0; j < 4; j++) { int t = rand.Next(1, 34); checkCode += VcArray[t]; } string m =checkCode.ToLower()+ FW.Common.Utility.GetRandomNum(3) + checkCode.ToLower() + "163.com"; list.Add(m); //Response.Write(m+"\n"); } this.Response.ContentType = "text/csv"; this.Response.ContentEncoding = Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.Expires = 0; Response.AddHeader("content-disposition", "attachment; filename=coupon" + DateTime.Now.ToString("yyyyMMddHHmm") + ".csv"); this.Response.Write("商品编号,评价人帐号,评价标题,评价内容,商品评价星,配送评价星,客服评价星,评价时间\n"); foreach (string coupon in list) { this.Response.Write(","+coupon + "\n"); }