troubleshooting Question

Killing a process from asp.net page

Avatar of countrymeister
countrymeister asked on
Microsoft ExcelASP.NETSystem Utilities
1 Comment1 Solution247 ViewsLast Modified:
I have an ASP.NET page which invokes excel, and I intend to kill this excel process once the program has completed creating the reqd excel spreadsheet

I have the following code so far, when I try to kill the Excel process it states Access denied.
I am running the website under a given user account, which has administrative privileges.
My question is why can't I kill the process.


msBook.Close(false, msobjOpt, msobjOpt);

        msBooks.Close();

        msXL.Quit();        

        try

        {

            Marshal.ReleaseComObject(msXL);

            msXL = null;

            GC.Collect();

        }

        catch (Exception ex)

        {

        }

        //Kill older Excel processes

        try

        {

            Process[] p = Process.GetProcessesByName("EXCEL");

            ////kills all processes older than 15 minutes

            for (int i = 0; i < p.Length; i++)

                //if (p[i].StartTime.AddMinutes(2) < DateTime.Now)

                p[i].Kill;

        }

        catch (Exception ex)

        {

        }

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros