示例#1
0
 public void DownloadContent(string urlId, string fileName = "result.html")
 {
     try
     {
         string url = QueryControllerAdapter.GetString(urlId, true);
         System.Net.HttpWebRequest req = System.Net.HttpWebRequest.CreateHttp(url);
         req.Method          = "GET";
         req.CookieContainer = new System.Net.CookieContainer();
         System.Net.Cookie cookie = new System.Net.Cookie(".AspNet.ApplicationCookie", Request.Cookies[".AspNet.ApplicationCookie"].Value, "/", Request.UrlReferrer.Host);
         req.CookieContainer.Add(cookie);
         var    resp       = req.GetResponse();
         var    respStream = resp.GetResponseStream();
         var    SR         = new System.IO.StreamReader(respStream);
         string result     = SR.ReadToEnd();
         Response.ContentType = "application/force-download";
         string Header = "Attachment; Filename=" + fileName;
         Response.AppendHeader("Content-Disposition", Header);
         var SW = new System.IO.StreamWriter(Response.OutputStream);
         SW.Write(result);
         SW.Flush();
         SW.Close();
         Response.End();
     }
     catch (Exception exc)
     {
         Response.OutputStream.Flush();
         Response.OutputStream.Close();
         Response.ContentType = "TEXT/HTML";
         Response.ClearHeaders();
         Response.Write(exc.Message);
     }
 }
示例#2
0
        public string PutCSHtml(string json_params, bool addController = true)
        {
            string resultId = QueryControllerAdapter.PutString(json_params);

            if (addController)
            {
                resultId = "/Query/GetViewById?cshtmlId=" + resultId;
            }
            return(resultId);
        }
示例#3
0
 public string GetHtml(string Id, bool viewSource = false)
 {
     return(QueryControllerAdapter.GetString(Id, viewSource));
 }
示例#4
0
 public string PutHtml(string html)
 {
     return(QueryControllerAdapter.PutString(html));
 }
示例#5
0
 public string GetQueryId(string query)
 {
     return(QueryControllerAdapter.GetQueryId(query));
 }
        public string GetText(string TextId, string token)
        {
            string userName = Cryptor.Decrypt(token, "DERSA");

            return(QueryControllerAdapter.GetString(TextId, false, userName));//._query;
        }