Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
Angular calling api/account/register

I am trying to register a user via the web api using Angular 2. My call is as follows:

this.http.post('http://localhost/Authenticated/api/account/register', JSON.stringify(this.cred)).subscribe(function (data) {
    console.log(data);
});

My form is defined:

<form id="userData" (submit)="submitForm()">
    <input type="text" name="userName" placeholder="Name" [(ngModel)]="cred.userName" />
    <input type="password" name="password" placeholder="Password" [(ngModel)]="cred.password"/>
    <input type="password" name="confirmPassword" placeholder="Password" [(ngModel)]="cred.confirmPassword"/>
    <input type="submit" id="register" value="Register" />
</form>

When I make a post I am getting an HTTP415 error:

HTTP415: UNSUPPORTED MEDIA TYPE - The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It depends on your web API mostly for login/register we post form data with this Content-Type Content-Type: application/x-www-form-urlencoded, otherwise you can use Content-Type: application/json.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda