예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    s_id  = Request.QueryString["id"];
            DataTable table = new bll.SjxxBLL().GetSjxxById(s_id);

            if (table.Count() >= 0)
            {
                string s_url  = table.Rows[0]["url"].AsString();
                string s_path = MapPath(s_url);

                System.IO.FileInfo fi = new System.IO.FileInfo(s_path);
                Response.Clear();
                Response.ClearHeaders();
                Response.Buffer = false;
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(s_path), System.Text.Encoding.UTF8));
                Response.AppendHeader("Content-Length", fi.Length.ToString());
                Response.ContentType = "application/octet-stream";
                Response.WriteFile(s_path);
                Response.Flush();
                Response.End();
            }
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     WebData.CurrentMenu = "修改试卷";
     if (!IsPostBack)
     {
         string s_id = Request.QueryString["id"];
         if (!string.IsNullOrEmpty(s_id))
         {
             DataTable table = new bll.SjxxBLL().GetSjxxById(s_id);
             if (table.Count() > 0)
             {
                 id.Text = table.Rows[0]["id"].AsString();
                 mc.Text = table.Rows[0]["mc"].AsString();
                 lb.Text = table.Rows[0]["lb"].AsString();
                 sm.Text = table.Rows[0]["sm"].AsString();
             }
             else
             {
                 Response.Write("<script>alert('试卷信息不存在!');window.location.href='Sjxx.aspx';</script>");
             }
         }
     }
 }