In Remote Server Locally .xls file loading and downloading but in IIS deployment .xls file not load

`ExcelDownload.aspx.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Excel = Microsoft.Office.Interop.Excel;
using NPOI.XSSF.UserModel;
using OBLLOANADVANCEModel;
using System.Reflection;
using Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;
using System.Diagnostics;

public partial class Admin_ExcelDownload : BasePage
{
#region reference
public dbCLDataContext dbCL = null;
public OBLLOANADVANCEEntities db = null;
UIUtility oUtility = new UIUtility();

public ProcessedBranch oProcessedBranch = null;

private static Microsoft.Office.Interop.Excel.Workbook mWorkBook;
private static Microsoft.Office.Interop.Excel.Sheets mWorkSheets;
private static Microsoft.Office.Interop.Excel.Worksheet mWSheet1;
private static Microsoft.Office.Interop.Excel.Application oXL;

public XSSFWorkbook wb;
public XSSFSheet sh;

public string qualitativejudge = null;

public int quarter = 0, year = 0;

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (CheckEndSession())
Response.Redirect(“~/admin/AdminDefault.aspx”);

oUtility = new UIUtility();
db = new OBLLOANADVANCEEntities();

        //GenerateTemplate();

var ConbranchList = db.vwConfirmBranches.Where(x => x.IsActive == true).ToList();
var branchList = db.Branch.Where(x => x.IsActive == true).ToList();
var processedBranchList = db.vwProcessedBranch.Where(x => x.IsActive == true).ToList();

oUtility.FillCombo(ddlBranch, “Name”, “BranchCode”, branchList, true, false);

oUtility.FillCombo(ddlCerBranch, “Name”, “BranchCode”, ConbranchList, true, false);
if (ConbranchList.Count>0)

//if (Session["CurrentUserEmployeeID"].ToString() == "01003401458" || Session["CurrentUserEmployeeID"].ToString() == "013013102401" || Session["CurrentUserEmployeeID"].ToString() == "017010703231" || Session["CurrentUserEmployeeID"].ToString() == "011021901937")
lblCertBranch.Text = "CERTIFIED BRANCH" + "(" + ConbranchList.Count.ToString() + "):";

oUtility.FillCombo(ddlBrOpenClose, “Name”, “BranchCode”, branchList, true, false);

oUtility.FillCombo(ddlProcessedBranch, “Name”, “BranchCode”, processedBranchList, true, false);
if (processedBranchList.Count > 0)
lblProcessedBranch.Text = “PROCESSED BRANCH” + “(” + processedBranchList.Count.ToString() + “):”;

btnEnableDisable.Visible = false;
btnOpenClose.Visible = false;
ddlBrOpenClose.Visible = false;

btnDownloadActive.Visible = false;
btnDownloadInActive.Visible = false;

if (Session[“CurrentUserBranchCode”].ToString() != “501”)
{
ddlBranch.Enabled = false;
btnExcelExportCl1.Enabled = false;
btnExportExcel.Enabled = false;
btnExportExcelCl3.Enabled = false;
btnExportExcelCl4.Enabled = false;
btnExportExcelCl5.Enabled = false;
btnClear.Enabled = false;

        }

if (Session[“CurrentUserEmployeeID”].ToString() != “01003401458” && Session[“CurrentUserEmployeeID”].ToString() != “013013102401” && Session[“CurrentUserEmployeeID”].ToString() != “017010703231” && Session[“CurrentUserEmployeeID”].ToString() != “016012403095” && Session[“CurrentUserEmployeeID”].ToString() != “023031905308” && Session[“CurrentUserEmployeeID”].ToString() != “018022103540”)
{
btnClear.Enabled = false;

        }

if (Session[“CurrentUserEmployeeID”].ToString() == “01003401458” || Session[“CurrentUserEmployeeID”].ToString() == “013013102401” || Session[“CurrentUserEmployeeID”].ToString() == “017010703231” || Session[“CurrentUserEmployeeID”].ToString() == “011021901937” || Session[“CurrentUserEmployeeID”].ToString() == “018022103540”)
{

btnEnableDisable.Visible = true;
btnOpenClose.Visible = true;
ddlBrOpenClose.Visible = true;
btnDownloadActive.Visible = true;
btnDownloadInActive.Visible = true;

ddlCerBranch.Enabled = true;
}

dbCL = new dbCLDataContext();

SoftwareConfig objSoftwareConfig=new SoftwareConfig();
objSoftwareConfig = dbCL.SoftwareConfigs.Where(p => p.Type == 1).FirstOrDefault();
if (objSoftwareConfig.IsActive == true)
{
btnDownload.Enabled = true;
}
else
{
btnDownload.Enabled = false;
}

    }
}

protected void btnExportExcel_Click(object sender, EventArgs e)
{
GenerateLoanExcelAndSave();
}

private void GenerateLoanExcelAndSave()
{
oProcessedBranch = new ProcessedBranch();

var branchCode = Session[“CurrentUserBranchCode”].ToString();

    //02-July-2023
    //if (branchCode == "000")

if (branchCode == “501”)
{
branchCode = ddlBranch.SelectedValue.ToString();
}

db = new OBLLOANADVANCEEntities();
try
{

string logText = @”D:IIS_RepositoryIslami Banking CLLoan Classification ReportLogLog.txt”;

List CLLoanDetailList = null;

if (branchCode == “501”)
{
CLLoanDetailList = db.CLLoanDetail.Where(x => x.SB_IsActive == true && x.SB_Amount > 0).OrderBy(x => x.SB_ID).ToList();
}
else
{
CLLoanDetailList = db.CLLoanDetail.Where(x => (x.SB_OBLBranchCode == branchCode) && x.SB_IsActive == true && x.SB_Amount > 0).OrderBy(x => x.SB_ID).ToList();
}

using (StreamWriter sw = new StreamWriter(logText, true))
{
String msg = “Checking Done”;
sw.WriteLine(msg);
}

CLLoanDetailList = CLLoanDetailList.Where(x => x.LoanNature == “1” || x.LoanNature == “2” || x.LoanNature == “3” || x.LoanNature == “14”).ToList();
CLLoanDetailList =
CLLoanDetailList.Where(x => x.LoanCategory == “10” || x.LoanCategory == “8” || x.LoanCategory == “7” || x.LoanCategory == “6” || x.LoanCategory == “11”)
.ToList();

using (StreamWriter sw = new StreamWriter(logText, true))
{
String msg = “Data Load in List”;
sw.WriteLine(msg);
}

string CLExcel_path = @”D:IIS_RepositoryIslami Banking CLLoan Classification ReportCLExcelFileReset Additional Field for CL_” + branchCode + “.xls”;

using (StreamWriter sw = new StreamWriter(logText, true))
{
String msg = “Excel File Location”;
sw.WriteLine(msg);
}

oXL = new Microsoft.Office.Interop.Excel.Application();
oXL.Visible = true;
oXL.DisplayAlerts = false;
mWorkBook = oXL.Workbooks.Open(CLExcel_path, 0, false, 5, “”, “”, false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, “”, true, false, 0, true, false, false);

using (StreamWriter sw = new StreamWriter(logText, true))
{
String msg = “Excel File Open 1”;
sw.WriteLine(msg);
}
//Get all the sheets in the workbook
mWorkSheets = mWorkBook.Worksheets;
//Get the allready exists sheet
mWSheet1 = (Microsoft.Office.Interop.Excel.Worksheet)mWorkSheets.get_Item(“CL-2”);
Microsoft.Office.Interop.Excel.Range range = mWSheet1.UsedRange;

using (StreamWriter sw = new StreamWriter(logText, true))
{
String msg = “Excel File Open 2”;
sw.WriteLine(msg);
}

int rowCount = 1;
int index = 11;
foreach (var CLLoan in CLLoanDetailList)
{

mWSheet1.Cells[rowCount + index, 2] = CLLoan.SB_CustName;
mWSheet1.Cells[rowCount + index, 3] = CLLoan.BorrowerNID;
string loannature = db.OIEnumeration.Where(x => x.Type == 11 && x.Value == CLLoan.LoanNature).FirstOrDefault().Name;
string loanCategory = db.OIEnumeration.Where(x => x.Type == 13 && x.Value == CLLoan.LoanCategory).FirstOrDefault().Name;
mWSheet1.Cells[rowCount + index, 4] = loannature + “-” + loanCategory;
mWSheet1.Cells[rowCount + index, 5] = CLLoan.SB_AccNo;
mWSheet1.Cells[rowCount + index, 6] = CLLoan.FirstSanctionDt != null ? Convert.ToDateTime(CLLoan.FirstSanctionDt).ToString(“MM-dd-yyyy”) : “”;
mWSheet1.Cells[rowCount + index, 7] = CLLoan.LastRenewalRSDLDt != null ? Convert.ToDateTime(CLLoan.LastRenewalRSDLDt).ToString(“MM-dd-yyyy”) : “”;
mWSheet1.Cells[rowCount + index, 8] = CLLoan.LastRenewalRSDLNo;
mWSheet1.Cells[rowCount + index, 9] = CLLoan.FirstSanctionAmt;
mWSheet1.Cells[rowCount + index, 10] = CLLoan.LastReschduleAmt;
mWSheet1.Cells[rowCount + index, 11] = CLLoan.SB_Amount;
mWSheet1.Cells[rowCount + index, 12] = CLLoan.DateOfExpiry != null ? Convert.ToDateTime(CLLoan.DateOfExpiry).ToString(“MM-dd-yyyy”) : “”;
if (CLLoan.QualititiveJudgement != null)
{
qualitativejudge = db.OIEnumeration.First(x => x.Type == 18 && x.Value == CLLoan.QualititiveJudgement).Name.ToString();
mWSheet1.Cells[rowCount + index, 15] = qualitativejudge;
}

String value = “”;
value = CLLoan.FinalClassification != null ? db.OIEnumeration.First(x => x.Type == 18 && x.Value == CLLoan.FinalClassification).Value.ToString() : “”;

mWSheet1.Cells[rowCount + index, 24] = 0;
mWSheet1.Cells[rowCount + index, 25] = 0;
mWSheet1.Cells[rowCount + index, 26] = 0;

if (value == “1”)
mWSheet1.Cells[rowCount + index, 24] = CLLoan.MonthEndIntSusBal;
else if (value == “2”)
mWSheet1.Cells[rowCount + index, 25] = CLLoan.MonthEndIntSusBal;
else
mWSheet1.Cells[rowCount + index, 26] = CLLoan.MonthEndIntSusBal;

mWSheet1.Cells[rowCount + index, 16] = CLLoan.FinalClassification != null && CLLoan.FinalClassification.ToString() != “0” ? db.OIEnumeration.First(x => x.Type == 18 && x.Value == CLLoan.FinalClassification).Name.ToString() : “”;
mWSheet1.Cells[rowCount + index, 17] = CLLoan.ClassificationCriteria != null ? db.OIEnumeration.First(x => x.Type == 19 && x.Value == CLLoan.ClassificationCriteria).Name.ToString() : “”;
mWSheet1.Cells[rowCount + index, 28] = CLLoan.TotalElligSecVal;
mWSheet1.Cells[rowCount + index, 33] = CLLoan.RemarksOnClass + ” ” + CLLoan.AdditionalRemarks;
mWSheet1.Cells[rowCount + index, 34] = CLLoan.LoanCategory != null ? db.OIEnumeration.First(x => x.Type == 13 && x.Value == CLLoan.LoanCategory).Name.ToString() : “”; //Value of Loan Category — Confused
var LoanCatLocal = CLLoan.LoanCategory != null ? db.OIEnumeration.First(x => x.Type == 13 && x.Value == CLLoan.LoanCategory).Name.ToString() : “”;
if (!String.IsNullOrEmpty(LoanCatLocal))
{
if (LoanCatLocal == “SME Finance (SMEF)”)
{
mWSheet1.Cells[rowCount + index, 34] = “SMEF”;
}

else if (LoanCatLocal == “Consumer Finance (CF)”)
{
mWSheet1.Cells[rowCount + index, 34] = “CF”;
}
else if (LoanCatLocal == “Capital MKt (BH-MB-SD)”)
{
mWSheet1.Cells[rowCount + index, 34] = “BHs/MBs/SDs”;
}
else if (LoanCatLocal == “CMS SME Loan(CMSME)”)
{
mWSheet1.Cells[rowCount + index, 34] = “CMS SME”;
}
else
{
mWSheet1.Cells[rowCount + index, 34] = “Others”;
}
}

mWSheet1.Cells[rowCount + index, 36] = CLLoan.BorrowerAddress;
mWSheet1.Cells[rowCount + index, 37] = CLLoan.CustCIBCode;

mWSheet1.Cells[rowCount + index, 38] = CLLoan.MKTValueofLBC;
mWSheet1.Cells[rowCount + index, 39] = CLLoan.ValueOfCash;

index++;

mWorkBook.SaveAs(CLExcel_path, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,
Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value);
mWorkBook.Close(Missing.Value, Missing.Value, Missing.Value);
mWSheet1 = null;
mWorkBook = null;
oXL.Quit();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

lblExcelDownloadMsg.Text = “Excel Has Been Generated”;

officedocument.spreadsheetml.sheet";

        /*

lblExcelDownloadMsg.Text = “CL-2 Process Compleate”;
*/
string script = “alert(“” + “CL-2 Process Complete” + “n” + “”);”;
ScriptManager.RegisterStartupScript(this, GetType(), “ServerControlScript”, script, true);

GetQuarterAndYear(out quarter, out year);

oProcessedBranch = db.ProcessedBranch.FirstOrDefault(x=>x.BRANCHCODE == branchCode && x.YEAR == year && x.QTR == quarter && x.ISACTIVE == true );

if (oProcessedBranch == null)
{
oProcessedBranch = new ProcessedBranch();

oProcessedBranch.YEAR = year;
oProcessedBranch.QTR = quarter;
oProcessedBranch.CL2 = true;
oProcessedBranch.BRANCHCODE = branchCode;
oProcessedBranch.CREATEDBY = Session[“CurrentUserEmployeeID”].ToString();
oProcessedBranch.CREATEDON = DateTime.Now;
oProcessedBranch.ISACTIVE = true;
db.ProcessedBranch.AddObject(oProcessedBranch);
db.SaveChanges();
}

else
{
oProcessedBranch.YEAR = year;
oProcessedBranch.QTR = quarter;
oProcessedBranch.CL2 = true;
oProcessedBranch.BRANCHCODE = branchCode;
oProcessedBranch.CREATEDBY = Session[“CurrentUserEmployeeID”].ToString();
oProcessedBranch.CREATEDON = DateTime.Now;
oProcessedBranch.ISACTIVE = true;
db.SaveChanges();
}

foreach (Process proc in System.Diagnostics.Process.GetProcessesByName(“EXCEL”))
{
proc.Kill();
}
}
catch (Exception exception)
{
lblExcelDownloadMsg.Text = exception.ToString();

        //mWorkBook.Close(Missing.Value, Missing.Value, Missing.Value);
        //mWSheet1 = null;
        //mWorkBook = null;
        ////mWorkBook.Close();
        //oXL.Quit();
        //GC.WaitForPendingFinalizers();
        //GC.Collect();
        //GC.WaitForPendingFinalizers();
        //GC.Collect();

foreach (Process proc in System.Diagnostics.Process.GetProcessesByName(“EXCEL”))
{
proc.Kill();
}
}

    //foreach (Process proc in System.Diagnostics.Process.GetProcessesByName("EXCEL"))
    //{

proc.Kill();
//}
}

private void GetQuarterAndYear(out int quarter, out int year)
{
quarter = 0;
year = 0;

Int32 currentMonth = 1;// DateTime.Now.Month;
Int32 currentYear = DateTime.Now.Year;

if (currentMonth == 4 || currentMonth == 7 || currentMonth == 10)
{
quarter = currentMonth/3;
year = currentYear;
}

if (currentMonth == 1)
{
quarter = 4;
year = currentYear – 1;
}

}

protected void btnExportExcelCl3_Click(object sender, EventArgs e)
{
GenerateLoanExcelAndSaveCl3();
}

private void GenerateLoanExcelAndSaveCl3()
{
oProcessedBranch = new ProcessedBranch();

var branchCode = Session[“CurrentUserBranchCode”].ToString();

    //02-July-2023
    //if (branchCode == "000")

if (branchCode == “501”)
branchCode = ddlBranch.SelectedValue.ToString();

db = new OBLLOANADVANCEEntities();
try
{
List CLLoanDetailList = null;

        //02-July-2023
        //if (branchCode == "000")

if (branchCode == “501”)
{
CLLoanDetailList = db.CLLoanDetail.Where(x => x.SB_IsActive == true && x.SB_Amount > 0).OrderBy(x => x.SB_ID).ToList();
}
else
{
CLLoanDetailList = db.CLLoanDetail.Where(x => (x.SB_OBLBranchCode == branchCode) && x.SB_IsActive == true && x.SB_Amount > 0).OrderBy(x => x.SB_ID).ToList();
}

        //var CLLoanDetailList = db.CLLoanDetail.Where(x => (x.SB_OBLBranchCode == "002")).OrderBy(x => x.SB_ID).ToList();

CLLoanDetailList = CLLoanDetailList.Where(x => x.LoanNature == “4” || x.LoanNature == “5” || x.LoanNature == “6” || x.LoanNature == “7” || x.LoanNature == “10” || x.LoanNature == “11” || x.LoanNature == “12” || x.LoanNature == “13”).ToList();
CLLoanDetailList =
CLLoanDetailList.Where(x => x.LoanCategory == “6” || x.LoanCategory == “7” || x.LoanCategory == “8” || x.LoanCategory == “10” || x.LoanCategory == “11”)
.ToList();
//
//var CLLoanDetailList = db.CLLoanDetail.OrderBy(x => x.SB_ID).ToList();

        //string CLExcel_path = Server.MapPath("~/CLExcelFile/CL2.xls");

string CLExcel_path = Server.MapPath(“~/CLExcelFile/Reset Additional Field for CL_” + branchCode + “.xls”);

oXL = new Microsoft.Office.Interop.Excel.Application();
oXL.Visible = false;
oXL.DisplayAlerts = false;
mWorkBook = oXL.Workbooks.Open(CLExcel_path, 0, false, 5, “”, “”, false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, “”, true, false, 0, true, false, false);

        //Get all the sheets in the workbook

mWorkSheets = mWorkBook.Worksheets;
//Get the allready exists sheet
mWSheet1 = (Microsoft.Office.Interop.Excel.Worksheet)mWorkSheets.get_Item(“CL-3”);
Microsoft.Office.Interop.Excel.Range range = mWSheet1.UsedRange;

int rowCount = 1;
int index = 11;

        //for (int index = 17; index < 18; index++)

foreach (var CLLoan in CLLoanDetailList)
{

mWSheet1.Cells[rowCount + index, 2] = CLLoan.SB_CustName;
mWSheet1.Cells[rowCount + index, 3] = CLLoan.BorrowerNID;
//mWSheet1.Cells[rowCount + index, 4] = CLLoan.SB_BBProdDesc;
string loannature = db.OIEnumeration.Where(x => x.Type == 11 && x.Value == CLLoan.LoanNature).FirstOrDefault().Name;
string loanCategory = db.OIEnumeration.Where(x => x.Type == 13 && x.Value == CLLoan.LoanCategory).FirstOrDefault().Name;
mWSheet1.Cells[rowCount + index, 4] = loannature + “-” + loanCategory;
//mWSheet1.Cells[rowCount + index, 4] = CLLoan.LoanNature + “-” + CLLoan.LoanCategory;
mWSheet1.Cells[rowCount + index, 5] = CLLoan.SB_AccNo;
mWSheet1.Cells[rowCount + index, 6] = CLLoan.FirstSanctionDt != null ? Convert.ToDateTime(CLLoan.FirstSanctionDt).ToString(“MM-dd-yyyy”) : “”;
mWSheet1.Cells[rowCount + index, 7] = CLLoan.LastRenewalRSDLDt != null ? Convert.ToDateTime(CLLoan.LastRenewalRSDLDt).ToString(“MM-dd-yyyy”) : “”;
mWSheet1.Cells[rowCount + index, 8] = CLLoan.LastRenewalRSDLNo;
mWSheet1.Cells[rowCount + index, 9] = CLLoan.FirstSanctionAmt;
mWSheet1.Cells[rowCount + index, 10] = CLLoan.LastReschduleAmt;
mWSheet1.Cells[rowCount + index, 11] = CLLoan.SB_Amount;
mWSheet1.Cells[rowCount + index, 12] = CLLoan.DateOfExpiry != null ? Convert.ToDateTime(CLLoan.DateOfExpiry).ToString(“MM-dd-yyyy”) : “”;
//mWSheet1.Cells[rowCount + index, 13] = CLLoan.PeriodOfArrears;
//mWSheet1.Cells[rowCount + index, 14] = CLLoan.ClassificationCriteria;

if (CLLoan.QualititiveJudgement != null)
{
qualitativejudge = db.OIEnumeration.First(x => x.Type == 18 && x.Value == CLLoan.QualititiveJudgement).Name.ToString();
mWSheet1.Cells[rowCount + index, 15] = qualitativejudge;
}

if (qualitativejudge == “STD”)
{
mWSheet1.Cells[rowCount + index, 24] = CLLoan.MonthEndIntSusBal;
}
else if (qualitativejudge == “SMA”)
{
mWSheet1.Cells[rowCount + index, 25] = CLLoan.MonthEndIntSusBal;
}
else if (qualitativejudge == “SS” || qualitativejudge == “DF” || qualitativejudge == “BL”)
{
mWSheet1.Cells[rowCount + index, 26] = CLLoan.MonthEndIntSusBal;
}

mWSheet1.Cells[rowCount + index, 16] = CLLoan.FinalClassification != null ? db.OIEnumeration.First(x => x.Type == 18 && x.Value == CLLoan.FinalClassification).Name.ToString() : “”;
mWSheet1.Cells[rowCount + index, 17] = CLLoan.ClassificationCriteria != null ? db.OIEnumeration.First(x => x.Type == 19 && x.Value == CLLoan.ClassificationCriteria).Name.ToString() : “”;

String value = “”;
value = CLLoan.FinalClassification != null ? db.OIEnumeration.First(x => x.Type == 18 && x.Value == CLLoan.FinalClassification).Value.ToString() : “”;

mWSheet1.Cells[rowCount + index, 24] = 0;
mWSheet1.Cells[rowCount + index, 25] = 0;
mWSheet1.Cells[rowCount + index, 26] = 0;

if (value == “1”)
mWSheet1.Cells[rowCount + index, 24] = CLLoan.MonthEndIntSusBal;
else if (value == “2”)
mWSheet1.Cells[rowCount + index, 25] = CLLoan.MonthEndIntSusBal;
else
mWSheet1.Cells[rowCount + index, 26] = CLLoan.MonthEndIntSusBal;

mWSheet1.Cells[rowCount + index, 28] = CLLoan.TotalElligSecVal;

mWSheet1.Cells[rowCount + index, 33] = CLLoan.RemarksOnClass + ” ” + CLLoan.AdditionalRemarks;
//mWSheet1.Cells[rowCount + index, 34] = CLLoan.LoanCategory != null ? db.OIEnumeration.First(x => x.Type == 13 && x.Value == CLLoan.LoanCategory).Name.ToString() : “”; //Value of Loan Category — Confused
var LoanCatLocal = CLLoan.LoanCategory != null ? db.OIEnumeration.First(x => x.Type == 13 && x.Value == CLLoan.LoanCategory).Name.ToString() : “”;
if (!String.IsNullOrEmpty(LoanCatLocal))
{
if (LoanCatLocal == “SME Finance (SMEF)”)
{
mWSheet1.Cells[rowCount + index, 34] = “SMEF”;
}

else if (LoanCatLocal == “Consumer Finance (CF)”)
{
mWSheet1.Cells[rowCount + index, 34] = “CF”;
}
else if (LoanCatLocal == “Capital MKt (BH-MB-SD)”)
{
mWSheet1.Cells[rowCount + index, 34] = “BHs/MBs/SDs”;
}
else if (LoanCatLocal == “CMS SME Loan(CMSME)”)
{
mWSheet1.Cells[rowCount + index, 34] = “CMS SME”;
}
else
{
mWSheet1.Cells[rowCount + index, 34] = “Others”;
}
}

mWSheet1.Cells[rowCount + index, 36] = CLLoan.BorrowerAddress;
mWSheet1.Cells[rowCount + index, 37] = CLLoan.CustCIBCode;

mWSheet1.Cells[rowCount + index, 38] = CLLoan.MKTValueofLBC;
mWSheet1.Cells[rowCount + index, 39] = CLLoan.ValueOfCash;

index++;
}
mWorkBook.SaveAs(CLExcel_path, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,
Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value);
mWorkBook.Close(Missing.Value, Missing.Value, Missing.Value);
mWSheet1 = null;
mWorkBook = null;
//mWorkBook.Close();
oXL.Quit();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

lblExcelDownloadMsg.Text = “Excel Has Been Generated”;
protected void btnDownloadActive_Click(object sender, EventArgs e)
{
dbCL = new dbCLDataContext();

SoftwareConfig objSoftwareConfig = new SoftwareConfig();
objSoftwareConfig = dbCL.SoftwareConfigs.Where(p => p.Type == 1).FirstOrDefault();
objSoftwareConfig.IsActive = true;
dbCL.SubmitChanges();
btnDownload.Enabled = true;
lblExcelDownloadMsg.Text = “Download has been activated.”;

}

protected void btnDownloadInActive_Click(object sender, EventArgs e)
{
dbCL = new dbCLDataContext();

SoftwareConfig objSoftwareConfig = new SoftwareConfig();
objSoftwareConfig = dbCL.SoftwareConfigs.Where(p => p.Type == 1).FirstOrDefault();
objSoftwareConfig.IsActive = false;
dbCL.SubmitChanges();
btnDownload.Enabled = false;
lblExcelDownloadMsg.Text = “Download has been Inactivated.”;
}

}

`The entire application run and executed in same server locally. But when try in IIS 10 .xls file not load. This is Isolated server. (Excel v:2007 and windos 2019 server). What should I do now?`

New contributor

Debashis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật