Using JWT to implement Authentication on Asp.net web API

Your understanding of JWTs is good. But here are a couple corrections and some recommendations. Authentication and Authorization JWTs have nothing to do with authentication. Hitting your DB and hashing passwords only happens when you authenticate on creation of the JWT. This is orthogonal to JWTs and you can do that in any way you … Read more

Accessing the query string in ASP.Net Web Api?

Even though @Kiran Challa’s answer is correct, there are few situations that you might prefer to get URL parameters directly from the URL. in those scenarios, try this: using System.Net.Http; var allUrlKeyValues = ControllerContext.Request.GetQueryNameValuePairs(); string p1Val = allUrlKeyValues.LastOrDefault(x => x.Key == “p1”).Value; string p2Val = allUrlKeyValues.LastOrDefault(x => x.Key == “p2”).Value; string p3Val = allUrlKeyValues.LastOrDefault(x => … Read more

web api 2 routing – The resource cannot be found

WebApi routing started to work after I’ve changed the position of Register api method to be above of register routes: protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }

MVC5, Web API 2 and Ninject

The Ninject.Web.WebApi NuGet package has just been released. From now on the preferred solution is using that package. I couldn’t find any related documentation but after installing the package everything worked for me. Install-Package Ninject.Web.WebApi After installation both the normal MVC and the API controller instances are provided by Ninject. If you have Ninject.Web.Common already … Read more

ASP.net Core RC2 Web API POST – When to use Create, CreatedAtAction, vs. CreatedAtRoute?

There’s a few different questions here which should probably be split out, but I think this covers the bulk of your issues. Why create names for actions and routes? What’s the difference between action names and route names? First of all, actions and routes are very different. An Action lives on a controller. A route … Read more

What / why is Roslyn “needed” in /bin folder of Asp.Net

This is taken from MSDN forum. https://social.msdn.microsoft.com/Forums/vstudio/en-US/442b100a-2b88-4ac4-b655-0c1345791f15/roslyn-cscexe-web-api-2-on-hosting-server?forum=msbuild I have noticed a minor drawback to uninstalling this package: https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform Some of the new C# 6.0 language features if used in Views (MVC project) will not compile. Many of my views use the ?. null checking operator for accessing Model properties. All of these views now return … Read more