コード例 #1
0
ファイル: UeditorController.cs プロジェクト: hellogiter/20031
        public ActionResult Index(string target, string action)
        {
            lock (_lock)
            {
                if (!string.IsNullOrEmpty(target))
                {
                    string method = Request.HttpMethod.ToLower();
                    //if (!string.IsNullOrEmpty(action))
                    //{
                    //    method = action.ToLower().Trim();
                    //}

                    StringBuilder urlBuilder = new StringBuilder();
                    urlBuilder.Append(MConfig.Get <String>("remoteRoot"));
                    urlBuilder.Append(MConfig.Get <string>(target.Trim().ToLower()));
                    urlBuilder.AppendFormat("userId={0}", UserInfo.UserSysNo);
                    switch (method)
                    {
                    case "get":
                    {
                        NameValueCollection keyValuePair = Request.QueryString;
                        foreach (string key in keyValuePair.Keys)
                        {
                            urlBuilder.AppendFormat("&{0}={1}", key, keyValuePair[key]);
                        }
                        break;;
                    }

                    case "post":
                    {
                        NameValueCollection keyValuePair = Request.Form;
                        foreach (string key in keyValuePair.Keys)
                        {
                            urlBuilder.AppendFormat("&{0}={1}", key, keyValuePair[key]);
                        }
                        break;
                    }
                    }

                    var proxy = OpenRequest.Create(urlBuilder.ToString(), method);
                    var resp  = proxy.GetResponse();
                    return(Content(resp.ResponseText));
                }
                return(new EmptyResult());
            }
        }
コード例 #2
0
 private MDB()
 {
     connection = new NpgsqlConnection(MConfig.Get().GetDbConnectionString());
     connection.Open();
 }