c#:获取IE地址栏中的URL

来源:互联网 发布:支持win10的ps软件 编辑:程序博客网 时间:2024/04/30 09:03

  一直在想测试用户行为分析的时候,通过程序(本地服务程序)获取IE上的Url地址,对当前的url分析,并结合我的情况分析我的行为方式。现在浏览网站的时候偶然看到了几行代码,不知道原始出处,就暂时转载记录下来。

 

System.AppDomain objAPDom = System.AppDomain.CurrentDomain;
object obj = objAPDom.GetData("APP_LAUNCH_URL");

“name”的值 属性 "APPBASE" ApplicationBase "APP_CONFIG_FILE" ConfigurationFile "DYNAMIC_BASE" DynamicBase "DEV_PATH" (无属性) "APP_NAME" ApplicationName "CACHE_BASE" PrivateBinPath "BINPATH_PROBE_ONLY" PrivateBinPathProbe "SHADOW_COPY_DIRS" ShadowCopyDirectories "FORCE_CACHE_INSTALL" ShadowCopyFiles "CACHE_BASE" CachePath (应用程序特定的) LicenseFile

错误代码:
//应用程序域
System.AppDomain objAPDom = System.AppDomain.CurrentDomain;
object obj = objAPDom.GetData("APP_LAUNCH_URL");

   if (obj == null)
   {
          strURL = "";
   }
   else
   {
          strURL = obj.ToString();
   }