I am new to mvc3 and I am trying to create a login. I do not want to use the LogOn view. Basically, the user will enter his/her username and password,then I ll check it if the user exists in my database,then if the user exists,he/she will go through next page.I have implemented the searching part of the user in database.Could you help me?
1 Answer
In your LogOn controller action, once you have verified the credentials of the user against your database and emitted the authentication cookie you could simply return a RedirectToAction:
return RedirectToAction("SomeNextAction", "SomeController");
2 Comments
Ktt
alright but what about if the user enters the url of the page which the user is suppose to go on after login?
Richard Astbury
Add the [Authorize] attribute to controllers/actions which require authentication.