zoukankan      html  css  js  c++  java
  • SmartClient传入Url

     

    需要添加方法:

            ///<summary>

            ///获取URL参数

            ///</summary>

            ///<param name="key"></param>

            ///<returns></returns>

            public static string GetUrlParam(string key)

            {

                try

                {

                    Dictionary<string, string> SysUrlParamList = GetQueryStringParameters();

                    if (SysUrlParamList != null && SysUrlParamList[key] != null)

                    {

                        return SysUrlParamList[key];

                    }

                    else

                        return string.Empty;

                }

                catch (Exception ex)

                {

                   //System.Windows.Forms.MessageBox.Show(ex.Message);

                }

                return string.Empty;

            }

            ///<summary>

            ///获取URL参数集合

            ///</summary>

            ///<returns></returns>

            public static Dictionary<string, string> GetQueryStringParameters()

            {

                Dictionary<string, string> nameValueTable = new Dictionary<string, string>();

                try

                {

                    if (ApplicationDeployment.IsNetworkDeployed)

                    {

                        string url = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0];

                        string queryString = (new Uri(url)).Query;

                        queryString = queryString.TrimStart('?');

                        string[] nameValuePairs = queryString.Split('&');

                        foreach (string pair in nameValuePairs)

                        {

                            string[] vars = pair.Split('=');

                            if (!nameValueTable.ContainsKey(vars[0]))

                            {

                                nameValueTable.Add(vars[0], vars[1]);

                            }

                        }

                    }

                   

                }

                catch(Exception ex){

               

                }

                return (nameValueTable);

            }

    调用方法:

    String id = GetUrlParam(“id”);

    /Files/yinhaosln/url.rar

  • 相关阅读:
    堆模板
    二叉树输出
    中序+层次遍历输出前序
    扩展二叉树 (根据特殊的前序遍历建树)
    Leecode no.124 二叉树中的最大路径和
    JVM类加载过程
    Leecode no.208 实现Tire(前缀树)
    Leecode no.300 最长递增子序列
    volatile关键字深入解析 JMM与内存屏障
    Leecode no.200 岛屿数量
  • 原文地址:https://www.cnblogs.com/yinhaosln/p/1244906.html
Copyright © 2011-2022 走看看