ASP.NET MVC 5 WEB API with individual user account authentication -
i'm new asp.net mvc 5 , webapi 2 technology. developing web service desktop application.
i have developed web service individual user business relationship authentication in asp.net mvc 5 web api 2. refer link :- " http://vod.com.ng/en/video/kyxclfz_cw8/8-authenticated-webapi-aspnet-mvc-5-fundamentals-5-webapi-2 ". helped me need add together layers in project i.e. web , core.
i shifted "accountbindingmodels.cs" , "accountviewmodels.cs" models folder in web poco folder in core, after running programme getting error " post /api/account/register 500 (internal server error) " , " error occurred when trying create controller of type 'accountcontroller' ".
i want add together api controllers , model classes authenticated individual user account. please help. allow me know else need know. in advance.
code unityconfig.cs file
public static void registertypes(iunitycontainer container) { container.registertype(typeof(irepository<>), typeof(repository<>)); container.registertype(typeof(dbcontext), typeof(datacontext)); }
controller
namespace desktopapp.controllers { public class studentlogincontroller : apicontroller { private irepository<studentlogin> _studentloginrepository; public studentlogincontroller(irepository<studentlogin> studentloginrepository) { _studentloginrepository = studentloginrepository; } [httppost] [route("api/studentlogin/post")] public studentlogin post(studentlogin logindata) { var studentlogindetails = _studentloginrepository.getall().where(p => p.studentname == logindata.studentname && p.studentpassword == logindata.studentpassword).firstordefault<studentlogin>(); homecoming studentlogindetails; }
solved issue creating default accountcontroller , deleting parameterized accountcontroller.
public usermanager<identityuser> usermanager { get; private set; } public isecuredataformat<authenticationticket> accesstokenformat { get; private set; } public accountcontroller() { usermanager = startup.usermanagerfactory(); accesstokenformat= startup.oauthoptions.accesstokenformat; }
asp.net-mvc-5 asp.net-web-api2
No comments:
Post a Comment