ASP.NET MVC Login through database -
i have code here login, it's working can see, hard coded username , password, database accounts, preferably using raw sql not entity framework, please help.
[httppost] public actionresult login(loginviewmodel login) { if (!modelstate.isvalid) { viewbag.error = "form not valid; please review , try again."; return view("login"); } if (login.username == "bpradmin" && login.password == "admin123") formsauthentication.redirectfromloginpage(login.username, true); viewbag.error = "credentials invalid. please try again."; return view("login"); }
i recommend entity framework. should choose between code first or database first. framework easy understand , can pretty cool things once have understood order of events. link tutorial entity framework http://www.entityframeworktutorial.net/
Comments
Post a Comment