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

  • SEARCH
  • Home
  • 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 8810603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:09:32+00:00 2026-06-14T03:09:32+00:00

I have the following code that supposed to send data from web application developed

  • 0

I have the following code that supposed to send data from web application developed in asp.net (VB.Net) to android device using Google Cloud Messaging Technology but I keep getting this error:
The remote server returned an error: (401) Unauthorized.

the code is as following:

Dim regID As String = "REG_ID_ that i got when I developed the Clint side of this technology"
Dim request As WebRequest = WebRequest.Create("https://android.googleapis.com/gcm/send")
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.Headers.Add("Authorization:Here_I_Provided_the_Server_API_Key")
Dim collapsKey = Guid.NewGuid.ToString("N")
Dim postdata As String = regID + TextBox1.Text + collapsKey
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postdata)
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim resposne As WebResponse = request.GetResponse
Dim dataresponse As Stream = resposne.GetResponseStream
Dim reader As New StreamReader(dataresponse)
Dim sResponseFromServer As String = reader.ReadToEnd
Label1.Text = sResponseFromServer
reader.Close()
dataresponse.Close()
resposne.Close()

any Idea how can I fix this issue.

regards

Husam

  • 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-06-14T03:09:33+00:00Added an answer on June 14, 2026 at 3:09 am

    Maybe instead of

    "Authorization:Here_I_Provided_the_Server_API_Key"
    

    you should try

    "Authorization: key=Here_I_Provided_the_Server_API_Key"
    

    Also make sure you have the correct sender ID on the application side, that handles GCM requests.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I have the following code that is supposed to refresh data when a
I have the following python code that expects data coming from the serial port,
So I have the following code. It's supposed to send HTML emails that were
I have the following bit of code that reads data from the an Oracle
I have the following code that suppose used to Send Data to Server using
The following code is supposed to find electors that do not have a postal
I have following code that I am compiling in a .NET 4.0 project namespace
I have the following code that has @item.ID from razor: <a href=# id=deleteitem(@item.ID)>Delete</a> When
I have the following code that is supposed to display 3 products when the
I have the following code which is supposed to send a notification on ajax

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.