protected void btnExamLMS_ServerClick(object sender, EventArgs e) { //rwm_message.RadAlert("سامانه در حال آماده سازی میباشد.", null, 100, "پیام", ""); //return; bool linkIsActive; if (ConfigurationManager.AppSettings["ExamLinkActive"] == null || string.IsNullOrEmpty(ConfigurationManager.AppSettings["ExamLinkActive"].ToString()) || !bool.TryParse(ConfigurationManager.AppSettings["ExamLinkActive"].ToString(), out linkIsActive) || !linkIsActive) { rwm_message.RadAlert("لطفا در زمان مقرر مراجعه فرمایید", null, 100, "پیام", ""); } else { ExamBusiness ExamBusiness = new ExamBusiness(); SHA256 mySHA256 = SHA256Managed.Create(); var profInfo = ExamBusiness.GetProfessorInfoByProfessorCode(Session[sessionNames.userID_StudentOstad].ToString()); if (profInfo.Rows.Count > 0) { var key = mySHA256.ComputeHash(Encoding.ASCII.GetBytes(ConfigurationManager.AppSettings["ExamLinkKey"].ToString())); var IV = string.IsNullOrEmpty(ConfigurationManager.AppSettings["ExamLinkIV"].ToString()) ? new byte[16] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } : Encoding.ASCII.GetBytes(ConfigurationManager.AppSettings["ExamLinkIV"].ToString()); var url = ConfigurationManager.AppSettings["ExamLink"].ToString(); var token = EncryptionClass.EncryptAES256(Session[sessionNames.userID_StudentOstad].ToString() + ";" + profInfo.Rows[0]["idd_meli"].ToString() + ";" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"), key, IV); var script = "var form = document.createElement('form'); form.setAttribute('style', 'display: none;'); var tokenField = document.createElement('input'); form.method = 'POST'; form.action = '" + url + "';"; script += "tokenField.value='" + token + "'; tokenField.name='token'; form.appendChild(tokenField); document.body.appendChild(form); form.submit();"; ScriptManager.RegisterStartupScript(this, GetType(), "submitform", script, true); } } }