"The remote server returned an error: (403) Forbidden" System.Net.WebException

2,519 views
Skip to first unread message

Akhil Sarikonda

unread,
Apr 20, 2012, 2:52:05 AM4/20/12
to gs-dis...@googlegroups.com
I am trying to implement Resumable Uploads from my C# Console Application. 
While Initiating POST Request , the server is responding with  this.   "The remote server returned an error: (403) Forbidden."} System.Net.WebException .

The Uri i am sending is "https://1song.commondatastorage.googleapis.com/Test1Gb.rar" with POST request.

"Test1Gb.rar "---- is the File Name.

As mentioned in Google Cloud Developers Guide, i am sending the POST Request as following.

           private HttpWebRequest PostCreateRequest(string authValue, DateTime date, string contentType,int contentLength)
        {
            var request = (HttpWebRequest)WebRequest.Create(_uri);
            request.Method = PureRequestMethod(_method).ToString();

            if (_webProxy != null)
                request.Proxy = _webProxy;

            request.Headers.Add(@"Authorization", authValue);
            request.Headers.Add(@"x-goog-resumable", "start");
            request.Date = date;
            request.ContentLength = 0;
            request.ContentType = contentType;
            
            return request;
        }//End POST Request Generation

I Have been trying this for 1 week. I don't know what is wrong with this. 

Is there any help I can get from anyone?

Thankyou.

Google Storage Team

unread,
Apr 22, 2012, 1:57:00 PM4/22/12
to gs-dis...@googlegroups.com
Hi Akhil,

I'm not a .Net/C# expert but your code looks reasonable to me. The 403 Forbidden response usually indicates a permissions error. Do you have permission to write that object (as controlled by the ACL associated with the 1song bucket)?

If that's not the problem, if you could capture and send me (gs-...@google.com) a network trace, I'd be happy to take a closer look.

Thanks,

Marc
Google Cloud Storage Team


--
You received this message because you are subscribed to the Google Groups "Google Cloud Storage" group.
To view this discussion on the web visit https://groups.google.com/d/msg/gs-discussion/-/Eh_uCjPI5zMJ.
To post to this group, send email to gs-dis...@googlegroups.com.
To unsubscribe from this group, send email to gs-discussio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gs-discussion?hl=en.

Akhil Sarikonda

unread,
Apr 23, 2012, 2:22:09 AM4/23/12
to gs-dis...@googlegroups.com
Thank you for your response, Marc.

I can stream and transfer files >2Gb from my C# console application to GCS , which is a PUT Request. So, if i can write files to my 1song bucket, i guess i should also  be able to perform POST Request on this bucket.

I can provide my sample code here. so, you can easily debug  or go through it , if you can. I dont have an problem to share this code as i took reference from an open source here  https://github.com/acropolium/SharpGs .
Once this issue  is solved this client app is almost done.

I hope you could replay me on this.  

Thank you.  

Implementing Resumable Uploads.rar
Reply all
Reply to author
Forward
0 new messages