dotnetopenauth - Google Site Verification API -


i trying develop google site verification system using asp.net. using google explorer (https://developers.google.com/site-verification/v1/webresource/insert) test request method such json , http request format.

this sending google.

post https://www.googleapis.com/siteverification/v1/webresource?verificationmethod=site&key={your_api_key}  content-type:  application/json authorization:  bearer xxxxxxxxxxxxxxx x-javascript-user-agent:  google apis explorer  {  "id": "myid",  "owners": [   "development@gmail.com"  ],  "site": {   "type": "site",   "identifier": "http://www.example.net/"  } } 

i getting following response google.

{  "error": {   "errors": [    {     "domain": "global",     "reason": "backenderror",     "message": "backend error"    }   ],   "code": 503,   "message": "backend error"  } } 

>

iauthorizationstate authorization;             protected void page_load(object sender, eventargs e)     {         if (googleclient != null)         {                                             if (ispostback)             {                                     authorization = googleclient.processuserauthorization();                 if (authorization != null)                 {                     this.accesstoken = authorization.accesstoken;                  }                 else if (this.accesstoken == null)                 {                     googleclient.requestuserauthorization(scope: new[] { googleclient.scopes.webmaster.siteverification });                 }             }                                        }     }      protected void button1_click(object sender, eventargs e)     {           if (authorization != null)           {               iowebmasterinsertgraph webmasterinsertgraph = googleclient.requestforverification(authorization);                           }     }  public iowebmasterinsertgraph requestforverification(iauthorizationstate authstate)         {             if ((authstate != null) && (authstate.accesstoken != null))             {                 webrequest request = webrequest.create("https://www.googleapis.com/siteverification/v1/webresource?verificationmethod=site");                   string path = hostingenvironment.mappath(@"~/app_data/googleinsert.json");                  memorystream ms = new memorystream();                 filestream filestreem = new filestream(path, filemode.open, fileaccess.read);                 byte[] bytes = new byte[filestreem.length];                 filestreem.read(bytes, 0, (int)filestreem.length);                 ms.write(bytes, 0, (int)filestreem.length);                  request.contenttype = "application/json";                 request.method = "post";                 request.contentlength = ms.length;                 ms.seek(0, seekorigin.begin);                 using (stream requeststream = request.getrequeststream())                 {                     ms.copyto(requeststream);                 }                   webresponse response = request.getresponse();                  if (response != null)                 {                     stream responsestream = response.getresponsestream();                      if (responsestream != null)                     {                         //return googlegraph.deserialize(responsestream);                         return webmasterinsertgraph.deserialize(responsestream);                     }                 }             }             return null;         } 

does know reason this?

why don't use google .net client library site verification? have sample code that. try out...


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -