upload excel file crashes the website.

Last post 04-10-2009 2:27 AM by ahsanm.m. 2 replies.

Sort Posts:

  • upload excel file crashes the website.

    04-08-2009, 1:13 PM
    • Member
      point Member
    • nitinbande
    • Member since 04-08-2009, 4:47 PM
    • Posts 1

    Hello,

    This is Nitin,

    I hope all of you are doing good. I liked this Website which helps us in solving problems.

     Actually I have Problem regarding Excel file upload in ASP.NET 2.0.

    Here I am uploading .CSV file on the server using File Upload. then we are reading the file and storing its data into the database(SQL database).

    It works fine on test server but the same code on the production server crashes the website for long time.

    can anybody knows the solution for this?

    Here is the code.....

            Excel.Application app = new Excel.ApplicationClass();
            Excel.Workbook workBook = app.Workbooks.Open(pathfile, 0, true, 5, "", "", true,
                Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

            Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet;
            Excel.Range range = workSheet.get_Range("A1".ToString(),"A1".ToString());
            String myvalues = Convert.ToString(range.Cells.Value2);
            String[] moduleList = myvalues.Split(',');
                
            range = workSheet.get_Range("A" + i.ToString(),"A" + i.ToString());
            String myvalues2 = Convert.ToString(range.Cells.Value2);
           
            string[,] strClient = new string[800, 2];
            int n = 0;
            while (myvalues2 != "" && myvalues2 != null && myvalues2 != " ")
            {

                range = workSheet.get_Range("A" + i.ToString(),"A" + i.ToString());
                myvalues2 = Convert.ToString(range.Cells.Value2);           //gets the entire "RECORD" of the student
                if (myvalues2 == "")
                {
                    goto result;
                }
                string[] studentGrades = myvalues2.Split(',');
                i++;
                string uin = studentGrades[1].ToString();

              

                  

  • Re: upload excel file crashes the website.

    04-09-2009, 10:52 PM
    Answer

    Hi,

    nitinbande:

    Hello,

    This is Nitin,

    I hope all of you are doing good. I liked this Website which helps us in solving problems.

     Actually I have Problem regarding Excel file upload in ASP.NET 2.0.

    Here I am uploading .CSV file on the server using File Upload. then we are reading the file and storing its data into the database(SQL database).

    It works fine on test server but the same code on the production server crashes the website for long time.

    can anybody knows the solution for this? 
                  

    Please double check the path of the uploading folder.

    And check the file manipulation permission. you need writing and reading permission.

    More info, please check following links:

    Giving ASP.NET Proper Permissions to Upload Files
    http://www.wrox.com/WileyCDA/Section/ASP-NET-2-0-FileUpload-Server-Control-Page-2.id-292159.html
    http://forums.asp.net/p/1065787/1541424.aspx#1541424
    http://www.kodyaz.com/articles/asp-net-file-upload-security-permissions.aspx
    http://knowledge.3essentials.com/web-hosting/article/259/Setting-permissions-for-file-upload-scripts.html

    If you have anything unclear, please feel free to let me know.

    Best Regards,
    Bober Song
    --------------------------------
    Please remember to click “Mark as Answer” on the post that helps you
  • Re: upload excel file crashes the website.

    04-10-2009, 2:27 AM
    Answer
    • Contributor
      2,260 point Contributor
    • ahsanm.m
    • Member since 08-27-2007, 6:51 AM
    • Dhaka, Bangladesh
    • Posts 364

    Please check the read/write permission in the production server and ensure that upload file size(default support 4mb).

    Ahsan Murshed
    __________________________
    Please "Mark as Answered" if helpful for you.
    ASP BOSS
Page 1 of 1 (3 items)