ApiController CreateResponse Request is null

Thread is closed for posting
2 posts, 0 answers
  1. Alex
    Alex avatar
    1 posts
    Member since:
    Jan 2015

    Posted 18 Jan 2015 Link to this post

    I have created a custom Membership provider for entity framework for a User model. In the provider, I instantiate a new UsersController (uc = new UsersController() )

    I've tried calling both uc.Put([some id], user) and uc.Post(user) and neither are working. The Post comes to the OpenAccessBaseApiController and does its work as expected. It successfully posts a new object to the DB. When it tries to call CreateResponse it goes to the concrete UsersController method CreateResponse. The problem is here. In this method, the Request (which is stored in ApiController) is null, so when it says Request.CreateResponse(httpStatusCode, entityToEmbed) it throws an exception. 

    When I call the api service from Postman as a GET, it works fine (and the Request property is populated and not null). I can't seem to find out why Request isn't getting populated for Post and PUT. Any help is greatly appreciated.
  2. Boyan
    Boyan avatar
    100 posts

    Posted 21 Jan 2015 Link to this post

    Hello Alex,

    Please note that it is possible to implement a custom Membership provider that uses Telerik Data Access for accessing the database. An example of how to implement a custom membership provider for MVC could be found in this blog post. Also you may find interesting this blog post that describes in greater detail the membership mechanism used in the MVC projects.

    That being said could I ask you to clarify if this is indeed that you would like to achieve - is it a custom membership provider? If this is in fact the case -  have you tried the approaches described in the blog posts linked above? Could you please let us know what steps have lead to the issue you described? Also it would be very helpful if you could provide a code snippet demonstrating the issue on your side. This information would help us identify the cause of the issue faster.

    I am looking forward to hearing from you.

    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top