Log Out User When A Session Times Out Or Ends?
Dec 10, 2010Whats the best way to log out a user when a session ends or expires?
View 2 RepliesWhats the best way to log out a user when a session ends or expires?
View 2 RepliesHow to automatically log out after 15 mins by using asp.net vb.net ....
View 1 RepliesMy web application uses forms authentication. One of my users who uses IE8 says that she always stays logged into the website on her computer. This is even after she closes the browser window and restarts the computer. This only happens on her computer, if she switches computers the same thing won't happen.
I'm baffled by this. Is there a setting in IE that could save her login information and automatically sign her in every time she accesses the website? Is there anything else to look into?
My ASP.NET intranet web application uses Windows Authentication, and I would like to record the following details:
1) Windows ID
2) Session Start Time
3) Session Stop Time
4) URL being browsed to (optional)
I've got some basic code setup in "Session_Start" method of the Global.ASAX to log session start times (seen below), but that's it so far. I have the feeling this is a primitive approach and there are "better" ways of doing this. So I really have two questions:
1) Is this the right way to go about doing this? If not what are some other options?
2) If this is the right way, do I just need to drop some code in the "Session_End" method to record the time they exit, and thats a complete solution? Does this method always get called when they close the browser tab they have the site open in, or do they have to close the entire browser (I don't have logout functionality)? Any way users can skip over this session end method (or start for that case)?
Dim connsql As New System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("MyConnectionstring").ConnectionString)
Dim cmdsql As System.Data.SqlClient.SqlCommand = connsql.CreateCommand
cmdsql.CommandText = "BeginUserSession"
cmdsql.CommandType = Data.CommandType.StoredProcedure
Try
cmdsql.Parameters.Add("@windowsid", System.Data.SqlDbType.VarChar, 30, "windowsid")
cmdsql.Parameters("@windowsid").Value = Session("UserInfo").identity.name
If connsql.State <> System.Data.ConnectionState.Open Then connsql.Open()
cmdsql.ExecuteNonQuery()
connsql.Close()
Catch ex As Exception
Finally
If connsql.State <> Data.ConnectionState.Closed Then connsql.Close()
End Try
'Stored Proc records start time
I write a countdown timer in jQuery and i need to keep some datas in a session when countdown ends. Datas have to be sent to server to update. How can i handle this situation. I am new in jQuery and asp.net so could you explain this briefly
View 4 RepliesI have an asp.net application with a background thread. The thread starts when the application starts and it is gracefully stopped when the application ends. I am running the website on a shared host. Unfortunately sometimes the application does not trigger the Application_End event when it ends. I would think that the threads would be killed anyway, but that's not the case. I currently have 4 threads running in the background. Three from previous times the application started and 1 from the current application session. How can I ensure that the threads are shutdown when the application ends? Is there a way for the threads to check if the application was reset or had been reset? Or is there a way to check for these rogue threads at application startup and kill them?
View 1 RepliesI have some problems with getting my website to log out the authenticated user automatically when the session ends (the user closes the browser).
This is what I have in my web.config:
[code]...
When I close the browser, the user is still logged in. How do I make the website forget the user through an option, so the user himself can decide if the website should remember or not?
My web application was in .NET framework 1.1 initially. It has a few ASP server grids and some third party controls (Infragistics). I had it migrated to .NET framework 3.0.
Now I've added a few ASP server grids('GridView'). The thing is when the session('InProc') ends after 20 mins, the rows of the newly added grids disappear. However, this is not happening with the grids that were present already pre-migration. I am not using any session variables to initialise or bind the new grids.
This is happening only if the controls are added in the web forms that were involved in the framework migration process. If the control is added in the new web form, then this issue's not occuring.
Also I am not allowed to change the session state to any other. It has to remain 'InProc'. Continuing the session indefinitely is also not an option.
Kindly let me know why my appln redirects me to Session TimeOut page on a simple postback. This doesnot happen on my local pc but happens only on prod. Here is the code I m using on my PageBase.cs 's Init method
[Code]....
And in my web.config:
<authentication mode="Forms">
<forms name=".MY-AUTHPORTALNAME"
slidingExpiration="true"
defaultUrl="Default.aspx"
loginUrl="Login.aspx"
protection="All"
timeout="9999"
path="/"/>
</authentication>
<sessionState mode="InProc" cookieless="false" timeout="9999" />
I'm trying to track down an issue on an ASP.NET v3.5 application where the HttpSession times out before its (default) 20 minutes. We're seeing behaviour where the session is lost only a few minutes into a session, at random and with no discernible cause such as unhandled exceptions. As far as I can tell, the ASP.NET worker process is not dying, otherwise that would have explained the dropped session.
What approach should I use to monitor when the session is dropped? Is there some event I can listen to, or some other hook in the System.Web namespace? Also, can someone confirm that the countdown to expiration is reset by web activity? That is, the session's lifetime gets reset to the (default) 20 minutes each time the web client makes an HTTP GET or POST?
I want a specific session variable (in my case Session["level"]) to expire either on the normal 20 min. timer or at 19:30 every day. Because I change a value in my database everyday at 19:30 and I want this session variable to be related to that value. Is this possible?
View 1 RepliesI have a web application that was working fine. I had to make minor changes that had nothing to do with the Session object in any way. When I run local everything works fine. When I publish to our testing box it all runs fine. When I publish to production it times out on the Session object. Dozens of other applications on the production server run fine and have no trouble with Session.
It does not matter if the line is:
Session("PreferredName") = sPreferredName
or:
sPreferredName = Session("PreferredName")
I had the server admin remove the application pool and directory and recreate them and then I republished and it still happens.
I have a ASP.NET website which uses forms authentication. The timeout is twenty minutes.
I have noticed that if a user half completes a form, and is then timed out, they are redirected to the login page, fill it in, and are redirected back to the form but with EMPTY controls.
I had prevously assumed that ASP.NET would use some skulduggery to repopulate the form controls when this happens.
We have an MVC.NET application that encounters fatal errors when it restarts. In our Session_Start event handler, we add the session id to a dictionary. In the Session_End handler, we remove it. Consider the following sequence of requests:
GET home.mvc
<application restarts>
GET main.css
GET banner.jpg
GET somedata.mvc
...
Because of the way the application is architected, this sort of sequence happens fairly frequently if you do a rebuild while the application is open in a browser window. That wouldn't be terribly concerning except that I see it in production environments too. For example, it will occur (albeit rarely) when you edit web.config.
The requests following the restart are all due to links in the home page or AJAX calls from JavaScript.
What I observe is that .NET handles the first 5 requests in parallel. Each such request causes it to fire the Session_Start event. After a short time, it fires the Session_End event 3 times. To be clear, each Session_Start corresponds to the exact same session. They all have the same session id and the IsNewSession property is true for all session state objects. Also, the Session_End events do not correspond to the session being killed. The session persists, along with any data stored in session state.
I need to either prevent it from firing Session_Start more than once or figure out how to tell when Session_End doesn't really mean that the session has ended.
I would like to wrap Session variables in a manner similar to that discussed on CodeProject.
[code]....
Here is my question: if I have to access CurrentUser multiple times in the same page, would I get a performance improvement by assigning it to a local variable instead of accessing the wrapping property? Or does the HttpSessionState make sure the object is only deserialized once per request, so that subsequent calls in the same http request don't cost any more?
I need to add features in login page.
1) Only allow user in three times attemps
2) After three times failed to login, the user will be restricted for 30 minutes.
I knew how to code for 1) but I do not how to do 2).
How to lock the user with the 3 times entering the wrong password?
View 10 RepliesDo anyone knows how to lock a account after a user enters the password too many times.
View 3 RepliesI am looking at how best to prevent a single user account logging on multiple times in a webforms application. I know that MembershipUser.IsOnline exists, but I've read a few forum and blog entries suggesting that this can be unreliable, particularly in scenarios where a user closes a browser (without logging out) and attempts to logon with a different machine or browser.I looked at implementing a last past the post type system; when a user logs on older users are simply kicked off. It seems that FormsAuthentication.Signout() only works for the current user.
View 2 RepliesLet suppose, I am building an asp.net website which has login scenario in it. I want to provide a certain functionality to the website that if the user is already login on computer 1 and now try to login on computer 2, so he will be allowed to remain login on computer 2, while automatically logout him from computer 1. I also know that http is a stateless medium, so whenever user interact with computer 1 and try to interact with the page, it will get noticed at that time.
View 2 RepliesI have a website live in asp.net
now if user closes browser. the session does not get killed.
I spoke with friend and he said that cannot be done as sessions are on server.
but i see banking website who kills session when browser is closed.
In a div element, I have a slider (using the Ajax Toolkit slider extender on a textbox). I then want to place a checkbox control right next to the slider - on the same row. However, on the page, the checkbox ends up one row below the slider. It looks like the slider adds a line break after itself. Is this expected? How can I avoid this?
For information, this code is placed in a content section of a page that has a masterpage attached to it. The content section is more than wide enough to contain the slider and the checkbox.
This is the relevant code snippet
[Code]....
i am running a command line program from inside my c# code behind page. the command looks like so.
String runMe = baseDir + @"Binffmpeg.exe";
String convertVideo = " -i "" + fullFileName + "" -ab 64 -ar 44100 -b 200 -y -f flv "" + fullFileNameWOextension + ".flv" ";
String makeImages = " -i "" + fullFileName + "" -r 1 -ss 00:00:01 -t 00:00:15 -f image2 -s 120x96 "" + imagesPath + "" + filename.Substring(0, filename.IndexOf(".")) + "_images%05d.jpeg"";
EdgeCastHelper.ExecuteCommandSync(runMe, convertVideo);
EdgeCastHelper.ExecuteCommandSync(runMe, makeImages);
There are some bits missing which are passed in as parameters. Once i have converted the video i upload it to separate file server.
What i would like to know: Is there a way to stop the upload process happening until the exe has run its course, ie fully converted the video.
I started a website based on the NerdDinner source code, everything worked fine (more or less) but whenever I post an event, it ends up on the exact same coordinates on the map regardless of the address (Somewhere in the Gulf of Guinea!)
No idea what to do: I didn't alter the map code at all!
I think I summed up the question in the title. Here is some further elaboration...I have a web user control that is used in multiple places, sometimes more than once on a given page.The web user control has a specific set of JavaScript functions (mostly jQuery code) that are containted within *.js files and automatically inserted into page headers.However, when I want to use the control more than once on a page, the *.js files are included 'n' number of times and, rightly so, the browser gets confused as to which control it's meant to be executing which function on.What do I need to do in order to resolve this problem? I've been staring at this all day and I'm at a loss.
View 2 Replies