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()); } }
private MDB() { connection = new NpgsqlConnection(MConfig.Get().GetDbConnectionString()); connection.Open(); }