View Complete Post
I have a web application in which i need to logout the user if he clicks the logout button or even if he closes his browser window. On Logout button click, i am doing session.Abandon(), but how to go about his browser window close.
Can anybody help with a code sample.
ASP.NET provides a number of ways to maintain user state, the most powerful of which is session state. This article takes an in-depth look at designing and deploying high-performance, scalable, secure session solutions, and presents best practices for both existing and new ASP.NET session state features straight from the ASP.NET feature team.
MSDN Magazine September 2005
This is a pretty basic question.
I have some code where I need to define a session variable however it's coming back as Nothing when the code is executed. Here's the code:
' Default Currency
REQCURR = Request.Querystring("p_DCURR")
'If not explicitly specified, try to get it from session
If (REQCURR = "") Then
If (Session("REQCURR") <> "") Then
REQCURR = Session("REQCURR")
'Here is the session variable I'm trying to define:
Session("REQCAD") = 0
REQCURR = ""
Session("REQCURR") = REQCURR
So, for some reason that Session("REQCAD") = 0 has no value instead of having a value of 0.
I have a doubt regarding session state.I have stored a value in session while clicking a button.according to the session value i need to bind a grid.Grid has to to refresh automatically. for that i am using ajax timer..It will sucessfully executed in localhost ..but implementing it to live servers.Session shows null value...what 's the issue...Can any one help me to solve this issue
Thanks In advance,
We are in the process of refactoring from cf to .net, so, I am working on the Login page and converting it from cf to .net. So, when I am autheticated and enter into our website, I need to redirect it to a cfm page (just temporary, since we will be refactoring that also eventually).
So, I am autheticated (using CustomMembership Provider model for sql server) and then when I redirect to the cfm, the app.cfm should validate the .net session variables. Here is where i am stuck:
I have the .net session variables in the aspx side:something like
Session["UserId"].ToString() = Value from a login txt box (also authenticated against data in the database)
Session["UserName"].ToString() = Value from the db corresponding to the User Name entered in the text box.
So, now I have all the session variables in the .net side. Now, how do I retreive these .net session in the cf side? Any small peice of code to retrive the asp.net session variable in the application.cfm side would be great.
Hi,I'm looking the article on Session management and Cookie related to ASP.NET MVC.Can somebody please provide links on that topics?
Anytime you change the object variable that is already assigned to a session variable, do you need to "re-save" the variable back into the session variable or does it do it automatically?
// abc is an object of some random type
Session["abc"] = abc; // initial declaration of session variable.
abc.a=1; // updated abc.a field after a button_click event
Session["abc"] = abc; // resave the new field value of 'a' back into the session variable 'abc'.
Or does the session variable already keep track of all changes made to the object and saves automatically?
My ASP.NET 1.1 application is using load balancing servers. Before load balancing servers, there is no problem related to session management. After googling, I found the following two points:
1) Website instance ID must be same on both the servers. When I ran Microsoft provided VB Script to check instance ID. On both the servers, they are same.
2) I have also generated a unique machine key and pasted it in the machine.config on both the servers.
Now session does not get expired so frequently. But yes it is happening.
So what should I do next in order to resolve it?
Thanks in advance!
Hi I have a strange problem in a website that runs in a server to which I am connected through VPN...
I use some session variables to get the job done(shopping cart, etc) but it is not stable..manytimes I get no items in session object and other times(refreshing the page) I get missing data...I downloaded the entire site code to my local pc and debugged it and run it succesfully without any session data missing...When I run it in the server, I get bad session again: no products in shopping cart or products with missing quantities...
The same website runs smoothly in our production server too....The problem is with our development server...
Any help would be greatly appreciated..
Thanks in advance,
I have an asp.net website in which users can submit reports. Another tester and I tested this page at the same time and when I went to review the information I submitted, it displayed information that I didn't submit. It displayed the info submitted from the other user.
I use session variables for these values. I don't understand how this happened?
What can I do so each user can individually submit their information without overlapping some one else's information? The plan is for multiple users to be able to use this page to submit their weekly layer reports.
The first example of code is how I add the session variables from the textboxes.
If Session("BarnNo") = Nothing Then
'add session variables
I am having a website in which I am setting nearly 20 Session variables at the time of login authentication. ( Ex : Name, EmpID, Dept, Location, Email...).
Can u please tell which is one of the following is the better way to get Login user details
1) Through session variables at the time of login
2) In each and every page by calling the Stored Procedure to get login user details
Regards >> HemaBhushan