How to close IE tabs/browser windows through C# ASP.NET web application

I have a web application which should check for Internet Explore (IE) windows that are open using the name of the web page and close them. Below is the code that I am using to accomplish that.
This piece of code runs well and closes the IE windows when I run it from my local machine/host. But when I install the web application on the development server, it fails and throw an exception. Does the COM component "Shell.Application" supposed to be used only on windows application. What should I do to close browser windows/tabs on a client side from a web site?

private void IEBrowserTabClose()
        {
            string filename;            
            try
            {
                ShellWindows shellWindows;
                Type typeShell = Type.GetTypeFromProgID("Shell.Application");
                object objectShell = Activator.CreateInstance(typeShell);

                if (typeShell != null)
                {
                    shellWindows = typeShell.InvokeMember("Windows", BindingFlags.InvokeMethod, null, objectShell, null) as ShellWindows;

                    foreach (SHDocVw.InternetExplorer ie in shellWindows)
                    {
                        filename = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();

                        if (filename.Equals("iexplore"))
                        {
                            if (ie.LocationName == "Google")
                            {
                                ie.Quit();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _PageErrorMsg = Common.GetDisplayableText(ex.Message);
            }

        }
kvishnusharmaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
<html>
<body onload="window.open('', '_self', '');">

<input type="button" class="inputfields" onclick="javascript:window.opener='x';window.close();" value="Close" />
</body>
</html>

0
kvishnusharmaAuthor Commented:
Looks like you cannot control client processes from a website...it's far fetched...Shellwindows are more appropriate for the windows application I believe.. Thanks for the reply..
0
Kyle AbrahamsSenior .Net DeveloperCommented:
You can with activeX but that would require additional permissions.  You can close your own page, can't tell the browser to close other pages / tabs.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.