Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6559819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:22:45+00:00 2026-05-25T13:22:45+00:00

below is my code..I get an error -The remote server returned an error: (403)

  • 0

below is my code..I get an error -“The remote server returned an error: (403) Forbidden.”..:

           TimeSpan t = DateTime.Now - new DateTime(1970, 1, 1);

           string content = @"<entry xmlns='http://www.w3.org/2005/Atom'   
            xmlns:media='http://search.yahoo.com/mrss/'  
            xmlns:gphoto='http://schemas.google.com/photos/2007' >
            <title type='text'>Trip To Italy</title>
            <summary type='text'>This was the recent trip I took to Italy.</summary>
            <gphoto:location>Italy</gphoto:location>
            <gphoto:access>public</gphoto:access>
            <gphoto:timestamp>" + t.Milliseconds.ToString() + @"</gphoto:timestamp>
            <media:group><media:keywords>italy</media:keywords></media:group>
            <category scheme='http://schemas.google.com/g/2005#kind' 
             term='http://schemas.google.com/photos/2007#album'></category>
            </entry>";
        ServicePointManager.ServerCertificateValidationCallback = new 
        RemoteCertificateValidationCallback(delegate(object sender2, X509Certificate 
        certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            return true;
        });
        string url = "https://www.picasaweb.google.com/data/feed/api/user/default";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = "POST";
        request.ContentType = "application/atom+xml";
        request.Headers.Add(HttpRequestHeader.Authorization, "AuthSub token=\"" + 
        Session["token"].ToString() + "\"");
        request.Headers.Add("GData-Version", "2.0");
        byte[] send = System.Text.UTF8Encoding.UTF8.GetBytes(content);
        request.ContentLength = send.Length;
        int bytesRead = 0;
        Stream requestStream = request.GetRequestStream();
        while (send.Length - bytesRead > 1)
            requestStream.Write(send, bytesRead++ , 1); //Edited
        requestStream.Close();
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        StreamReader responseReader = new StreamReader(response.GetResponseStream());

        string responseStr = responseReader.ReadToEnd();

please help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:22:46+00:00Added an answer on May 25, 2026 at 1:22 pm

    Look at the code

    while (send.Length - bytesRead > 1)
            requestStream.Write(send, 0, bytesRead++);
    

    Here you’re sending the first byte, then the first two, then the first three, and so on. Try the following instead (not tested):

    for(int i=0;i<send.Length;i++){
      requestStream.Write(send,i,1);
      bytesRead++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the below code: var id=obj.setid({{info}}); I get an error saying illegal character and
I get this error, while I'm testing the code below: You have an error
I get the following error with the code below. expected constructor, destructor, or type
When I try to use the code below I get a duplicate variable error
I get the following error when I try and execute the code down below.
I can get the first record back from the code below in SQL Server
I am getting a {The remote server returned an error: (415) Unsupported Media Type.}
I can't get the code below to compile (see errors). Advice on correction would
I had used the below code to get the row index of the UIPickerView
Is there a way to get the code below to return null if no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.