none
ASP.NET Web API- authenticate POST and PATCH calls RRS feed

  • Question

  • Web API should be RESTful, but I need to authenticate the calls. Anyone can send REST calls from their browser to my server and I have to make sure that they are logged in (have a sesson cookie) and that they have access to the object they try to read and write to.

    I have followed the steps in this article:

      https://www.strathweb.com/2012/11/adding-session-support-to-asp-net-web-api/

    It works well for GET calls. But I still don't get any information about session or context in POST and PATCH calls. In fact I find that:

       HttpContext.Current == NULL

    How to solve?

    ( I can't believe this isn't a major issue for anyone dealing with REST calls and login-protected data.)



    Vilhelm Heiberg Exorive AS Norway

    Thursday, August 3, 2017 12:40 PM

All replies

  • Hi Vilhelm,

    This forum discusses and asks questions about .NET Framework Base Classes, since your issue is more related asp.net web api, I would suggest that you could post your issue on asp.net web api forum for suitable support.

    https://forums.asp.net/1246.aspx/1?Web+API

    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 4, 2017 9:36 AM
  • Thank you for your answer. I did try to find the proper forum. I could not find any ASP.NET Web Api forum. This was the best I found. Could you please point my to the correct forum?


    Vilhelm Heiberg Exorive AS Norway

    Friday, August 4, 2017 10:17 AM
  • Thank you for your answer. I did try to find the proper forum. I could not find any ASP.NET Web Api forum. This was the best I found. Could you please point my to the correct forum?


    Vilhelm Heiberg Exorive AS Norway

    1) First directly go to: https://forums.asp.net/1246.aspx/1?Web+API

    2) Click "Start a New Thread":


    ASP.NET Forum
    StackOverFlow
    FreeRice Donate
    Issues to report



    Friday, August 4, 2017 2:23 PM