执行身份验证请求返回意外结果:404以下代码

时间:2015-07-09 05:32:54

标签: asp.net wcf web

我在下面的代码中遇到了异常:

 public void LoginToBlog1()
{
    Service service = new Service("blogger", "blogger-example");
    SqlConnection con = new SqlConnection(connection);
    SqlCommand cmd = new SqlCommand();
    string blogname = string.Empty;
    cmd.CommandText = "select UserName,Password,BlogName from ApplicationBlogs where ApplicationId=" + appid1 + " and BlogType='" + DownloadType + "' and Category='" + category1 + "' and BlogUrl is null";
    cmd.Connection = con;
    con.Open();
    SqlDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
        string username = dr["UserName"].ToString();
        string password = dr["Password"].ToString();
        service.Credentials = new GDataCredentials(username, password);
        blogname = dr["BlogName"].ToString();
    }
    con.Close();

    Uri blogPostUri = SelectUserBlog(service, blogname);
    ListBlogEntries(service, blogPostUri);


}


 static Uri SelectUserBlog(Service service, string title)
    {
        FeedQuery query = new FeedQuery();
        query.Uri = new Uri("https://www.blogger.com/feeds/default/blogs");
        AtomFeed feed = service.Query(query);
        Uri blogPostUri = null;
        if (feed != null)
        {
            foreach (AtomEntry entry in feed.Entries)
            {
                if (title.Equals(entry.Title.Text))
                {
                    for (int i = 0; i < entry.Links.Count; i++)
                    {
                        if (entry.Links[i].Rel.Equals("https://schemas.google.com/g/2005#post"))
                        {
                            blogPostUri = new Uri(entry.Links[i].HRef.ToString());
                        }
                    }
                    return blogPostUri;
                }
            }
        }
        return blogPostUri;
    }
AtomFeed feed = service.Query(query);处的

例外情况 请帮帮我。

0 个答案:

没有答案