What is the new Startup.cs file for in Visual Studio 2013 projects?

Every OWIN application has a startup class where you specify components for the application pipeline. If you start a new Visual Studio project, you’ll see pieces of OWIN in it. OWIN is a specification that defines an API for framework and servers to cooperation. The point of OWIN is to decouple server and application. For … Read more

Distinction between Kestrel and Katana

Katana is Microsoft’s OWIN implementation and also includes some middleware components for security/authentication, serving static files, and a few other things. Kestrel is Microsoft’s cross-platform development web server that can be used with ASP.NET 5. ASP.NET 5 does not implement OWIN, but has a “bridge” to enable OWIN components to be used in ASP.NET 5 … Read more

How are bearer tokens stored server-side in Web API 2?

They’re not stored server side — they’re issued to the client and the client presents them on each call. They’re verified because they’re signed by the owin host’s protection key. In SystemWeb hosting, that protection key is the machineKey setting from web.config. That’s unnecessary, as long as the protection key the owin host uses doesn’t … Read more

How do I get System.Web.Http.Owin?

The NuGet package Microsoft.AspNet.WebApi.Owin contains that DLL. You can install it by right-clicking on the References folder of your project and selecting “Manage NuGet Packages…” and searching for “Microsoft.AspNet.WebApi.Owin”. Or you can use the Package Manager Console and type the following: Install-Package Microsoft.AspNet.WebApi.Owin If you use the Package Manager Console within Visual Studio, be sure … Read more

Object reference not set to an instance of an object in _Layout.cshtml after updated packages

Here it was fixed by replacing “ScriptBundle” with “Bundle” in BundleConfig. We replaced the following: bundles.Add(new ScriptBundle(“~/bundles/mybundle”).Include( “~/Scripts/…”, “~/Scripts/…”)); with: bundles.Add(new Bundle(“~/bundles/mybundle”).Include( “~/Scripts/…”, “~/Scripts/…”));

Return more info to the client using OAuth Bearer Tokens Generation and Owin in WebApi

You can add as many claims as you want. You can add the standard set of claims from System.Security.Claims or create your own. Claims will be encrypted in your token so they will only be accessed from the resource server. If you want your client to be able to read extended properties of your token … Read more

ASP.NET MVC5 OWIN Facebook authentication suddenly not working

Update 22nd April 2017: Version 3.1.0 of the Microsoft.Owin.* packages are now available. If you’re having problems after Facebook’s API changes from the 27th March 2017, try the updated NuGet packages first. In my case they solved the problem (working fine on our production systems). Original answer: In my case, I woke up on the … Read more

How to change type of id in Microsoft.AspNet.Identity.EntityFramework.IdentityUser

Using a Stefan Cebulak’s answer and a Ben Foster’s great blog article ASP.NET Identity Stripped Bare I have came up with below solution, which I have applied to ASP.NET Identity 2.0 with a generated by Visual Studio 2013 AccountController. The solution uses an integer as a primary key for users and also allows to get … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)