예제 #1
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Candidate_pros pros     = new Candidate_pros();
        string         fileName = Label3.Text;

        if (!fileName.Contains("."))
        {
            return;
        }
        string tempPath = System.IO.Path.GetTempPath();
        string dpath    = tempPath + "\\" + fileName;

        byte[] data = pros.get_cer(candidate, "cv");
        string ex   = Path.GetExtension(fileName);


        Response.Buffer = true;

        if (ex.Equals(".pdf"))
        {
            Response.ContentType = "application/PDF";
        }
        else
        {
            Response.ContentType = "application/vnd.ms-word";
        }
        Response.BinaryWrite(data);
    }
예제 #2
0
    protected void ImageButton13_Click(object sender, ImageClickEventArgs e)
    {
        Candidate_pros pros     = new Candidate_pros();
        string         fileName = Label9.Text;

        if (!fileName.Contains("."))
        {
            return;
        }
        //     string tempPath = System.IO.Path.GetTempPath();
        //   string dpath = tempPath + "\\" + fileName;
        byte[] data = pros.get_cer(Session["user"].ToString().TrimEnd(), "cer3");
        string ex   = Path.GetExtension(fileName);


        Response.Buffer = true;

        if (ex.Equals(".pdf"))
        {
            Response.ContentType = "application/PDF";
        }
        else
        {
            Response.ContentType = "vnd.openxmlformats-officedocument.wordprocessingml.document ";
        }
        Response.BinaryWrite(data);
    }
예제 #3
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Candidate_pros pros     = new Candidate_pros();
        string         fileName = Label3.Text;

        if (!fileName.Contains("."))
        {
            return;
        }
        byte[] data = pros.get_cer(Session["user"].ToString().TrimEnd(), "cv");
        string ex   = Path.GetExtension(fileName);


        Response.Buffer = true;

        if (ex.Equals(".pdf"))
        {
            Response.ContentType = "application/PDF";
        }
        else
        {
            Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document ";
        }
        Response.BinaryWrite(data);
        Response.End();

        //using (System.IO.FileStream fs = new System.IO.FileStream(dpath, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite))
        //{
        //    using (System.IO.BinaryWriter bw = new System.IO.BinaryWriter(fs))
        //        {
        //            bw.Write(data);
        //            bw.Close();
        //        }

        //}
        //System.Diagnostics.Process.Start(dpath);
    }