918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/a8232af4/e7d7d9aa/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/a8232af4/e7d7d9aa/App_Web_nqa4s13a.3.cs
?#pragma checksum "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "8BBFA265752D3CFD3C6F7065F5CF468B"
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具天生。
//     运行时版本:2.0.50727.9054
//
//     对此文件的更改可能会导致不正确的行为,并且若是
//     沉新天生代码,这些更改将会迷失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace ASP {
    
    #line 3 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.Web;
    
    #line default
    #line hidden
    
    #line 8 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.Text.RegularExpressions;
    
    #line default
    #line hidden
    
    #line 284 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.Security;
    
    #line default
    #line hidden
    
    #line 5 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using SecurityHelper;
    
    #line default
    #line hidden
    
    #line 283 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.SessionState;
    
    #line default
    #line hidden
    
    #line 11 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.Threading;
    
    #line default
    #line hidden
    
    #line 275 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System;
    
    #line default
    #line hidden
    
    #line 287 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.UI.WebControls;
    
    #line default
    #line hidden
    
    #line 10 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.Collections.Specialized;
    
    #line default
    #line hidden
    
    #line 6 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.Net;
    
    #line default
    #line hidden
    
    #line 286 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.UI;
    
    #line default
    #line hidden
    
    #line 285 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.Profile;
    
    #line default
    #line hidden
    
    #line 9 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.Collections;
    
    #line default
    #line hidden
    
    #line 4 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.Text;
    
    #line default
    #line hidden
    
    #line 282 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.Caching;
    
    #line default
    #line hidden
    
    #line 7 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
    using System.IO;
    
    #line default
    #line hidden
    
    #line 288 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.UI.WebControls.WebParts;
    
    #line default
    #line hidden
    
    #line 278 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Configuration;
    
    #line default
    #line hidden
    
    #line 289 "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config"
    using System.Web.UI.HtmlControls;
    
    #line default
    #line hidden
    
    
    [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
    public class pages_bottom_aspx : global::System.Web.UI.Page, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
        
        private static bool @__initialized;
        
        private static object @__stringResource;
        
        private static object @__fileDependencies;
        
        
        #line 12 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
                        

    void Page_Load(object src, EventArgs e)
    {

        if (Request.QueryString["test"] != null)
        {
            //string k = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes("高温工业电视"));
            //Response.Write(k);
            Response.Write(SecurityHelper.SecurityClass.EncryptString("http://demo.nestcms.com/")); //www.jembopack.com
            Response.Write("1");
            Response.End();
        }
        //Response.Write(SecurityHelper.SecurityClass.EncryptString("http://www.jembopack.com/"));
        //Response.Write("<br/>");
        //Response.Write(Request.QueryString["url"].Replace(" ", "+"));
        //Response.End();

        string url = SecurityHelper.SecurityClass.DecryptString(Request["url"].Replace(" ", "+"));// Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(Request.QueryString["url"]));
        string to = Request["to"];
        string tourl = Request["tourl"];
        string absoluteurl = Request["a"];
        string id = Request["id"];
        string siteid = Request["siteid"];
        string ipid = Request["ipid"];
        string cmsurl = Request["cmsurl"];
        string cid = Request["cid"];
        //Response.Write(FanyiSite(url, to, tourl, absoluteurl.Equals("1") ? true : false));
        Translate enTra = new Translate();
        enTra.Url = url;
        enTra.To = to;
        enTra.Tourl = tourl;
        enTra.Absoluteurl = absoluteurl.Equals("1") ? true : false;
        enTra.Id = id;
        enTra.Siteid = siteid;
        enTra.Ipid = ipid;
        enTra.Cmsurl = cmsurl;
        enTra.Cid = cid;
        Thread thread = new Thread(new ParameterizedThreadStart(SaveFiles));
        thread.IsBackground = true;//后盾线程
        thread.Start(enTra);
    }


    /// <summary>
    /// 单词翻译
    /// </summary>
    /// <param name="words"></param>
    /// <param name="to"></param>
    /// <returns></returns>
    public string FanyiWord(string words, string to)
    {
        try
        {
            cContainer = new CookieContainer();
            string re = DoRequest("http://fanyi.m.nmwfxd.com/v2transapi", string.Empty, true, "from=en&to=" + to + "&query=" + words + "&transtype=realtime&simple_means_flag=3");
            Regex r = new Regex("\"dst\":(.*?),\"src\"");
            re = r.Matches(re)[0].Groups[1].Value;

            if (re.Contains("\\u"))
            {
                re = FromUnicodeString(re);
            }
            else
            {
                re = System.Web.HttpUtility.UrlDecode(re);
            }
            return re;
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            return "\"\"";
        }
    }

    public static string FromUnicodeString(string str)
    {
        //最直接的步骤Regex.Unescape(str);
        StringBuilder strResult = new StringBuilder();
        if (!string.IsNullOrEmpty(str))
        {
            string[] strlist = str.Replace("\\", "").Split('u');
            try
            {
                for (int i = 1; i < strlist.Length; i++)
                {
                    int charCode = Convert.ToInt32(strlist[i], 16);
                    strResult.Append((char)charCode);
                }
            }
            catch (FormatException ex)
            {
                return Regex.Unescape(str);
            }
        }
        return strResult.ToString();
    }

    /// <summary>
    /// 整站翻译
    /// </summary>
    /// <param name="url">要翻译的页面</param>
    /// <param name="to">翻译的说话(对应目录)</param>
    /// <param name="tourl">对应的二级域名</param>
    /// <returns></returns>
    public string FanyiSite(string url, string to, string tourl, bool absoluteurl)
    {
        cContainer = new CookieContainer();
        DoRequest("http://fanyi.m.nmwfxd.com/transpage?query=" + url + "&source=url&ie=utf8&from=en&to=" + to + "&render=1&qq-pf-to=pcqq.group");
        string html = DoRequest("http://translate.baiducontent.com/transpage?query=" + url + "&from=en&to=" + to + "&source=url", "http://fanyi.m.nmwfxd.com/transpage?query=" + url + "&source=url&ie=utf8&from=en&to=" + to + "&render=1&qq-pf-to=pcqq.group", true);

        int indexof = html.IndexOf("<!--\"'>-->");
        if (indexof > 0)
        {
            html = html.Substring(0, html.IndexOf("<!--\"'>-->"));
        }
        if (html.EndsWith("</HTML>") || html.EndsWith("</html>"))
        { }
        else
        {
            html += "</body></html>";
        }

        #region "代替html的a标签"

        //Uri uri = this.webBrowser1.Url;
        string query = url;//CUrl.GetQueryString(uri.AbsoluteUri, "query");
        Uri uri = new Uri(query);


        Regex re = new Regex("href=['\"]?(.*?)['\" ]", RegexOptions.IgnoreCase);

        MatchCollection mc = re.Matches(html);
        //Response.Write(mc.Count + "test");

        //List<string> lst = new List<string>();
        foreach (Match m in mc)
        {
            try
            {
                //if (!lst.Contains(m.Value))
                //{ lst.Add(m.Value); }
                //else { continue; }

                string temp = m.Value.Replace(" ", "").Replace(@"\", "/");

                if (temp.ToLower().Contains(".css") || temp.ToLower().Contains(".js") || temp.ToLower().Contains("javascript:") || temp.ToLower().Contains("mailto:") || temp.ToLower().Contains("tencent:") || temp.ToLower().Contains("msnim:") || temp.ToLower().Equals("href=\"") || temp.ToLower().Equals("href='") || temp.ToLower().Contains("wpa.qq.com"))
                {
                    continue;
                }

                if (temp.Contains(query + "#"))
                {
                    temp = temp.Replace(query, "");

                    Regex _re = new Regex(m.Value);
                    html = _re.Replace(html, temp, 1);
                    //html = html.Replace(m.Value, temp);
                }
                else if (temp.Contains("translate.baiducontent.com"))
                {
                    temp = Regex.Replace(temp, "href=", "", RegexOptions.IgnoreCase);
                    if (temp.StartsWith("\""))
                    {
                        temp = Regex.Replace(temp, "\"", "", RegexOptions.IgnoreCase);
                    }
                    if (temp.StartsWith("'"))
                    {
                        temp = Regex.Replace(temp, "'", "", RegexOptions.IgnoreCase);
                    }
                    //http://translate.baiducontent.com/transpage?cb=translateCallback&ie=utf8&source=url&query=http%3A%2F%2Ffra.jembobag.com%2F&from=en&to=spa&token=&monLang=zh
                    temp = GetQueryString(temp.Replace("&amp;", "&"), "query");
                    string notFanyiPage = "http://" + uri.Authority + "/?1=1";               
                    if (temp == notFanyiPage)
                    {
                        html = html.Replace(m.Value, "href=\"http://" + uri.Authority + "/\"");
                    }
                    else if (!temp.Contains(uri.Authority) || temp.Contains("#")) { html = html.Replace(m.Value, "href=\"" + temp + "\""); }
                    else
                    {
                        Uri _uri = new Uri(temp);
                        html = html.Replace(m.Value, "href=\"" + (absoluteurl ? (tourl + to) : tourl.TrimEnd('/')) + _uri.AbsolutePath + "\"");

                    }
                }
                else
                {




                }

            }


            catch (Exception ex)
            {
                continue;
            }
        }




        #endregion


        #region "代替keywords和description"

        Regex re1 = new Regex("[<]meta name(.*?)keywords(.*?)content=(.*?)[>]", RegexOptions.IgnoreCase);
        MatchCollection mc1 = re1.Matches(html);

        if (mc1.Count > 0)
        {
            string keywords = mc1[0].Groups[3].Value.Replace("\"", "").Replace(",", "|");


            if (!string.IsNullOrEmpty(keywords))
            {
                string res = FanyiWord(keywords, to);
                html = html.Replace(mc1[0].Groups[0].Value, mc1[0].Groups[0].Value.Replace(mc1[0].Groups[3].Value, res.Replace("|", ",")));

                //keyword = res.Replace("\"", "");
            }


        }

        Regex re2 = new Regex("[<]meta name(.*?)description(.*?)content=(.*?)[>]", RegexOptions.IgnoreCase);
        MatchCollection mc2 = re2.Matches(html);

        if (mc2.Count > 0)
        {
            string description = mc2[0].Groups[3].Value.Replace("\"", "");


            string res = FanyiWord(description, to);
            html = html.Replace(mc2[0].Groups[0].Value, mc2[0].Groups[0].Value.Replace(mc2[0].Groups[3].Value, res));

        }
         #endregion
        
        #region "可能有俩个base target,断根掉一个"
        Regex re3 = new Regex("[<]base href(.*?)[>]", RegexOptions.IgnoreCase);
        MatchCollection mc3 = re3.Matches(html);
        if (mc3.Count > 1)
        {
            html = html.Replace(mc3[0].Value, "");
        }
        #endregion

        #region "iframe嵌套的aspx 不翻译"
        Regex regAspx = new Regex("<iframe\\s*src=['\"]?(.*?)['\" ]", RegexOptions.IgnoreCase);
        MatchCollection mcAspx = regAspx.Matches(html);
        foreach (Match m in mcAspx)
        {
            try
            {
                string temp = m.Result("$1").Replace(" ", "").Replace(@"\", "/");
                if (!temp.ToLower().Contains("aspx")) //非aspx页面不处置
                {
                    continue;
                }
                if (temp.Contains("translate.baiducontent.com"))
                {
                    temp = Regex.Replace(temp, "href=", "", RegexOptions.IgnoreCase);
                    if (temp.StartsWith("\""))
                    {
                        temp = Regex.Replace(temp, "\"", "", RegexOptions.IgnoreCase);
                    }
                    if (temp.StartsWith("'"))
                    {
                        temp = Regex.Replace(temp, "'", "", RegexOptions.IgnoreCase);
                    }
                    temp = GetQueryString(temp.Replace("&amp;", "&"), "query");
                    html = html.Replace(m.Result("$1"), temp);
                }
            }
            catch (Exception ex)
            {
                continue;
            }
        }
        #endregion
      


        return html;

    }

    /// <summary>
    /// 获取页面keywords
    /// </summary>
    /// <param name="html"></param>
    /// <returns></returns>
    public string GetKeyWords(string html)
    {

        Regex re1 = new Regex("[<]meta name(.*?)keywords(.*?)content=(.*?)[>]", RegexOptions.IgnoreCase);
        MatchCollection mc1 = re1.Matches(html);
        string keywords = "";
        if (mc1.Count > 0)
        {
            keywords = mc1[0].Groups[3].Value.Replace("\"", "").Replace(",", "|");
        }
        return keywords;
    }

    /// <summary>
    /// 保留文件和keyword
    /// </summary>
    /// <param name="obj"></param>
    public void SaveFiles(object obj)
    {
        try
        {
            Translate enTra = (Translate)obj;
            string url = enTra.Url;
            string to = enTra.To;
            string tourl = "http://" + enTra.Tourl + "/";
            bool absoluteurl = enTra.Absoluteurl;
            string id = enTra.Id;
            string siteid = enTra.Siteid;
            string ipid = enTra.Ipid;
            string cmsurl = enTra.Cmsurl;
            string cid = enTra.Cid;
            string html = FanyiSite(url, to, tourl, absoluteurl);
            byte[] data = Encoding.Default.GetBytes(html);
            int kb = data.Length / 1024;
            //Response.Write(html);
            Uri uri = new Uri(url);
            cmsurl = (string)checkurl(cmsurl);
            string CmsService = "http://" + cmsurl + "/ashx/CmsTranslate.ashx";
            string GiveOutService = "http://139.129.96.214:8011/GiveOutHandler.ashx";
            //string CmsService = "http://localhost:4543/ashx/CmsTranslate.ashx";
            //string GiveOutService = "http://localhost:5569/GiveOutHandler.ashx";
            string file = "/" + to + "/" + (uri.AbsolutePath.EndsWith("/") ? uri.AbsolutePath + "index.html" : uri.AbsolutePath);
            string keywords = GetKeyWords(html);
            string keyfile = "/" + to + "/key.txt";
            string postData = "action=WriteToFile&content=" + HttpUtility.UrlEncode(html, Encoding.UTF8) + "&file=" + HttpUtility.UrlEncode(file) + "&keywords=" + HttpUtility.UrlEncode(keywords, Encoding.UTF8) + "&keyfile=" + HttpUtility.UrlEncode(keyfile);
            if (kb > 2)
            {
                bool isOK = BoolPostPage(CmsService, postData);//保留页面到cms服务器
                if (isOK == true)
                {
                    string postData3 = "action=UpdateUrlCache&id=" + id + "&siteid=" + siteid + "&cid=" + cid + "&ipid=" + ipid;
                    PostPage(GiveOutService, postData3);
                }
            }
            else
            {
                postData = "action=UpdateErrorCount&id=" + id + "&siteid=" + siteid + "&cid=" + cid + "&ipid=" + ipid;
                PostPage(GiveOutService, postData);
            }
        }
        catch (Exception ex)
        {
            WriteLogs("5.步骤块异常---" + ex.ToString() + "---" + DateTime.Now);
        }
    }

    private static object checkurl(string url)
    {
        try
        {
            //if (url.StartsWith("www.")) { return url}
            using (System.Net.WebClient client = new WebClient())
            {
                //string transfer_url = client.DownloadString("http://" + System.Configuration.ConfigurationManager.AppSettings["interhost"] + "/geturl.aspx?url=" + url);
                string transfer_url = client.DownloadString("http://" + url + "/geturl.aspx?url=" + url);
                if (transfer_url.Length > 50) { throw new Exception("url error"); }
                return transfer_url.Trim().Equals("") ? url : transfer_url.Trim();
            }
        }
        catch
        {
            return url;
        }
    }

    public static bool BoolPostPage(string posturl, string postData)
    {
        try
        {
            Stream outstream = null;
            Stream instream = null;
            StreamReader sr = null;
            HttpWebResponse response = null;
            HttpWebRequest request = null;
            Encoding encoding = Encoding.UTF8;
            byte[] data = encoding.GetBytes(postData);
            // 设置参数
            request = WebRequest.Create(posturl) as HttpWebRequest;
            CookieContainer cookieContainer = new CookieContainer();
            request.CookieContainer = cookieContainer;
            request.AllowAutoRedirect = true;
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded;charset=utf-8;";
            request.ContentLength = data.Length;
            request.Timeout = System.Threading.Timeout.Infinite;

            outstream = request.GetRequestStream();
            outstream.Write(data, 0, data.Length);
            outstream.Close();
            //发送要求并获取相应回应数据
            response = request.GetResponse() as HttpWebResponse;
            //直到request.GetResponse()法式才起头向指标网页发送Post要求
            instream = response.GetResponseStream();
            sr = new StreamReader(instream, encoding);
            //返回了局网页(html)代码
            string content = sr.ReadToEnd();
            if (content == "true")
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {
            WriteLogs("2.保留犯错---error:" + ex.ToString() + "---" + DateTime.Now);
            return false;
        }
    }

    public static void PostPage(string posturl, string postData)
    {
        try
        {
            Stream outstream = null;
            Stream instream = null;
            StreamReader sr = null;
            HttpWebResponse response = null;
            HttpWebRequest request = null;
            Encoding encoding = Encoding.UTF8;
            //Encoding encoding = System.Text.Encoding.GetEncoding("gb2312");
            byte[] data = encoding.GetBytes(postData);
            // 设置参数
            request = WebRequest.Create(posturl) as HttpWebRequest;
            CookieContainer cookieContainer = new CookieContainer();
            request.CookieContainer = cookieContainer;
            request.AllowAutoRedirect = true;
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;
            request.Timeout = System.Threading.Timeout.Infinite;
            outstream = request.GetRequestStream();
            outstream.Write(data, 0, data.Length);
            outstream.Close();
            //发送要求并获取相应回应数据
            response = request.GetResponse() as HttpWebResponse;
            //直到request.GetResponse()法式才起头向指标网页发送Post要求
            instream = response.GetResponseStream();
            sr = new StreamReader(instream, encoding);
            //返回了局网页(html)代码
            //string content = sr.ReadToEnd();
            //return content;
        }
        catch (Exception ex)
        {
            WriteLogs("2.保留犯错---error:" + ex.ToString() + "---" + DateTime.Now);
        }
    }

    #region "DoRequest获取网页源"
    protected CookieContainer cContainer;
    protected string DoRequest(string url)
    {
        return DoRequest(url, string.Empty, true, string.Empty);
    }

    protected string DoRequest(string url, string refer)
    {
        return DoRequest(url, refer, true, string.Empty);
    }

    protected string DoRequest(string url, string refer, bool autoredirect)
    {
        return DoRequest(url, refer, autoredirect, string.Empty);
    }

    protected string DoRequest(string url, string refer, bool AutoRedirect, string postData)
    {
        string re = "";
        try
        {
            HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(url);
            if (cContainer == null)
            {
                cContainer = new CookieContainer();
            }
            Request.CookieContainer = cContainer;
            Request.Timeout = 600000;
            Request.AllowAutoRedirect = AutoRedirect;
            Request.UserAgent = "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2292.0 Safari/537.36";
            Request.Referer = refer;
            if (!string.IsNullOrEmpty(postData))
            {
                Request.Method = "POST";
                Request.ContentType = ("application/x-www-form-urlencoded");
                Stream rqs = Request.GetRequestStream();
                Byte[] bytes = Encoding.UTF8.GetBytes(postData);
                rqs.Write(bytes, 0, bytes.Length);
                rqs.Close();
            }
            HttpWebResponse response = (HttpWebResponse)Request.GetResponse();

            //if(response.ResponseUri.ToString().IndexOf("select_server") >= 0)
            //{    return "LoginChange";
            //}
            System.Net.CookieCollection cookies = response.Cookies;
            if (cookies.Count > 0)
            {
                foreach (Cookie coo in cookies)
                {
                    // Console.WriteLine(coo.Name & ":" & coo.Value & ",domain:" & coo.Domain)
                    coo.Expires = DateTime.Now.AddMonths(1);
                }
                cContainer.Add(cookies);
            }
            Stream stream = response.GetResponseStream();
            string[] chaset = Regex.Split(response.ContentType, "charset=", RegexOptions.IgnoreCase);
            string code;
            if (chaset.Length == 1)
            {
                code = "utf-8";
            }
            else
            {
                code = chaset[1];
            }
            System.Text.Encoding encode;
            if (code.ToLower() == "gbk")
            {
                encode = System.Text.Encoding.GetEncoding("gb2312");
            }
            else if (code.ToLower() == "utf8")
            {
                encode = System.Text.Encoding.UTF8;
            }
            else
            {
                encode = System.Text.Encoding.GetEncoding(code);
            }
            using (StreamReader readStream = new StreamReader(stream, encode))
            {
                //char[] buffer = new char[255];
                //int count = readStream.Read(buffer, 0, buffer.Length);
                //while( count > 0){
                //    re &= New String(buffer, 0, count)
                //    count = readStream.Read(buffer, 0, buffer.Length);
                //}
                re = readStream.ReadToEnd();
            }
        }
        catch (Exception ex)
        {
            //If TypeOf (ex.InnerException) Is SocketException Then
            //    Return "服务器无法衔接"
            //End If
            //If ex.ToString().ToLower().IndexOf("forbidden") >= 0 Then
            //    Return "forbidden"

            //End If

            Console.WriteLine(ex.Message);
            return "";
        }
        return re;

    }
    #endregion


    public static string GetQueryString(string url, string queryname)
    {
        //string pageURL = "http://www.google.com.hk/search?hl=zh-CN&source=hp&q=%E5%8D%9A%E6%B1%87%E6%95%B0%E7%A0%81&aq=f&aqi=g2&aql=&oq=&gs_rfai=";
        Uri uri = new Uri(url);
        NameValueCollection col = GetQueryString(uri.Query);
        return col[queryname];
        //了局 searchKey = "博汇数码"
    }

    /// <summary>
    /// 将查问字符串解析转换为名值集中.
    /// </summary>
    /// <param name="queryString"></param>
    /// <returns></returns>
    public static NameValueCollection GetQueryString(string queryString)
    {
        return GetQueryString(queryString, null, true);
    }

    /// <summary>
    /// 将查问字符串解析转换为名值集中.
    /// </summary>
    /// <param name="queryString"></param>
    /// <param name="encoding"></param>
    /// <param name="isEncoded"></param>
    /// <returns></returns>
    public static NameValueCollection GetQueryString(string queryString, Encoding encoding, bool isEncoded)
    {
        queryString = queryString.Replace("?", "");
        NameValueCollection result = new NameValueCollection(StringComparer.OrdinalIgnoreCase);
        if (!string.IsNullOrEmpty(queryString))
        {
            int count = queryString.Length;
            for (int i = 0; i < count; i++)
            {
                int startIndex = i;
                int index = -1;
                while (i < count)
                {
                    char item = queryString[i];
                    if (item == '=')
                    {
                        if (index < 0)
                        {
                            index = i;
                        }
                    }
                    else if (item == '&')
                    {
                        break;
                    }
                    i++;
                }
                string key = null;
                string value = null;
                if (index >= 0)
                {
                    key = queryString.Substring(startIndex, index - startIndex);
                    value = queryString.Substring(index + 1, (i - index) - 1);
                }
                else
                {
                    key = queryString.Substring(startIndex, i - startIndex);
                }
                if (isEncoded)
                {
                    result[MyUrlDeCode(key, encoding)] = MyUrlDeCode(value, encoding);
                }
                else
                {
                    result[key] = value;
                }
                if ((i == (count - 1)) && (queryString[i] == '&'))
                {
                    result[key] = string.Empty;
                }
            }
        }
        return result;
    }

    /// <summary>
    /// 解码URL.
    /// </summary>
    /// <param name="encoding">null为自动选择编码</param>
    /// <param name="str"></param>
    /// <returns></returns>
    public static string MyUrlDeCode(string str, Encoding encoding)
    {
        if (encoding == null)
        {
            Encoding utf8 = Encoding.UTF8;
            //首吓酌utf-8进行解码                     
            string code = HttpUtility.UrlDecode(str.ToUpper(), utf8);
            //将已经解码的字符再次进行编码.
            string encode = HttpUtility.UrlEncode(code, utf8).ToUpper();
            if (str == encode)
                encoding = Encoding.UTF8;
            else
                encoding = Encoding.GetEncoding("gb2312");
        }
        return HttpUtility.UrlDecode(str, encoding);
    }

    //写日志
    public static void WriteLogs(string logStr)
    {
        try
        {
            string path1 = HttpContext.Current.Server.MapPath("/logs/");
            if (!Directory.Exists(path1))
            {
                //创建索引目录
                Directory.CreateDirectory(path1);
            }
            string path = path1 + DateTime.Now.ToString("yyyy-MM-dd") + ".log";
            FileStream stream = null;
            if (!File.Exists(path))
            {
                stream = new FileStream(path, FileMode.Create);
            }
            else
            {
                stream = new FileStream(path, FileMode.Append);
            }
            StreamWriter writer = new StreamWriter(stream);
            writer.Write(logStr + Environment.NewLine);
            writer.Flush();
            writer.Close();
            stream.Close();
        }
        catch
        {
        }
    }

    [Serializable]
    public class Translate
    {
        private string url;
        public string Url
        {
            get { return url; }
            set { url = value; }
        }
        private string to;
        public string To
        {
            get { return to; }
            set { to = value; }
        }
        private string tourl;

        public string Tourl
        {
            get { return tourl; }
            set { tourl = value; }
        }

        private bool absoluteurl;
        public bool Absoluteurl
        {
            get { return absoluteurl; }
            set { absoluteurl = value; }
        }
        private string id;

        public string Id
        {
            get { return id; }
            set { id = value; }
        }
        private string siteid;

        public string Siteid
        {
            get { return siteid; }
            set { siteid = value; }
        }
        private string ipid;

        public string Ipid
        {
            get { return ipid; }
            set { ipid = value; }
        }
        private string cmsurl;

        public string Cmsurl
        {
            get { return cmsurl; }
            set { cmsurl = value; }
        }
        private string cid;

        public string Cid
        {
            get { return cid; }
            set { cid = value; }
        }
    }

        #line default
        #line hidden
        
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public pages_bottom_aspx() {
            string[] dependencies;
            ((global::System.Web.UI.Page)(this)).AppRelativeVirtualPath = "~/pages/bottom.aspx";
            if ((global::ASP.pages_bottom_aspx.@__initialized == false)) {
                global::ASP.pages_bottom_aspx.@__stringResource = this.ReadStringResource();
                dependencies = new string[1];
                dependencies[0] = "~/pages/bottom.aspx";
                global::ASP.pages_bottom_aspx.@__fileDependencies = this.GetWrappedFileDependencies(dependencies);
                global::ASP.pages_bottom_aspx.@__initialized = true;
            }
            this.Server.ScriptTimeout = 30000000;
        }
        
        protected System.Web.Profile.DefaultProfile Profile {
            get {
                return ((System.Web.Profile.DefaultProfile)(this.Context.Profile));
            }
        }
        
        protected ASP.global_asax ApplicationInstance {
            get {
                return ((ASP.global_asax)(this.Context.ApplicationInstance));
            }
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void @__BuildControlTree(pages_bottom_aspx @__ctrl) {
            
            #line 1 "D:\wwwroot\cqchunmai\wwwroot\pages\bottom.aspx"
            this.InitializeCulture();
            
            #line default
            #line hidden
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected override void FrameworkInitialize() {
            base.FrameworkInitialize();
            this.SetStringResourcePointer(global::ASP.pages_bottom_aspx.@__stringResource, 0);
            this.@__BuildControlTree(this);
            this.AddWrappedFileDependencies(global::ASP.pages_bottom_aspx.@__fileDependencies);
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public override int GetTypeHashCode() {
            return 5381;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public override void ProcessRequest(System.Web.HttpContext context) {
            base.ProcessRequest(context);
        }
    }
}