4

I'm trying to create a AWS Lambda function with c# inside the function I will do a WeRequest.

using System.Net;
...
public class Function{
public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context){
...
WebRequest request = WebRequest.Create("http://www.url.de");
// Get the response.
HttpWebResponse apianswer = (HttpWebResponse)request.GetResponse();
...
}}

But GetResponse is not available

The AWS template is using .NETCoreApp.Version=v.1.0 is there no GetResponse usable inside this type of function? Or do I have to install another nuget package? How can I do a webrequest inside the function?

1 Answer 1

1

You should use HttpWebRequest instead of WebRequest.

The WebRequest class is an abstract class. The actual behavior of WebRequest instances at run time is determined by the descendant class returned by the WebRequest.Create method. For more information about default values and exceptions, see the documentation for the descendant classes, such as HttpWebRequest and FileWebRequest.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.