1using System;
2using System.Collections;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Web;
7using System.Web.SessionState;
8using System.Web.UI;
9using System.Web.UI.WebControls;
10using System.Web.UI.HtmlControls;
11using System.IO;
12namespace UploadFile
13{
14 /// <summary>
15 /// Summary description for WebForm1.
16 /// </summary>
17 public partial class UploadPage : System.Web.UI.Page
18 {
19 private void Page_Load(object sender, System.EventArgs e)
20 {
21 try
22 {
23 string strXML = Request.QueryString["DefXML"];
24
25 string strFolder = "C:\\UploadFiles\\";
26 if (!System.IO.Directory.Exists(strFolder))
27 {
28 System.IO.Directory.CreateDirectory(strFolder);
29 }
30 string strFileName = strFolder + DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + ".xml";
31 FileStream fs = new System.IO.FileStream(strFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
32 StreamWriter sw = new System.IO.StreamWriter(fs);
33 sw.WriteLine(strXML);
34 sw.Flush();
35 sw.Close();
36 fs.Close();
37 Response.Write(strXML + "! File Save OK!");
38 }
39 catch (Exception ex)
40 {
41 Response.Write(ex.Message);
42 }
43 // Put user code to initialize the page here
44 }
45
46 // #region Web Form Designer generated code
47 //override protected void OnInit(EventArgs e)
48 // {
49 // //
50 // // CODEGEN: This call is required by the ASP.NET Web Form Designer.
51 // //
52 // InitializeComponent();
53 // base.OnInit(e);
54 // }
55
56 // /// <summary>
57 // /// Required method for Designer support - do not modify
58 // /// the contents of this method with the code editor.
59 // /// </summary>
60 // private void InitializeComponent()
61 // {
62 // this.Load += new System.EventHandler(this.Page_Load);
63 // }
64 // #endregion
65 }
66}
67