Exemplo n.º 1
0
 public bool Login(string userName, string password, string checkCode)
 {
     try
     {
         this.username = userName;
         string         postdata     = string.Format("__VIEWSTATE={0}&txtUserName={1}&Textbox1=&TextBox2={2}&txtSecretCode={3}&RadioButtonList1=%D1%A7%C9%FA&Button1=&lbLanguage=&hidPdrs=&hidsc=", HttpUtility.UrlEncode(view_state), HttpUtility.UrlEncode(userName), HttpUtility.UrlEncode(password), HttpUtility.UrlEncode(checkCode));
         byte[]         postdatabyte = Encoding.GetEncoding("GB2312").GetBytes(postdata);
         HttpWebRequest request      = (HttpWebRequest)WebRequest.Create(defaultUrl);
         request.ServicePoint.Expect100Continue = false;
         request.Method = "POST";
         request.Headers.Add("Cache-Control", "max-age=0");
         request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36";
         request.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
         request.Headers.Add("Accept-Encoding", "gzip, deflate");
         request.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
         request.Referer       = url_code + "default2.aspx";
         request.ContentLength = postdatabyte.Length;
         request.KeepAlive     = true;
         request.ContentType   = "application/x-www-form-urlencoded";
         request.Headers.Add("Upgrade-Insecure-Requests", "1");
         request.CookieContainer   = cookie;
         request.AllowAutoRedirect = false;
         using (Stream stream = request.GetRequestStream())
         {
             stream.Write(postdatabyte, 0, postdatabyte.Length);
         }
         HttpWebResponse response = (HttpWebResponse)request.GetResponse();
         response.Close();
         string location = response.GetResponseHeader("Location");
         if (string.IsNullOrWhiteSpace(location))
         {
             return(false);
         }
         mainUrl = "http://" + host + location;
         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(mainUrl);
         req.Method          = "GET";
         req.CookieContainer = cookie;
         req.Referer         = defaultUrl;
         req.UserAgent       = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36";
         req.Accept          = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
         req.Headers.Add("Accept-Encoding", "gzip, deflate");
         req.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
         req.Headers.Add("Upgrade-Insecure-Requests", "1");
         req.KeepAlive = true;
         HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
         string          str  = string.Empty;
         bool            gzip = string.Equals(resp.Headers["Vary"], "Accept-Encoding", StringComparison.OrdinalIgnoreCase);
         str = DecompressGzip(resp.GetResponseStream(), gzip);
         resp.Close();
         int i = str.IndexOf("<span id=\"xhxm\">");
         int j = str.IndexOf("同学");
         name = str.Substring(i + 16, j - i - 16);
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 写字符串日志
 /// </summary>
 /// <param name="message"></param>
 public static void Write(string message, string source = null)
 {
     try
     {
         StringBuilder str = new StringBuilder();
         str.Append("#BEGIN\r\n");
         str.Append("#TYPE:MESSAGE\r\n");
         if (source != null)
         {
             str.Append("#SOURCE:");
             str.Append(source);
             str.Append("\r\n");
         }
         str.Append("DateTime:");
         str.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
         str.Append("\r\nMessage:");
         str.Append(message);
         str.Append("\r\n#END\r\n");
         logList.Add(str.ToString());
         Start();
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
     }
 }
Exemplo n.º 3
0
 public ExamInfo SearchReExam()
 {
     try
     {
         string         post = url_code + "XsBkKsCx.aspx?" + string.Format("xh={0}&xm={1}&gnmkdm=N121618", HttpUtility.UrlEncode(username), HttpUtility.UrlEncode(name));
         HttpWebRequest req  = (HttpWebRequest)WebRequest.Create(post);
         req.Method            = "GET";
         req.CookieContainer   = cookie;
         req.KeepAlive         = true;
         req.Referer           = mainUrl;
         req.AllowAutoRedirect = false;
         req.Headers.Add("Upgrade-Insecure-Requests", "1");
         req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36";
         req.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
         req.Headers.Add("Accept-Encoding", "gzip, deflate");
         req.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
         HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
         string          str  = string.Empty;
         bool            gzip = string.Equals(resp.Headers["Vary"], "Accept-Encoding", StringComparison.OrdinalIgnoreCase);
         str = DecompressGzip(resp.GetResponseStream(), gzip);
         resp.Close();
         if (string.IsNullOrWhiteSpace(str) || !str.Contains("__VIEWSTATE"))
         {
             return(null);
         }
         ExamInfo info = new ExamInfo();
         info.ViewState = GetViewState(str);
         List <string> tab = GetReg("<select", "</select>", str);
         if (tab.Count < 2)
         {
             return(null);
         }
         List <string> ops = GetReg("<option", "</option>", tab[0]);
         info.Year = new List <KeyValue>();
         foreach (string op in ops)
         {
             KeyValue kv = new KeyValue();
             kv.Key   = GetValue("value", op);
             kv.Value = GetContent(op);
             info.Year.Add(kv);
         }
         info.Semester = new List <KeyValue>();
         List <string> ops2 = GetReg("<option", "</option>", tab[1]);
         info.Semester = new List <KeyValue>();
         foreach (string op in ops2)
         {
             KeyValue kv = new KeyValue();
             kv.Key   = GetValue("value", op);
             kv.Value = GetContent(op);
             info.Semester.Add(kv);
         }
         return(info);
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
         return(null);
     }
 }
Exemplo n.º 4
0
 public List <EnglisgGradeModel> GetEndlishGrade()
 {
     try
     {
         string         post = url_code + "xsdjkscx.aspx?" + string.Format("xh={0}&xm={1}gnmkdm=N121606", HttpUtility.UrlEncode(username), HttpUtility.UrlEncode(name));
         HttpWebRequest req  = (HttpWebRequest)WebRequest.Create(post);
         req.Method            = "GET";
         req.CookieContainer   = cookie;
         req.KeepAlive         = true;
         req.Referer           = mainUrl;
         req.AllowAutoRedirect = false;
         req.Headers.Add("Upgrade-Insecure-Requests", "1");
         req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36";
         req.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
         req.Headers.Add("Accept-Encoding", "gzip, deflate");
         req.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
         HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
         string          str  = string.Empty;
         bool            gzip = string.Equals(resp.Headers["Vary"], "Accept-Encoding", StringComparison.OrdinalIgnoreCase);
         str = DecompressGzip(resp.GetResponseStream(), gzip);
         resp.Close();
         if (string.IsNullOrWhiteSpace(str) || !str.Contains("__VIEWSTATE"))
         {
             return(null);
         }
         List <string> tab = GetReg("<table", "</table>", str);
         if (tab.Count <= 0)
         {
             return(null);
         }
         List <string>            trs  = GetReg("<tr", "</tr>", tab[0]);
         List <EnglisgGradeModel> list = new List <EnglisgGradeModel>();
         foreach (string tr in trs.Skip(1))
         {
             List <string>     tds   = GetReg("<td>", "</td>", tr);
             EnglisgGradeModel model = new EnglisgGradeModel();
             model.Year        = HttpUtility.HtmlDecode(GetContent(tds[0]));
             model.Semester    = HttpUtility.HtmlDecode(GetContent(tds[1]));
             model.Name        = HttpUtility.HtmlDecode(GetContent(tds[2]));
             model.ID          = HttpUtility.HtmlDecode(GetContent(tds[3]));
             model.Date        = HttpUtility.HtmlDecode(GetContent(tds[4]));
             model.Grade       = HttpUtility.HtmlDecode(GetContent(tds[5]));
             model.ListenGrade = HttpUtility.HtmlDecode(GetContent(tds[6]));
             model.ReadGrade   = HttpUtility.HtmlDecode(GetContent(tds[7]));
             model.WriteGrade  = HttpUtility.HtmlDecode(GetContent(tds[8]));
             model.AllGrade    = HttpUtility.HtmlDecode(GetContent(tds[9]));
             list.Add(model);
         }
         return(list);
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
         return(null);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 窗体移动
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BaseView_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     try
     {
         this.DragMove();
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 异步调用
 /// </summary>
 /// <param name="action"></param>
 public static void Invoke(Action action)
 {
     try
     {
         Application.Current.Dispatcher.BeginInvoke(action);
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 关闭窗体
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void Close_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         this.Close();
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 显示新的主窗体
 /// </summary>
 /// <param name="win"></param>
 protected virtual void ShowView(Window win)
 {
     try
     {
         Application.Current.MainWindow = win;
         win.Show();
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 获取文本资源
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 protected virtual string GetStringResource(string key)
 {
     try
     {
         return(this.Resources[key].ToString());
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
         return("");
     }
 }
Exemplo n.º 10
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            try
            {
                Button button = this.GetTemplateChild("PART_Close") as Button;
                if (button != null)
                {
                    button.Click += Close_Click;
                }
            }
            catch (Exception ex)
            {
                LogUtils.Write(ex);
            }

            try
            {
                PART_CirclyWaiting = this.GetTemplateChild("PART_CirclyWaiting") as Control;
            }
            catch (Exception ex)
            {
                LogUtils.Write(ex);
            }
            try
            {
                this.MouseLeftButtonDown += BaseView_MouseLeftButtonDown;
            }
            catch (Exception ex)
            {
                LogUtils.Write(ex);
            }
            try
            {
                PART_Refresh = this.GetTemplateChild("PART_Refresh") as Button;
            }
            catch (Exception ex)
            {
                LogUtils.Write(ex);
            }
            try
            {
                PART_Setting = this.GetTemplateChild("PART_Setting") as Button;
            }
            catch (Exception ex)
            {
                LogUtils.Write(ex);
            }
        }
Exemplo n.º 11
0
 public Stream GetCheckCode()
 {
     try
     {
         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
         req.Method    = "GET";
         req.Accept    = "*/*";
         req.UserAgent = "Mozilla/5.0";
         req.Headers.Add("Cache-Control", "max-age=0");
         cookie = new CookieContainer();
         req.CookieContainer = cookie;
         HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
         host       = req.Host;
         defaultUrl = resp.ResponseUri.ToString();
         url_code   = defaultUrl.Replace("default2.aspx", "");
         string reqStr = string.Empty;
         using (StreamReader reader = new StreamReader(resp.GetResponseStream(), Encoding.GetEncoding("GB2312")))
         {
             reqStr = reader.ReadToEnd();
         }
         view_state = GetViewState(reqStr);
         HttpWebRequest reqeust = (HttpWebRequest)WebRequest.Create(url_code + "CheckCode.aspx");
         reqeust.Method = "Get";
         reqeust.Accept = "*/*";
         reqeust.Headers.Add("Cache-Control", "max-age=0");
         reqeust.UserAgent       = "Mozilla/5.0";
         reqeust.CookieContainer = cookie;
         HttpWebResponse response = (HttpWebResponse)reqeust.GetResponse();
         MemoryStream    ms       = null;
         using (var stream = response.GetResponseStream())
         {
             Byte[] buffer = new Byte[response.ContentLength];
             int    offset = 0, actuallyRead = 0;
             do
             {
                 actuallyRead = stream.Read(buffer, offset, buffer.Length - offset);
                 offset      += actuallyRead;
             }while (actuallyRead > 0);
             ms = new MemoryStream(buffer);
         }
         response.Close();
         return(ms);
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
         return(null);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// 结束等待
 /// </summary>
 protected virtual void StopWaiting()
 {
     try
     {
         Invoke(() =>
         {
             if (PART_CirclyWaiting != null)
             {
                 PART_CirclyWaiting.Visibility = Visibility.Collapsed;
             }
         });
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
     }
 }
Exemplo n.º 13
0
 private List <GradeModel> GetGradeDetail(string viewState)
 {
     try
     {
         string         post         = url_code + "xscj_gc.aspx?" + string.Format("xh={0}&xm={1}&gnmkdm=N121605", HttpUtility.UrlEncode(username), HttpUtility.UrlEncode(name));
         string         postdata     = string.Format("__VIEWSTATE={0}&ddlXN=&ddlXQ=&Button2=%D4%DA%D0%A3%D1%A7%CF%B0%B3%C9%BC%A8%B2%E9%D1%AF", HttpUtility.UrlEncode(viewState));
         byte[]         postdatabyte = Encoding.GetEncoding("GB2312").GetBytes(postdata);
         HttpWebRequest request      = (HttpWebRequest)WebRequest.Create(post);
         request.ServicePoint.Expect100Continue = false;
         request.Method = "POST";
         request.Headers.Add("Cache-Control", "max-age=0");
         request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36";
         request.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
         request.Headers.Add("Accept-Encoding", "gzip, deflate");
         request.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
         request.Referer       = post;
         request.ContentLength = postdatabyte.Length;
         request.KeepAlive     = true;
         request.ContentType   = "application/x-www-form-urlencoded";
         request.Headers.Add("Upgrade-Insecure-Requests", "1");
         request.CookieContainer   = cookie;
         request.AllowAutoRedirect = false;
         using (Stream stream = request.GetRequestStream())
         {
             stream.Write(postdatabyte, 0, postdatabyte.Length);
         }
         HttpWebResponse response = (HttpWebResponse)request.GetResponse();
         string          str      = string.Empty;
         bool            gzip     = string.Equals(response.Headers["Vary"], "Accept-Encoding", StringComparison.OrdinalIgnoreCase);
         str = DecompressGzip(response.GetResponseStream(), gzip);
         response.Close();
         if (string.IsNullOrWhiteSpace(str) || !str.Contains("__VIEWSTATE"))
         {
             return(null);
         }
         List <string> tab = GetReg("<table", "</table>", str);
         if (tab.Count <= 0)
         {
             return(null);
         }
         List <string>     trs  = GetReg("<tr", "</tr>", tab[0]);
         List <GradeModel> list = new List <GradeModel>();
         foreach (string tr in trs.Skip(1))
         {
             List <string> tds   = GetReg("<td", "</td>", tr);
             GradeModel    model = new GradeModel();
             model.Year             = HttpUtility.HtmlDecode(GetContent(tds[0])).Trim();
             model.Semester         = HttpUtility.HtmlDecode(GetContent(tds[1])).Trim();
             model.ClassCode        = HttpUtility.HtmlDecode(GetContent(tds[2])).Trim();
             model.ClassName        = HttpUtility.HtmlDecode(GetContent(tds[3])).Trim();
             model.ClassNature      = HttpUtility.HtmlDecode(GetContent(tds[4])).Trim();
             model.ClassOwnership   = HttpUtility.HtmlDecode(GetContent(tds[5])).Trim();
             model.Credit           = HttpUtility.HtmlDecode(GetContent(tds[6])).Trim();
             model.GradePoint       = HttpUtility.HtmlDecode(GetContent(tds[7])).Trim();
             model.Grade            = HttpUtility.HtmlDecode(GetContent(tds[8])).Trim();
             model.MinorFlag        = HttpUtility.HtmlDecode(GetContent(tds[9])).Trim();
             model.ExaminationGrade = HttpUtility.HtmlDecode(GetContent(tds[10])).Trim();
             model.ReworkGrade      = HttpUtility.HtmlDecode(GetContent(tds[11])).Trim();
             model.CollegeName      = HttpUtility.HtmlDecode(GetContent(tds[12])).Trim();
             model.Note             = HttpUtility.HtmlDecode(GetContent(tds[13])).Trim();
             model.ReworkFlag       = HttpUtility.HtmlDecode(GetContent(tds[14])).Trim();
             model.ClassEnglishName = HttpUtility.HtmlDecode(GetContent(tds[15])).Trim();
             list.Add(model);
         }
         return(list);
     }
     catch (Exception ex)
     {
         LogUtils.Write(ex);
         return(null);
     }
 }
Exemplo n.º 14
0
        public List <ExamModel> SearchReExamDetail(string viewState, string year, string semester)
        {
            try
            {
                string         post         = url_code + "XsBkKsCx.aspx?" + string.Format("xh={0}&xm={1}&gnmkdm=N121618", HttpUtility.UrlEncode(username), HttpUtility.UrlEncode(name));
                string         postdata     = string.Format("__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE={0}&xnd={1}&xqd={2}", HttpUtility.UrlEncode(viewState), HttpUtility.UrlEncode(year), HttpUtility.UrlEncode(semester));
                byte[]         postdatabyte = Encoding.GetEncoding("GB2312").GetBytes(postdata);
                HttpWebRequest request      = (HttpWebRequest)WebRequest.Create(post);
                request.ServicePoint.Expect100Continue = false;
                request.Method = "POST";
                request.Headers.Add("Cache-Control", "max-age=0");
                request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36";
                request.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
                request.Headers.Add("Accept-Encoding", "gzip, deflate");
                request.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
                request.Referer       = post;
                request.ContentLength = postdatabyte.Length;
                request.KeepAlive     = true;
                request.ContentType   = "application/x-www-form-urlencoded";
                request.Headers.Add("Upgrade-Insecure-Requests", "1");
                request.CookieContainer   = cookie;
                request.AllowAutoRedirect = false;
                using (Stream stream = request.GetRequestStream())
                {
                    stream.Write(postdatabyte, 0, postdatabyte.Length);
                }
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                string          str      = string.Empty;
                bool            gzip     = string.Equals(response.Headers["Vary"], "Accept-Encoding", StringComparison.OrdinalIgnoreCase);
                str = DecompressGzip(response.GetResponseStream(), gzip);
                response.Close();
                if (string.IsNullOrWhiteSpace(str) || !str.Contains("__VIEWSTATE"))
                {
                    return(null);
                }

                List <string> tab = GetReg("<table", "</table>", str);
                if (tab.Count <= 0)
                {
                    return(null);
                }
                List <string>    trs  = GetReg("<tr", "</tr>", tab[0]);
                List <ExamModel> list = new List <ExamModel>();
                foreach (string tr in trs.Skip(1))
                {
                    List <string> tds   = GetReg("<td", "</td>", tr);
                    ExamModel     model = new ExamModel();
                    model.Number    = HttpUtility.HtmlDecode(GetContent(tds[0]));
                    model.ClassName = HttpUtility.HtmlDecode(GetContent(tds[1]));
                    model.Name      = HttpUtility.HtmlDecode(GetContent(tds[2]));
                    model.Date      = HttpUtility.HtmlDecode(GetContent(tds[3]));
                    model.Area      = HttpUtility.HtmlDecode(GetContent(tds[4]));
                    model.Site      = HttpUtility.HtmlDecode(GetContent(tds[5]));
                    model.Type      = HttpUtility.HtmlDecode(GetContent(tds[6]));
                    list.Add(model);
                }
                return(list);
            }
            catch (Exception ex)
            {
                LogUtils.Write(ex);
                return(null);
            }
        }
Exemplo n.º 15
0
        public List <GradeModel> GetGrade()
        {
            try
            {
                string         post = url_code + "xscj_gc.aspx?" + string.Format("xh={0}&xm={1}gnmkdm=N121605", HttpUtility.UrlEncode(username), HttpUtility.UrlEncode(name));
                HttpWebRequest req  = (HttpWebRequest)WebRequest.Create(post);
                req.Method            = "GET";
                req.CookieContainer   = cookie;
                req.KeepAlive         = true;
                req.Referer           = mainUrl;
                req.AllowAutoRedirect = false;
                req.Headers.Add("Upgrade-Insecure-Requests", "1");
                req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36";
                req.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
                req.Headers.Add("Accept-Encoding", "gzip, deflate");
                req.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
                HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
                string          str  = string.Empty;
                bool            gzip = string.Equals(resp.Headers["Vary"], "Accept-Encoding", StringComparison.OrdinalIgnoreCase);
                str = DecompressGzip(resp.GetResponseStream(), gzip);
                resp.Close();
                if (string.IsNullOrWhiteSpace(str) || !str.Contains("__VIEWSTATE"))
                {
                    return(null);
                }
                var viewState = GetViewState(str);
                return(GetGradeDetail(viewState));
            }
            catch (Exception ex)
            {
                LogUtils.Write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JsZTs%2BO2w8bzxmPjs%2BPjs%2BOzs7Ozs7Ozs7Oz47Oz47Pj47Pj47dDw7bDxpPDA%2BOz47bDx0PDtsPGk8MD47PjtsPHQ8cDxwPGw8VGV4dDs%2BO2w8SE5DSjs%2BPjs%2BOzs%2BOz4%2BOz4%2BOz4%2BO3Q8QDA8Ozs7Ozs7Ozs7Oz47Oz47Pj47Pj47PsGtYjdJkWDU8mtEDl8EhORSEnpJ&ddlXN=&ddlXQ=&Button2=%D4%DA%D0%A3%D1%A7%CF%B0%B3%C9%BC%A8%B2%E9%D1%AF";
            //HttpWebRequest req3 = (HttpWebRequest)WebRequest.Create(location2);
            //req3.Method = "POST";
            //req3.Headers.Add("Accept-Encoding", "gzip,deflate");
            //req3.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
            //req3.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
            //req3.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36";
            //req3.ContentType = "application/x-www-form-urlencoded";
            //req3.Referer = location2;
            //req3.KeepAlive = true;
            //byte[] postdatabyte3 = Encoding.UTF8.GetBytes(post3);
            //req3.ContentLength = postdatabyte3.Length;
            //using (Stream stream = req3.GetRequestStream())
            //{
            //    stream.Write(postdatabyte3, 0, postdatabyte3.Length);
            //}
            //HttpWebResponse resp3 = (HttpWebResponse)req3.GetResponse();
            //string str3 = string.Empty;
            //using (StreamReader reader = new StreamReader(resp3.GetResponseStream(), Encoding.GetEncoding("GB2312")))
            //{
            //    str3 = reader.ReadToEnd();
            //}
            //resp3.Close();
        }