This is a migrated thread and some comments may be shown as answers.

ApiController CreateResponse Request is null

1 Answer 234 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 1
Alex asked on 19 Jan 2015, 03:14 AM
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.

1 Answer, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 21 Jan 2015, 12:23 PM
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.

Regards,
Boyan
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Development (API, general questions)
Asked by
Alex
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Share this question
or