Membership user in ASP.NET? MVC3?

If you're using MembershipProvider it has the ValidateUser Method.

Up vote 0 down vote favorite share g+ share fb share tw.

I have been working on ASP. Net MVC3. I created view and controller.

Also, I have a model to create account. Controller: HttpPost public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState. IsValid) { ----> if (model.

UserName == "Guven" && model. Password == "12345") { FormsAuthentication. SetAuthCookie(model.

UserName, false); return RedirectToAction("Index", "Home"); } else { ModelState. AddModelError("", "aaaaaaaaaaaaaaaaaa. "); } } return View(model); } I want to make from the database to control that the line marked on the above code.

My question is:How can I do that controller? Asp. Net-mvc-3 link|improve this question asked Sep 6 '11 at 6:55Selo3509 77% accept rate.

If you're using MembershipProvider it has the ValidateUser Method. You'll need to change your marked line to: if (Membership. ValidateUser(model.

UserName, model. Password)) If your not using MembershipProvider yet, you'll might want to implement it. There are two primary reasons for creating a custom membership provider.

You need to store membership information in a data source that is not supported by the membership providers included with the . NET Framework, such as a FoxPro database, an Oracle database, or other data sources. You need to manage membership information using a database schema that is different from the database schema used by the providers that ship with the .

NET Framework. A common example of this would be membership data that already exists in a SQL Server database for a company or Web site. Have a look at: Sample Membership Provider Implementation.

First of all ,thanks for your interesting. As you said,How can I modify my controller code? Also,I have to pull from database user information.

– Selo Sep 6 '11 at 7:02.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions