Find current URL of an IE instance from a C# application

We all know that to get the current URL of the browser for an Web Application can be find by

HttpContext.Current.Request.Url.AbsolutePath

But to find out the current URL of IE from a C# application following scripts can be useful

            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();

            foreach (SHDocVw.WebBrowser ies in shellWindows)
            {
                Console.WriteLine(ies.LocationURL);
            }


Windows PowerShell 2.0 Best Practices (Best Practices (Microsoft))

: