OL. OL. -4 years ago 84
ASP.NET (C#) Question

How to get webforms signed in user in Web API

I have ASP.NET webforms app. This app uses cookie-based authentication. Also I have ASP.NET Web API that receives AJAX requests from webforms app. What i'd like to do is have possibility in controller's actions know if request comes from authenticated user and get user id.
I don't have much experience in web development.
Could you advice some good approach to accomplish this goal?

Answer Source

I think most suitable way is to use OWIN cookieAuthentication middleware. It is described here Is possible to use cookie based authentication with ASP.NET Web API and SPA?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download