TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Faisal
NA
73
1.7k
How to set user status β0β when automatically logout user?
Oct 16 2019 7:36 AM
I'm using javascript in aspx page to log-out inactive user. But also i need to change user status "0" when logged-out automatically. How can i send the value user status "0" when inactive user will logged-out automatically?
public
void
ValidateUser_LOGSTS_Update(
object
sender, EventArgs e)
{
int
userId = 0;
string
Cur_user = Session[
"Userid"
].ToString();
String constr = ConfigurationManager.ConnectionStrings[
"abcd"
].ConnectionString;
using
(SqlConnection con =
new
SqlConnection(constr))
{
using
(SqlCommand cmd =
new
SqlCommand(
"sp_tbl_LogCheck_update"
))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(
"@userID"
, Cur_user);
cmd.Parameters.Add(
"@msg"
, SqlDbType.Int, 20).Direction = ParameterDirection.Output;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
// read output value from @NewId
string
msg_sts = Convert.ToString(cmd.Parameters[
"@msg"
].Value);
con.Close();
if
(msg_sts ==
"0"
)
{
Session.Clear();
Session.Abandon();
//Response.Redirect(FormsAuthentication.LoginUrl);
FormsAuthentication.RedirectToLoginPage();
}
}
}
}
<script type=
"text/javascript"
>
var
t;
window.onload=resetTimer;
document.onkeypress=resetTimer;
function
logout()
{
alert(
"You are now logged out."
)
location.href =
'LogOut.aspx'
}
function
resetTimer()
{
clearTimeout(t);
t=setTimeout(logout,60000)
//logs out in 10 min
}
</script>
Reply
Answers (
1
)
Modelstate Data
Access values in list