简体   繁体   中英

Redirect Page after Login in asp.net 4.0

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM