Web Api

3 posts

How to Get the ID of the logged in user in asp.net mvc web api apicontroller

After much googling, and evening Bing-ing revealed nothing I discovered that for some reason I had the line config.SuppressDefaultHostAuthentication(); In my WebAPIConfig.cs file – I removed that and everything magically worked and I could use User.Identity.GetUserId();

How to do a cross domain json request with jquery and asp.net mvc web api

So – I was trying to request some data from one server from another – not normally a big deal, but the data would vary depending on whether or not the user was logged in or not.  I thought just setting up CORS would work (I’m using asp.net mvc web api 2).  I thought a […]

How to fix 404 errors in asp.net web api 2

So – you’ve tried everything and you’re still getting weird 404 errors in asp.net web api 2.    You’ve tried the 4 main ways of fixing it, and you still get nothing – that was what I did anyway.  Finally I started a new project in the solution, and noticed that the problem only occured […]