예제 #1
0
        protected void saveFile(object sender, EventArgs e)
        {
            string fileName = TextBox1.Text.ToString();

            if (fileName.Length > 25)
            {
                //Response.Redirect(Request.Url.AbsoluteUri);
                Label1.Text = "Not 25 characters.";
            }
            else
            {
                fileName  = fileName.Trim();
                fileName += ".txt";
                string filepath = Server.MapPath("~/Uploads/") + fileName;
                if (File.Exists(filepath))
                {
                    File.Delete(filepath);
                }
                try
                {
                    using (FileStream fs = File.OpenWrite(filepath))
                    {
                        Byte[] info = new UTF8Encoding(true).GetBytes(TextBox2.Text.ToString());
                        fs.Write(info, 0, info.Length);
                    }
                    //Response.Redirect(Request.Url.AbsoluteUri);
                    loadTeacherFileGrid();
                }
                catch (Exception RIOT)
                {
                    Label1.Text = RIOT.ToString();
                }
            }
        }
예제 #2
0
 public void transitions(RIOT host)
 {
 }