views:

14

answers:

1

Hi friends,i have created a new user using custom membership provider in asp.net mvc 2.0.It is created the user successfully.But now i want to check whether it is created successfully or not .If it is created successfully i want to redirect it to other page ,if not i will remain in the same page.please tell me how to do this and this logic has to write after user creation.

A: 

If the user is not created you would generally get an exception. So you could wrap the code creating the user into a try/catch:

public ActionResult CreateUser()
{
    try
    {
        // TODO: Attempt to create the user
    }
    catch (Exception ex)
    {
        // Stay on the same view
        return View();
    }
    return RedirectToAction("Success");
}
Darin Dimitrov
Hi darin,but after registering the new user again it has to ask for logon otherwise it wont allow to enter any areas.But what i want is if register a user immediately a next page will appear showing account creation is successfully and in that page if i click Continue button it has to go to order page with registration details.But now it will go to order page but registered user is not loggedin.So again again i have to enter username and password.please tell me the answer.my Controller action is as follows,
Mallikarjuna