session

Should a web site's business layer access the session state?

I am working on maintaining an ASP.NET website, and I've noticed the business layer and other supporting libraries make heavy use of HttpContext.Current.Session. This makes it hard to keep track of session variables, to determine what they're used for and why they even exist. Is it considered bad practice to use the session in the busi...

Mocking a Customer SessionHandler Object in ASP.NET MVC for Unittests with Rhino Mocks

Hi folks, I currently use the following approach to create a strongly typed object representing session variables. public abstract class SessionController : Controller { private const string SESSION_NAME = "UserSession"; public SessionData SessionData { get { SessionData sessionData = (SessionDa...

Deciding on session ID string lengh to assure uniqueness

When a session ID is created, the ID isn't checked for uniqueness usually. Verifying uniqueness is a big overhead when dealing with billions of records. I was wondering what length of a random session ID string should be enough to rely on for uniqueness in a production service, as big as Gmail for example. Any other suggestions to main...

Lose ASP.NET Session for one request and then regains it on next

I am seeing a very strange problem on one of my production boxes. We have an application hosted in IIS 6 on a single machine with an apache web server in front of it. My application is using ASP.NET Membership for authentication and relies on session state. I am seeing a problem right now where some server requests will hit a null exce...

Session in asp.net

Please I need a clear example about session in asp.net using c# for example(using session in log in operation) and thank you very much...... ...

PHP: Centralized Page Session Authenticator

I am currently wondering how a centralized page authenticator could be achieved. Can anyone suggest a neat algorithm for me? What I intend to achieve is to make my backend administrator pages session protected without writing a piece of session checking code to each of my pages that I want protected. I currently do something like this: ...

ASP.NET Is it possible to differentiate session length from user?

In asp.net session length, can it be of a different length depending on the type of user logging in? I want admin users to timeout after 3 hours, but standard users to timeout after 30mins, because staff in the office often have multiple windows open, and requested a longer session length. I'm a little sceptical about lengthening it for ...

"Webpage has expired" $_SESSIONS in PHP

Hi there In my web-application I'm using $_SESSIONS but sometimes, when the users hits the backspace key he gets "Webpage has expired" message. Why is happening this? What to do to avoid this? ...

Why can't I pass user sessions between subdomains?

First of all, I have used ALL of the suggested methods in this SO article: http://stackoverflow.com/questions/644920/allow-php-sessions-to-carry-over-to-subdomains For your convenience, here are the tips I already followed: Here are 3 options. Place this in your php.ini: session.cookie_domain = ".example.com" In your ...

ASP.NET Masters: What are the advantages / disadvantages of using Session variables?

I've done a search on this subject already, and have found the same data over and over-- a review of the three different types of sessions. (InProc, Sql, StateServer) However, my question is of a different nature. Specifically, what is the advantages/disadvantages of using the built in .NET session in the first place? Here is why I am ...

Masterpage Dropdown List not keeping Selected Index

Ok, my masterpage has a dropdown which controls size which affects a lot of things. I need to access the dropdown index from content pages so I do it using this code. public partial class MasterPage : System.Web.UI.MasterPage { public DropDownList MySize { get { return _ddlSize; } } } I am using Ajax and when the size changes the menu...

Best way to keep ASP.Net Session Active

Hi What is the best way to keep asp.net or asp.net mvc session active until user logs out? *User should be able to activate session even after browser or computer restarts... In another words, what is the best way to implement REMEMBER ME... ...

Notify client about expired session - web programming

Is it posible to notify user that session has expired? Can browser act as server and receive such notifications? One solution would be to generate JavaScript that does countdown on client side and notifies client in the end, but I am iterested if it is postible to do it the first way? And what are the consequences of first approach? A...

How Come Closing A Tab Doesn't Close A Session Cookie?

I'm using session-based cookies with my website. To my complete surprise, I noticed if I set a session cookie (not a persistent cookie), close a tab, and then reconnect to the site, the session cookies are still there. That's not what I would have expected, actually. I would have expected the session cookies to be deleted. If you close...

Accessing Session variable and performance

I have a web application inside where i need to check whether the user has sufficient permissions / roles/rights to access the page. I had set the users rights in a table with USER_ID, ROLE_ID. and when a user is logging in to the application, I will be reading the records for this user and the construct a string and assign to a sessio...

In Asp.net what would you put in the Session_Start and Session_End events in Global.asax ?

If not code could you please provide some generic explanation? ...

PHP Login Form.

<form action="form.php" method="post"> Username: <input type="text" name="user" maxlength="50" value="" /> Password: <input type="password" name="pass" maxlength="20" value="" /> <input type="submit" name="Submit" value="Submit" /> </form> <?php $Accesstrys = 0; if($_POST['Submit'] == "Submit") { $Accesst...

PHP: Session 2-Dimensional Array - Track Viewed Products

I'm trying to create an array to display the last 5 products a customer has viewed. The array is a 2 dimensional array like below... $RView= array( array( ID => "1001", RefCode => "Ref_01", Name => "Name_01" ), ... array( ID => "1005", RefCode => "Ref_05", Name => "Name_05" ) ); The array values are retrieved from ...

Connection problems with SQL Server in ASP.NET applications using out-of-process session state

I have several ASP.NET applications deployed in a farm of 4 Windows 2003 machines. Each application uses a separate App Pool and Virtual Directory in IIS. They rely heavily on sessions which are persisted out of process on a single SQL Server 2000 (<sessionstate mode="sqlserver" ... />). Applications are compiled against .NET 3.0 but .NE...

How do I pass data using sessions in Ruby CGI?

I am working on a guess-a-number game with Ruby that will be online. I know I need to pass the SESSION somehow to keep the number that they are guessing, but I have tried a ton of methods with no luck. My code is here. Any thoughts on what I can do get this code working? I have declared each of my sections. ...