We are going to talk about:
What you get out of the box with ASP.NET Core 2.0
How to use Postman to test your API
Changing the default configuration of our project
Testing the content negotiation
Restricting media types
More about formatters
Implementing a custom formatter
Consuming API programmatically
Every day millions of users are commuting on the electronic highway. For you as a web developer you want to ensure that your website is adapted to the needs of the modern user and that you're not putting up road blocks, forcing users to take side roads.
Using modern web standards you can remove these road blocks and optimise your website to accommodate all users regardless of the browser they're using.
احراز هویت با آفیس 365 در سی شارپ
if (ModelState.IsValid) { // find user by username var user = await _signInManager.UserManager.FindByNameAsync(Input.Username); // validate username/password using ASP.NET Identity if (user != null && (await _signInManager.CheckPasswordSignInAsync(user, Input.Password, true)) == SignInResult.Success) { await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id, user.UserName, clientId: context?.Client.ClientId)); // only set explicit expiration here if user chooses "remember me". // otherwise we rely upon expiration configured in cookie middleware. AuthenticationProperties props = null; if (LoginOptions.AllowRememberLogin && Input.RememberLogin) { props = new AuthenticationProperties { IsPersistent = true, ExpiresUtc = DateTimeOffset.UtcNow.Add(LoginOptions.RememberMeLoginDuration) }; }; // issue authentication cookie with subject ID and username var isuser = new IdentityServerUser(user.Id) { DisplayName = user.UserName }; await HttpContext.SignInAsync(isuser, props); if (context != null) { if (context.IsNativeClient()) { // The client is native, so this change in how to // return the response is for better UX for the end user. return this.LoadingPage(Input.ReturnUrl); } // we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null return Redirect(Input.ReturnUrl); } // request for a local page if (Url.IsLocalUrl(Input.ReturnUrl)) { return Redirect(Input.ReturnUrl); } else if (string.IsNullOrEmpty(Input.ReturnUrl)) { return Redirect("~/"); } else { // user might have clicked on a malicious link - should be logged throw new Exception("invalid return URL"); } } await _events.RaiseAsync(new UserLoginFailureEvent(Input.Username, "invalid credentials", clientId: context?.Client.ClientId)); ModelState.AddModelError(string.Empty, LoginOptions.InvalidCredentialsErrorMessage); }
کنفرانس NET Conf: Focus on Blazor.
.NET Conf: Focus on Blazor is a free, one-day livestream event that features speakers from the community and .NET product teams that are working on building web apps with C# and Blazor. You don't need to use JavaScript anymore with Blazor technology! Blazor lets you build interactive web UIs using C# instead of JavaScript.
At The Bit, we understand how overwhelming it can be to navigate through all the different tutorials online and try to teach yourself programming skills alone.
That’s why we’ve created The Bit — we’ll match you to a peer with similar skills and interests to take the tutorial of your choosing.
Find a tutorial you want to take below? Upload it to our platform to get the support and accountability you need to start building cool shit.