$('#btnSwitchLogin').on('click', function (evt) { var query = '~' + window.location.pathname + window.location.search; var dto = { url: query }; $.ajax({ type: "POST", url: MyHome.aspx / switchToOtheruser, data: JSON.stringify(dto), contentType: "application/json; charset=utf-8", dataType: "json", dto: { UserID: $('#userList').val() } }); });
public static void switchToOtheruser(int UserID) { using (var context = new Context(DALBase.GetConnectionString())) { var usr = context.Users.FirstOrDefault(m => m.UserID == UserID); LoginUtils.Login(usr.LoginName, Crypto.Decrypt(usr.LoginPassword)); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)