AlexeyS
AlexeyS
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
yeah looks way better
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
decided to take a part in hackaton and they haven't even mentioned anywhere that you would need to write code in c#
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
yeah but the code is not mine, that was a, let's say an "exercise"
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
thanks for help man, really appreciate it
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
yeah
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
stupid error
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
thanks man
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
it works
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
yess
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
hmm wait
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
me too
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
trying
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
only backend
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
unfortunately I cannot change any front end code
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
hmm
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
well yeah maybe something wrong with my pc after all idk
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
maybe something is wrong with my controller:
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace YourNamespace.Controllers
{
[ApiController]
[Route("[controller]")]
public class LoginController : ControllerBase
{
private static readonly Dictionary<string, string> Users = new Dictionary<string, string>
{
{"admin", "admin"},
{"dsfsdf", "sdfsdf"}
};

[HttpPost]
public IActionResult Post([FromBody] LoginRequest request)
{
if (Users.TryGetValue(request.Login, out var password) && password == request.Password)
{
return Ok(new { access = true });
}

return Ok(new { access = false });
}
}

public class LoginRequest
{
public string Login { get; set; }
public string Password { get; set; }
}
}
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace YourNamespace.Controllers
{
[ApiController]
[Route("[controller]")]
public class LoginController : ControllerBase
{
private static readonly Dictionary<string, string> Users = new Dictionary<string, string>
{
{"admin", "admin"},
{"dsfsdf", "sdfsdf"}
};

[HttpPost]
public IActionResult Post([FromBody] LoginRequest request)
{
if (Users.TryGetValue(request.Login, out var password) && password == request.Password)
{
return Ok(new { access = true });
}

return Ok(new { access = false });
}
}

public class LoginRequest
{
public string Login { get; set; }
public string Password { get; set; }
}
}
119 replies
CC#
Created by AlexeyS on 7/28/2023 in #help
✅ (solved) dot net cannot send post request to my endpoint
body {
margin: 0px;
padding:0px;
box-sizing:border-box;
user-select:none;
}

.wrapper {
margin: 200px auto 0 auto;
padding: 30px;
border: 2px solid #808080;
border-radius: 5px;
width: 50%;
}

.wrapper input {
border: 1px solid #808080;
border-radius: 3px;
font-size: 16px;
letter-spacing: 2px;
background-color: #dcdcdc;
width: 80%;
margin: 50px auto;
padding: 5px;
outline: none;
}

#submit {
display: block;
width: 100px;
cursor: pointer;
background-color: #9bffa6;
border: none;
outline: none;
padding: 10px;
border-radius: 5px;
}

#submit:hover {
transition: .5s all ease;
background-color:#67fa3d;
}

#result {
width:120px;
background-color:#97f5ef;
padding:10px 20px;
margin:50px auto;
text-align:center;
border-radius:5px;
}

#result input{
width:100%;
height:100%;
margin:0;
padding:0;
background-color:transparent;
border:none;
outline:none;
user-select:none;
text-align:center;
}
body {
margin: 0px;
padding:0px;
box-sizing:border-box;
user-select:none;
}

.wrapper {
margin: 200px auto 0 auto;
padding: 30px;
border: 2px solid #808080;
border-radius: 5px;
width: 50%;
}

.wrapper input {
border: 1px solid #808080;
border-radius: 3px;
font-size: 16px;
letter-spacing: 2px;
background-color: #dcdcdc;
width: 80%;
margin: 50px auto;
padding: 5px;
outline: none;
}

#submit {
display: block;
width: 100px;
cursor: pointer;
background-color: #9bffa6;
border: none;
outline: none;
padding: 10px;
border-radius: 5px;
}

#submit:hover {
transition: .5s all ease;
background-color:#67fa3d;
}

#result {
width:120px;
background-color:#97f5ef;
padding:10px 20px;
margin:50px auto;
text-align:center;
border-radius:5px;
}

#result input{
width:100%;
height:100%;
margin:0;
padding:0;
background-color:transparent;
border:none;
outline:none;
user-select:none;
text-align:center;
}
119 replies