解决方案 »

  1.   

    string url = "http://api.jiekou.com/?jd=" + dr["lon"].ToString() + "&wd=" + dr["lat"].ToString();
                                        WebClient MyWebClient = new WebClient();
                                        MyWebClient.Credentials = CredentialCache.DefaultCredentials;
                                        Byte[] pageData = MyWebClient.DownloadData(url);
                                        string pageHtmlT = Encoding.UTF8.GetString(pageData);
      

  2.   

         string postData = "jd="+ Sina.APP_ID +"&wd="+ Sina.APP_KEY ;  
                    byte[] bytes = Encoding.UTF8.GetBytes(postData);  
                    WebClient client = new WebClient();  
                    client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");  
                    client.Headers.Add("ContentLength", postData.Length.ToString());  
                    byte[] responseData = client.UploadData("https://api.weibo.com/oauth2/access_token", "POST", bytes);  
    不是这样做的?
      

  3.   

    首先接口好像前台页面不需要放什么东西吧?然后地址后面是接  xxx.aspx?id=xxx&pwd=xxx 少了个问号
      

  4.   

    是不是 因为我前端写了js的代码,导致一定要在浏览器里才能运行,如果是程序代码去调用,就无法打开浏览器就不能运行js代码了,请大神指教
      

  5.   

    反正是要跟数据库交互,你就没必要纠结js了
    直接在后台的aspx.cs的page_load里写代码,获取url参数,执行数据库插入,不好吗
      

  6.   


    /// <summary>   
            /// 用HttpWebRequest取得网页源码   
            /// 对于带BOM的网页很有效,不管是什么编码都能正确识别   
            /// </summary>   
            /// <param name="url">网页地址" </param>    
            /// <returns>返回网页源文件</returns>   
            public static string GetHtmlSource(this string url)
            {
                //处理内容   
                string html = "";
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Accept = "*/*"; //接受任意文件
                request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)"; // 模拟使用IE在浏览
                request.AllowAutoRedirect = true;//是否允许302
                //request.CookieContainer = new CookieContainer();//cookie容器,
                request.Referer = url; //当前页面的引用            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Stream stream = response.GetResponseStream();
                StreamReader reader = new StreamReader(stream, Encoding.Default);
                html = reader.ReadToEnd();
                stream.Close();            return html;
            }