[RESOLVED]web API save parameters

I want to build a web API that saves parameters (username and password) sent by the URL into the database:



using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace task.Models
  public class RegisterViewModel
    [Display(Name = "Email")]
    public string Email { get; set; }

    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Confirm password")]
    [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
    public string ConfirmPassword { get; set; }

the username and password should be saved in the default table ASPNetUsers created by any MVC default project.

So what does the API controller should contain. I really don’t understand what to do this is my problem.I’m asked to build the web api andneed to understand the procedure rather than only coding.

please help Urgent!!!

Hi lolo,

First, I suggest that you could send the request with Post type.

To consume Web API, we could use HttpClient and we could add additional data.

More information, please refer to:

# Calling ASP.NET WebAPI using HttpClient


Secondly, to store the user information in the ASPNetUsers, you could use ASP.NET Identity. (Refer to default MVC template to learn how to use)

In your Web API, you could add the corresponding parameters in the specify method.

public void Post(string UserName, string Password)



On the other hand, if you have the issue of Web API, I suggest that you should post it to the
Web API forum.

Best Regards


Leave a Reply