0
votes
var ur = from user in model.users
                         where user.EmailId == UserName.Text && user.Password == password
                               && user.Active == true
                         select user;
                if (ur != null && ur.Count() > 0)
                {
                    var userData = ur.FirstOrDefault();
                    Session["UserId"] = userData.UserId;
                    Session["UserType"] = userData.UserType;
                    Session["Name"] = userData.FirstName + " " + userData.LastName;
                    Response.Redirect("~/Account/Index.aspx");  
                }

in Web.config authentication mode="Forms"

forms loginUrl="~/Account/Login.aspx" defaultUrl="~/Account/Index.aspx"

authentication

But I entered correct email and password but broswer url change to

http://localhost:49768/Account/Login.aspx?ReturnUrl=%2fAccount%2fIndex.aspx

1
FormsAuthentication.SetAuthCookie(UserName.Text, createPersistentCookie = true);Igor Semin
Thanks @IgorSemin its workedShankar Kamble

1 Answers