void Application_BeginRequest(object sender, EventArgs e) { Common.Common.WriteLogToFile("Start Method", System.Reflection.MethodBase.GetCurrentMethod()); //Added parameters in header for security HttpContext.Current.Response.AddHeader("x-frame-options", "SAMEORIGIN"); //Set this value to 90 days in seconds HttpContext.Current.Response.AddHeader("Strict-Transport-Security", "max-age=7776000"); //To avoid Cross site scripting HttpContext.Current.Response.AddHeader("X-Content-Type-Options", "nosniff"); HttpContext.Current.Response.AddHeader("X-XSS-Protection", "1;mode=block"); //Remove the extra information send in Response Header HttpContext.Current.Response.Headers.Remove("Server"); HttpContext.Current.Response.Headers.Remove("X-AspNetMvc-Version"); HttpContext.Current.Response.Headers.Remove("X-AspNet-Version"); //Set the paramter for not cashing the data on client side //HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); #region Changes for Rewriting the Request URL with encrypted query string //Add URL encoding only in Release mode if (!HttpContext.Current.IsDebuggingEnabled) { HttpContext context = HttpContext.Current; var objContextWrapper = new HttpContextWrapper(Context); InsiderTrading.Common.Common objCommon = new InsiderTrading.Common.Common(); if (!objContextWrapper.Request.IsAjaxRequest()) { Common.Common.WriteLogToFile("Ajax request condition", System.Reflection.MethodBase.GetCurrentMethod()); if (context.Request.RawUrl.Contains("?")) { string query = ExtractQuery(context.Request.RawUrl); string path = GetVirtualPath(); DataSecurity objDataSecurity = new DataSecurity(); string sStartStringPart = query.Substring(0, 3); Common.Common.WriteLogToFile("Raw url content ? ", System.Reflection.MethodBase.GetCurrentMethod()); if (objCommon.CheckIfStringIsCorrect(sStartStringPart)) { // Decrypts the query string and rewrites the path. string rawQuery = query.Replace(sStartStringPart, string.Empty); string decryptedQuery = ""; try { decryptedQuery = objDataSecurity.DecryptData(HttpUtility.UrlDecode(rawQuery)); } catch (Exception exp) { Common.Common.WriteLogToFile("Exception occurred ", System.Reflection.MethodBase.GetCurrentMethod(), exp); } context.RewritePath(path, string.Empty, decryptedQuery); } else if (context.Request.HttpMethod == "GET") { if (context.Request.RawUrl.Contains("elmah.axd") == false) { // Encrypt the query string and redirects to the encrypted URL. // Remove if you don't want all query strings to be encrypted automatically. string encryptedQuery = ""; string sStartString = objCommon.getRandomString(); try { encryptedQuery = "?" + sStartString + HttpUtility.UrlEncode(objDataSecurity.EncryptData(query)); } catch (Exception exp) { Common.Common.WriteLogToFile("Exception occurred ", System.Reflection.MethodBase.GetCurrentMethod(), exp); } context.Response.Redirect(path + encryptedQuery, false); } } } } else { Common.Common.WriteLogToFile("HTTP request condition", System.Reflection.MethodBase.GetCurrentMethod()); if (context.Request.RawUrl.Contains("?")) { string query = ExtractQuery(context.Request.RawUrl); string path = GetVirtualPath(); DataSecurity objDataSecurity = new DataSecurity(); string sStartStringPart = query.Substring(0, 3); Common.Common.WriteLogToFile("Raw url content ? ", System.Reflection.MethodBase.GetCurrentMethod()); if (objCommon.CheckIfStringIsCorrect(sStartStringPart)) { // Decrypts the query string and rewrites the path. string rawQuery = query.Replace(sStartStringPart, string.Empty); string decryptedQuery = ""; try { decryptedQuery = objDataSecurity.DecryptData(HttpUtility.UrlDecode(rawQuery)); } catch (Exception exp) { Common.Common.WriteLogToFile("Exception occurred ", System.Reflection.MethodBase.GetCurrentMethod(), exp); } context.RewritePath(path, string.Empty, decryptedQuery); } } } } #endregion Changes for Rewriting the Request URL with encrypted query string Common.Common.WriteLogToFile("End Method", System.Reflection.MethodBase.GetCurrentMethod()); }
/// <summary> /// /// </summary> /// <param name="m_objRecipient"></param> /// <param name="m_objobjConfigurationModel"></param> /// <param name="o_enBroadcastResponseCode"></param> /// <param name="o_sBroadcastResponseMessage"></param> /// <returns></returns> public bool SendMail(Recipient m_objRecipient, ConfigurationModel m_objobjConfigurationModel, out int o_enBroadcastResponseCode, out string o_sBroadcastResponseMessage) { #region Variables bool bReturn = false; string[] sSeprator = { "," }; string[] arrAttachment = null; string[] arrAttachment1 = null; string i_sAttachmentFiles = ""; StringBuilder o_sSystemAdminPassword = new StringBuilder(); string sAdminEmailAccPassword = ""; string sSendEmailConfig = ""; string sLiveServiceConfig = ""; string sTestingUserEmailAddress = ""; MailMessage objMailMessage = new MailMessage(); o_enBroadcastResponseCode = 0;; o_sBroadcastResponseMessage = string.Empty; bool bAttachmentError = false; string sAttachedProblemFileName = ""; #endregion Variables try { WindowServiceCommon.WriteErrorLog("INFO: ================================================================================================"); WindowServiceCommon.WriteErrorLog("INFO: Enter in Send Mail function..."); sSendEmailConfig = ConfigurationManager.AppSettings.Get(InsiderTrading_NotificationService.WindowServiceConstEnum.AppSettingsKey.SendEmails); sLiveServiceConfig = ConfigurationManager.AppSettings.Get(InsiderTrading_NotificationService.WindowServiceConstEnum.AppSettingsKey.LiveService); sTestingUserEmailAddress = ConfigurationManager.AppSettings.Get(InsiderTrading_NotificationService.WindowServiceConstEnum.AppSettingsKey.TestingUserEmailAddress); sAdminEmailAccPassword = ConfigurationManager.AppSettings.Get(InsiderTrading_NotificationService.WindowServiceConstEnum.AppSettingsKey.SMTPSystemAdminPassword); //SMTP credintional. SmtpClient objSmtpClient = new SmtpClient(m_objobjConfigurationModel.SmtpServer); // SmtpClient objSmtpClient = new SmtpClient("smtp.mail.yahoo.com");//"smtp.gmail.com"); objSmtpClient.Timeout = int.MaxValue;//(60 * 5 * 1000); objSmtpClient.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings.Get(InsiderTrading_NotificationService.WindowServiceConstEnum.AppSettingsKey.EnableSsl)); WindowServiceCommon.WriteErrorLog("INFO: EnableSsl :-" + objSmtpClient.EnableSsl); objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; objSmtpClient.UseDefaultCredentials = Convert.ToBoolean(ConfigurationManager.AppSettings.Get(InsiderTrading_NotificationService.WindowServiceConstEnum.AppSettingsKey.UseDefaultCredentials)); WindowServiceCommon.WriteErrorLog("INFO: UseDefaultCredentials :-" + objSmtpClient.UseDefaultCredentials); //objSmtpClient.Port = 587; using (DataSecurity ds = new DataSecurity()) { m_objobjConfigurationModel.SmtpPassword = ds.DecryptData(m_objobjConfigurationModel.SmtpPassword);; } if (m_objobjConfigurationModel.SmtpUserName != null && m_objobjConfigurationModel.SmtpUserName != "" && m_objobjConfigurationModel.SmtpPassword != null && m_objobjConfigurationModel.SmtpPassword != "") { // Decrypt System Admin Password which encrypted in App.confif file. // DecryptPassword(sSystemAdminPassword, out o_sSystemAdminPassword); WindowServiceCommon.WriteErrorLog("INFO: SMTP User :-" + m_objobjConfigurationModel.SmtpUserName); objSmtpClient.Credentials = new NetworkCredential(m_objobjConfigurationModel.SmtpUserName, m_objobjConfigurationModel.SmtpPassword); } else { objSmtpClient.Credentials = null; } if (m_objobjConfigurationModel.SmtpPortNumber != null && m_objobjConfigurationModel.SmtpPortNumber != "") { objSmtpClient.Port = Convert.ToInt32(m_objobjConfigurationModel.SmtpPortNumber); WindowServiceCommon.WriteErrorLog("INFO: SMTP Port Number : -" + m_objobjConfigurationModel.SmtpPortNumber); } else { WindowServiceCommon.WriteErrorLog("INFO: Default SMTP Port Number is used...."); } objMailMessage.IsBodyHtml = true; // From Address if (m_objRecipient.CommunicationFrom != null && m_objRecipient.CommunicationFrom != "")//m_objobjConfigurationModel.SmtpUserName != null && m_objobjConfigurationModel.SmtpUserName != "") { WindowServiceCommon.WriteErrorLog("INFO: Email From Adress :-" + m_objRecipient.CommunicationFrom); objMailMessage.From = new MailAddress(m_objRecipient.CommunicationFrom); } else { objMailMessage.From = new MailAddress(m_objobjConfigurationModel.SmtpUserName); } // To Address if (sLiveServiceConfig == "true") { objMailMessage.To.Add(m_objRecipient.EmailAddress); WindowServiceCommon.WriteErrorLog("INFO: Send Live EMail Address : -" + m_objRecipient.EmailAddress); } else { objMailMessage.To.Add(sTestingUserEmailAddress); WindowServiceCommon.WriteErrorLog("INFO: Send Test EMail Address : -" + sTestingUserEmailAddress); } //send attch file //i_sAttachmentFiles = "C:\\Users\\lankesh.zade\\Desktop\\Insider Trading_List of issues 18-Jun-15.xlsx"; if (m_objRecipient.DocumentPath != null && m_objRecipient.DocumentPath != "") { arrAttachment = m_objRecipient.DocumentPath.Split(sSeprator, StringSplitOptions.None); arrAttachment1 = m_objRecipient.DocumentName.Split(sSeprator, StringSplitOptions.None); for (int nCount = 0; nCount < arrAttachment.Length; nCount++) { if (File.Exists(arrAttachment[nCount])) { Attachment objAttachment = new Attachment(arrAttachment[nCount]); objAttachment.Name = arrAttachment1[nCount]; // objAttachment.ContentType.MediaType.All objMailMessage.Attachments.Add(objAttachment); } else { bAttachmentError = true; if (sAttachedProblemFileName == "") { sAttachedProblemFileName = arrAttachment1[nCount]; } else { sAttachedProblemFileName = sAttachedProblemFileName + ", " + arrAttachment1[nCount]; } } } } // FileStream fs = new FileStream(i_sAttachmentFiles, FileMode.Open, FileAccess.Read); // Attachment objAttachment = new Attachment(i_sAttachmentFiles); /* byte[] bytes = File.ReadAllBytes(i_sAttachmentFiles); * MemoryStream memAttachment = new MemoryStream(bytes); * Attachment attachment = new Attachment(memAttachment, "Insider Trading_List of issues 18-Jun-15.xlsx"); * attachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable; * objMailMessage.Attachments.Add(attachment);*/ // objMailMessage.Attachments.Add(new Attachment(fs, "Screenshot_1 (2).jpg", MediaTypeNames.Application.Octet)); objMailMessage.Subject = m_objRecipient.EmailSubject.Trim(); string sBody = ""; if (m_objRecipient.Signature != null) { sBody = m_objRecipient.EmailBody.Replace(@"\r\n", "<br/>") + "<br/><br/><br/>" + m_objRecipient.Signature.Replace(@"\r\n", "<br/>"); } else { sBody = m_objRecipient.EmailBody.Replace(@"\r\n", "<br/>"); } objMailMessage.Body = sBody; WindowServiceCommon.WriteErrorLog("INFO: Body : -" + sBody); if (sSendEmailConfig == "true") { WindowServiceCommon.WriteErrorLog("INFO: Send Mail Flag True "); if (sBody == null && sBody == "") { o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); o_sBroadcastResponseMessage = Convert.ToString(WindowServiceConstEnum.BroadcastErrorMessages.EmptyEmailBody); } else if (m_objRecipient.EmailSubject == null && m_objRecipient.EmailSubject == "") { o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); o_sBroadcastResponseMessage = Convert.ToString(WindowServiceConstEnum.BroadcastErrorMessages.EmptySubjectLine); } else if (m_objRecipient.EmailAddress == null && m_objRecipient.EmailAddress == "") { o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); o_sBroadcastResponseMessage = Convert.ToString(WindowServiceConstEnum.BroadcastErrorMessages.NoEmailAddress) + m_objRecipient.NotificationQueueID; } else if (bAttachmentError) { o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); o_sBroadcastResponseMessage = "Email Attachement Problem for File Name:-" + sAttachedProblemFileName; } else { o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseSuccess); o_sBroadcastResponseMessage = ""; } //send mail. if (sBody != null && sBody != "" && m_objRecipient.EmailSubject != null && m_objRecipient.EmailSubject != "" && m_objRecipient.EmailAddress != null && m_objRecipient.EmailAddress != "" && !bAttachmentError) { WindowServiceCommon.WriteErrorLog("INFO: Call Send Mail"); objSmtpClient.Send(objMailMessage); // memAttachment.Close(); WindowServiceCommon.WriteErrorLog("INFO: Send Mail Successfully"); } else { o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); } } //cleanup. objMailMessage.Dispose(); m_objRecipient = null; WindowServiceCommon.WriteErrorLog("INFO: Exit in Send Mail function..."); WindowServiceCommon.WriteErrorLog("INFO: ================================================================================================"); bReturn = true; } catch (System.Net.Mail.SmtpFailedRecipientsException exp) { WindowServiceCommon.WriteErrorLog("Eroor Occured While Sending Mail " + MethodBase.GetCurrentMethod() + exp.Message); o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); o_sBroadcastResponseMessage = exp.InnerException + " : " + exp.Message; } catch (System.Net.Mail.SmtpException exp) { bReturn = false; WindowServiceCommon.WriteErrorLog("Eroor Occured While Sending Mail " + MethodBase.GetCurrentMethod() + exp.Message); o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); o_sBroadcastResponseMessage = exp.InnerException + " : " + exp.Message; } catch (Exception exp) { bReturn = false; WindowServiceCommon.WriteErrorLog("ERROR: " + MethodBase.GetCurrentMethod() + " " + exp.Message); o_enBroadcastResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseError); o_sBroadcastResponseMessage = exp.InnerException + " : " + exp.Message; } return(bReturn); }
/// <summary> /// /// </summary> /// <returns></returns> public bool broadCast() { bool bReturn = false; string sEmailServiceForCompanies = ""; try { WindowServiceCommon.WriteErrorLog("INFO : Enter broadCast fuction.........."); sEmailServiceForCompanies = ConfigurationManager.AppSettings.Get(InsiderTrading_NotificationService.WindowServiceConstEnum.AppSettingsKey.EmailServiceForCompanies); string [] splitCompanyName = sEmailServiceForCompanies.Split(','); EmailNotificationSL objEmailNotificationSL = new EmailNotificationSL(); string dbConnectionString = InsiderTrading_NotificationService.WindowServiceCommon.getSystemConnectionString(); WindowServiceCommon.WriteErrorLog("INFO: Connection string : -" + dbConnectionString); IEnumerable <InsiderTradingDAL.CompanyIDListDTO> lstCompanyIDListDTO = objEmailNotificationSL.GetCompanyIds(dbConnectionString); foreach (var item in lstCompanyIDListDTO) { WindowServiceCommon.WriteErrorLog("INFO: Company ID is : - " + item.CompanyId + " Company Name:- " + item.CompanyName); if (ContainsString(splitCompanyName, item.ConnectionDatabaseName)) { WindowServiceCommon.WriteErrorLog("INFO: If Company Exists in Config Company ID is : - " + item.CompanyId + " Company Name:- " + item.CompanyName); DataTable tblNotificationQueueResponse = new DataTable("NotificationQueueResponse"); tblNotificationQueueResponse.Columns.Add(new DataColumn("RowId", typeof(int))); tblNotificationQueueResponse.Columns.Add(new DataColumn("NotificationQueueId", typeof(int))); tblNotificationQueueResponse.Columns.Add(new DataColumn("CompanyIdentifierCodeId", typeof(int))); tblNotificationQueueResponse.Columns.Add(new DataColumn("ResponseStatusCodeId", typeof(int))); tblNotificationQueueResponse.Columns.Add(new DataColumn("ResponseMessage", typeof(string))); IEnumerable <InsiderTradingDAL.CompanyDetailsForNotificationDTO> lstCompanyDetailsForNotificationDTO = objEmailNotificationSL.GetCompanyDetailsForNotification(dbConnectionString, item.CompanyId); if (lstCompanyDetailsForNotificationDTO != null) { CompanyDetailsForNotificationDTO objCompanyDetailsForNotificationDTO = lstCompanyDetailsForNotificationDTO.FirstOrDefault(); if (objCompanyDetailsForNotificationDTO != null) { WindowServiceCommon.WriteErrorLog("INFO: Fetching Company Details SMTP :- " + objCompanyDetailsForNotificationDTO.SmtpServer); WindowServiceCommon.WriteErrorLog("INFO: Fetching Company Details User :- " + objCompanyDetailsForNotificationDTO.SmtpUserName); ConfigurationModel objConfigurationModel = new ConfigurationModel(); objConfigurationModel.SmtpServer = objCompanyDetailsForNotificationDTO.SmtpServer; objConfigurationModel.SmtpUserName = objCompanyDetailsForNotificationDTO.SmtpUserName; objConfigurationModel.SmtpPortNumber = objCompanyDetailsForNotificationDTO.SmtpPortNumber; //objConfigurationModel.SmtpPassword = objCompanyDetailsForNotificationDTO.SmtpPassword; using (DataSecurity ds = new DataSecurity()) { objConfigurationModel.SmtpPassword = ds.DecryptData(objCompanyDetailsForNotificationDTO.SmtpPassword);; } IEnumerable <InsiderTradingDAL.NotificationSendListDTO> lstNotificationSendListDTO = objEmailNotificationSL.GetNotificationSendList(dbConnectionString, item.CompanyId); WindowServiceCommon.WriteErrorLog("INFO: Fetch Notification Send List"); if (lstNotificationSendListDTO != null) { WindowServiceCommon.WriteErrorLog("INFO: Record found in Notification Send List"); int nRowIDCount = 1; foreach (var mailPart in lstNotificationSendListDTO) { if (Convert.ToInt32(mailPart.ModeCodeId) == Convert.ToInt32(WindowServiceConstEnum.NotificationType.EmailNotificationType)) { WindowServiceCommon.WriteErrorLog("INFO: Only Email Type Record Select"); DataRow row = tblNotificationQueueResponse.NewRow(); Recipient objRecipient = new Recipient(); objRecipient.EmailAddress = mailPart.UserContactInfo; objRecipient.EmailSubject = mailPart.Subject; objRecipient.EmailBody = mailPart.Contents; objRecipient.Signature = mailPart.Signature; objRecipient.DocumentName = mailPart.DocumentName; objRecipient.DocumentPath = mailPart.DocumentPath; objRecipient.CommunicationFrom = mailPart.CommunicationFrom; WindowServiceCommon.WriteErrorLog("INFO: Mail Sending Details:- " + item.CompanyId + " NotificationQueueId :- " + mailPart.NotificationQueueId); WindowServiceCommon.WriteErrorLog("INFO: Email Address :-" + mailPart.UserContactInfo); WindowServiceCommon.WriteErrorLog("INFO: Subject :- " + mailPart.Subject); WindowServiceCommon.WriteErrorLog("INFO: Email Body:- " + mailPart.Contents); WindowServiceCommon.WriteErrorLog("INFO: Signature: -" + mailPart.Signature); //objRecipient.NotificationQueueID //Add in Datatable row["RowId"] = nRowIDCount; row["NotificationQueueId"] = mailPart.NotificationQueueId; if (mailPart.CompanyIdentifierCodeId != null && mailPart.CompanyIdentifierCodeId > 0) { row["CompanyIdentifierCodeId"] = mailPart.CompanyIdentifierCodeId; } else { row["CompanyIdentifierCodeId"] = DBNull.Value; } int o_nResponseCode = 0; string o_sResponseMessage = ""; WindowServiceCommon.WriteErrorLog("INFO: Call Send Mail Function............"); bool bResult = SendMail(objRecipient, objConfigurationModel, out o_nResponseCode, out o_sResponseMessage); if (o_nResponseCode != null && o_nResponseCode > 0) { row["ResponseStatusCodeId"] = o_nResponseCode; } else { row["ResponseStatusCodeId"] = DBNull.Value; } row["ResponseMessage"] = o_sResponseMessage; tblNotificationQueueResponse.Rows.Add(row); WindowServiceCommon.WriteErrorLog("INFO: Response Code :-" + o_nResponseCode + " Response Message:- " + o_sResponseMessage); } else if (Convert.ToInt32(mailPart.ModeCodeId) == Convert.ToInt32(WindowServiceConstEnum.NotificationType.SMSNotifactionType)) { DataRow row = tblNotificationQueueResponse.NewRow(); WindowServiceCommon.WriteErrorLog("INFO: Only SMS Type Record Select"); row["RowId"] = nRowIDCount; row["NotificationQueueId"] = mailPart.NotificationQueueId; if (mailPart.CompanyIdentifierCodeId != null && mailPart.CompanyIdentifierCodeId > 0) { row["CompanyIdentifierCodeId"] = mailPart.CompanyIdentifierCodeId; } else { row["CompanyIdentifierCodeId"] = DBNull.Value; } int o_nResponseCode = Convert.ToInt32(WindowServiceConstEnum.Code.BroadcastResponseSuccess); string o_sResponseMessage = "SMS Part is remaining...."; //Send Message part is remaining // bool bResult = SendMessage(); if (o_nResponseCode != null && o_nResponseCode > 0) { row["ResponseStatusCodeId"] = o_nResponseCode; } else { row["ResponseStatusCodeId"] = DBNull.Value; } row["ResponseMessage"] = o_sResponseMessage; tblNotificationQueueResponse.Rows.Add(row); } nRowIDCount++; } } } WindowServiceCommon.WriteErrorLog("INFO: Update Response Started for Company ID............" + item.CompanyId); bool bUpdateResponseCode = UpdateResponseCode(dbConnectionString, item.CompanyId, tblNotificationQueueResponse); WindowServiceCommon.WriteErrorLog("INFO: Update Response End for Company ID............" + item.CompanyId); } } } bReturn = true; } catch (Exception exp) { // WindowServiceCommon.WriteErrorLog("Eroor Occured in Send Mail Function " + exp.Message); WindowServiceCommon.WriteErrorLog("ERROR: " + MethodBase.GetCurrentMethod() + " " + exp.Message); bReturn = false; throw exp; } return(bReturn); }
protected void Page_Load(object sender, EventArgs e) { try { objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); Common.Common.WriteLogToFile("Page_Load method called and Got user login details", null); if (Request.QueryString.Count.Equals(0)) { return; } string ReportID = Server.UrlEncode(Request.QueryString["ReportID"]).Replace("%3d", "=").Replace("%2f", "/"); Common.Common.WriteLogToFile("Page_Load :- ReportID " + ReportID, null); switch (ReportID) { case "EJLIsEY9uZo=": RptID = "1"; break; case "b4czFb/7oAQ=": RptID = "2"; break; case "/EFMo9hRx5g=": RptID = "3"; break; //Initial Disclosures Report case "zJIWkTIKWAc=": RptID = "4"; Common.Common.WriteLogToFile("Page_Load :- Initial Disclosures Report " + "RptID " + RptID + " ReportID " + ReportID, null); break; //Continuous Disclosures Report case "M/2BHyNrAc4=": RptID = "5"; break; //Period End Disclosures Report case "h/jfF5gBzZQ=": RptID = "6"; break; //Pre Clearance Report case "0lVrlV/e0rU=": RptID = "7"; break; //Defaulter Report case "P5Mkjyvo+j4=": RptID = "8"; break; // View Error Log Report case "06p6JFH6prI=": RptID = "9"; break; // Download Separation Massupload template case "j/aFOxpM0M8=": RptID = "10"; break; } SetTitleRptName(RptID); List <string> para = new List <string>(); SetParameter(para); Common.Common.WriteLogToFile(" SetParameters set " + "Para 0 :- " + para[0].ToString() + " Para 1 :- " + para[1].ToString(), null); if (IsPostBack) { SSRSReport.SizeToReportContent = true; return; } #region EncryptData & DecryptData using (DataSecurity datasecurity = new DataSecurity()) { UID = datasecurity.DecryptData(ConfigurationManager.AppSettings["SSRS_UID"]); PASS = datasecurity.DecryptData(ConfigurationManager.AppSettings["SSRS_PASS"]); DomainName = datasecurity.DecryptData(ConfigurationManager.AppSettings["SSRS_DomainName"]); Common.Common.WriteLogToFile(" SSRS_UID " + UID + " SSRS_PASS " + PASS + " SSRS_DomainName " + DomainName, null); } #endregion if (!string.IsNullOrEmpty(RptID)) { SSRSReport.ProcessingMode = ProcessingMode.Remote; Common.Common.WriteLogToFile(" ProcessingMode set ", null); SSRSReport.PreRender += (SSRSReportObjects.MyReportViewer_PreRender); Common.Common.WriteLogToFile(" PreRender set ", null); SSRSReport.ServerReport.ReportPath = SSRSReportPath + ReportName; Common.Common.WriteLogToFile(" ReportPath set " + " SSRS Report Path " + SSRSReportPath + " Report Name " + ReportName, null); SSRSReport.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["SSRS_URL"]); Common.Common.WriteLogToFile("Report Server Url set " + SSRSReport.ServerReport.ReportServerUrl, null); SSRSReport.ServerReport.ReportServerCredentials = SSRSReportObjects.MyReportServerCredentials(UID, PASS, DomainName); //Set the credential of Report Server Common.Common.WriteLogToFile("ReportServerCredentials " + " UserID " + UID + " Password " + PASS + " Domain Name " + DomainName, null); SSRSReport.ShowParameterPrompts = true; Common.Common.WriteLogToFile(" ShowParameterPrompts set true ", null); SSRSReport.AsyncRendering = true; Common.Common.WriteLogToFile(" AsyncRendering set true ", null); SSRSReport.ShowPrintButton = true; Common.Common.WriteLogToFile(" ShowPrintButton set true ", null); SSRSReport.ServerReport.SetParameters(SSRSReportObjects.SetParametersToReport(Convert.ToInt32(RptID), SSRSReport, para)); Common.Common.WriteLogToFile(" SetParameters set " + "Para 0 :- " + para[0].ToString() + " Para 1 :- " + para[1].ToString(), null); SSRSReport.ServerReport.DisplayName = TitleName; Common.Common.WriteLogToFile(" DisplayName set ", null); SSRSReport.ServerReport.Refresh(); Common.Common.WriteLogToFile(" Refresh() ", null); } } catch (Exception ex) { Response.Write(ex.Message.ToString()); Common.Common.WriteLogToFile(" Exception occured on Page_Load ", null, ex); } }