Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
AWS LAMBDA .NET CORE throws 403 Forebidden Error if called service from Function Handler

What I have tried:

                ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
                ServicePointManager.Expect100Continue = true;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                HttpWebRequest request = WebRequest.Create(requestUrl) as HttpWebRequest;
                request.Headers.Add("userId", iusr);
                request.Method = "GET";
                request.Credentials = System.Net.CredentialCache.DefaultCredentials;
                request.ContentType = "application/json";
                request.Accept = "application/json";

                Console.WriteLine("S3 Upload --> Debug  :  4");

                try
                {
                    HttpWebResponse myHttpWebResponse = (HttpWebResponse)request.GetResponse();
                    System.IO.StreamReader myStreamReader = new System.IO.StreamReader(myHttpWebResponse.GetResponseStream());

                    response = myStreamReader.ReadToEnd();
}
Posted
Updated 31-Oct-19 0:38am
Comments
ZurdoDev 31-Oct-19 7:28am    
1. Where is Lambda?
2. 403 means you are not authorized.

1 solution

I bet it's because you're not passing the password in your request header...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900