<main class="form-signin"> <form> <img class="mb-4" src="/MainLogo.png" alt="" width="72" height="57"> <h1 class="h3 mb-3 fw-normal">Please sign in</h1> <div class="form-floating"> <input type="email" class="form-control" id="floatingInput" @bind="username" placeholder="name@example.com"> <label for="floatingInput">Email address</label> </div> <div class="form-floating"> <input type="password" class="form-control" id="floatingPassword" @bind="password" placeholder="Password"> <label for="floatingPassword">Password</label> </div> <div class="checkbox mb-3"> <label> <input type="checkbox" value="remember-me"> Remember me </label> </div> <button class="w-100 btn btn-lg btn-primary" @onclick="sign">Sign in</button> <p class="mt-5 mb-3 text-muted">© 2017–2021</p> </form> </main>
protected async void sign() { Dictionary<string, string> keyvalues = new Dictionary<string, string>(); keyvalues.Add("userName", username); keyvalues.Add("password", password); var client = ClientFactory.CreateClient("WebAPI"); var request = new HttpRequestMessage(HttpMethod.Post,"api/Account/Login"); var content = JsonConvert.SerializeObject(keyvalues); StringContent stringContent = new StringContent(content, System.Text.Encoding.UTF8,"application/json"); HttpResponseMessage response = await client.PostAsync(request.RequestUri, stringContent); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)