You must Sign In to post a response.
  • Category: ASP.Net MVC

    How to create user login and forget password using Ado enttity frame work

    Hi friends,

    Am new to MVC with Basic knowledge please help how to create a login form and forget password generating temporary password which valid for a time span of 24 hrs,

    please help me out am wondering its very urgent.

    Thanks In Advance




    Thanks & Regards
    Prem Kumar A
  • #768217
    Am expecting the controls with the below funcationality please help me out


    Allow the user to verify the Secret/Question for a maximum of 3 to 5 attempts
    On successful validation, Send an e-mail with random generated password with a validity of 24hrs.
    The e-mail must contain only the password but not both username/password.
    When user logs in with temporary password, then user must be forced to create a new password before going to home page.

  • #768222
    Hi,

    To completely create this Forgot Password Functionality you have create the Model in clear structure.
    That mean you should know what is the input and what will be output for this entire functionality.

    As you have mentioned we can perform two type of Forgot password mechanism,
    1. Giving a challenge to the user. Like when the user initially Register first time we check the security question with answers. Once he provide answer we will verify it when they forget the password. In this case we can directly sent the user password in mail, because user already verified and validated with the security question still why you want to generate a random password and provide to the user and then force him to reset the password?

    2. If still you want generate a random password even though user was validated through security questions, Kindly go through the below link.


    http://stackoverflow.com/questions/54991/generating-random-passwords


    For Forgot Password Functionality , kindly refer below.


    http://stackoverflow.com/questions/13212938/forgot-password-email-confirmation-in-asp-net-mvc-webmatrix

    Thanks,
    Mani

  • #768228
    I got following login screen using entity framework, it works fine for me

    int id = Convert.ToInt32(txtusername.Text);
    db2Entities db = db2Entities();
    string query = (from c in db.AdminTables
    where c.AdminID == id && c.AdminPassword == txtpassword.Text
    select c.AdminFirstName).FirstOrDefault();
    if (query != null)
    {
    Response.Redirect("/Admin/Dasboard.aspx");
    }
    else
    Response.Write("Invalid User");

    //**************************** For PasswordChange**************************************
    try
    {
    db2Entities db = new db2Entities();
    var query = (from c in db.AdminTables
    where c.AdminPassword == txtoldpassword.Text
    select c).FirstOrDefault();
    query.AdminPassword = txtreenteredpassword.Text;
    db.SaveChanges();
    Label1.Visible = true;
    Label1.Text = " Password Changed Sucessfully";
    Response.Write("Password Changed Sucessfully");

    }
    catch (Exception ex )
    {
    Label1.Visible = true;
    Label1.Text = " Error occured in Pasword changing";
    //Response.Write(ex);
    }

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #768266
    Example of code for login page in asp.net using entity framework for beginner
    Int id = Convert.ToInt32(txtusername.Text);
    db2Entities db = db2Entities();
    string query = (from exa in db.AdminTables
    where exa.AdminID == id && exa.AdminPassword == txtpassword.Text
    select c.AdminFirstName).FirstOrDefault();
    if (query != null)
    {
    Response.Redirect("/Admin/Example.aspx");
    }
    else
    Response.Write("Invalid User");


  • Sign In to post your comments