TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
James James
NA
9
2.7k
Amazon Cognito and ASP.NET C# Integration
Nov 17 2020 2:09 AM
Hello, I am trying to implement cognito user pool into my login, register and logout and I have tried this code for Signup
protected
void
Button1_Click(
object
sender, EventArgs e)
{
AddCognitoUser();
}
static
async Task AddCognitoUser()
{
string
username =
"Name"
;
string
password =
"Password"
;
string
phonenumber =
"+678172932"
;
string
email =
"
[email protected]
"
;
AmazonCognitoIdentityProviderClient provider =
new
AmazonCognitoIdentityProviderClient(
new
Amazon.Runtime.AnonymousAWSCredentials());
SignUpRequest signUpRequest =
new
SignUpRequest();
signUpRequest.ClientId =
"clientid"
;
signUpRequest.Username = username;
signUpRequest.Password = password;
AttributeType attributeType =
new
AttributeType();
attributeType.Name =
"phone_number"
;
attributeType.Value = phonenumber;
signUpRequest.UserAttributes.Add(attributeType);
AttributeType attributeType1 =
new
AttributeType();
attributeType1.Name =
"email"
;
attributeType1.Value = email;
signUpRequest.UserAttributes.Add(attributeType1);
try
{
SignUpResponse result = await provider.SignUpAsync(signUpRequest);
}
catch
(Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
}
When i run these codes, there is an error saying "An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dll" and i tried to find but there is nothing null in the codes. Is there anything that i do wrong?
Or is there any other better tutorial that help to integrate cognito with asp.net c#?
Any help will be really helpful.
Thank You.
Reply
Answers (
2
)
Capture image from webcam and load it on image control in asp , c#
Get Post Like and View.