Session variables vs. Application variables Question

Posted on 2008-01-25
Medium Priority
Last Modified: 2011-09-20
I just had an inquiry regarding the use of Session variables versus using Application. In other words, an application I've taken over was written so that several domains point to the same application. Depending on the specific domain name, user controls were created to show different graphics.

In the global.asax file, there is a function which gets the Url and assigns it as in the snippet below. My question was, would using Session as opposed to Application be better/worse? What are the differences between the two, because I've tried it both ways and they both work for all intents and purposes.

void Application_BeginRequest(object sender, EventArgs e)
        Application["URL"] = Request.Url.ToString(); // some-domain.com or some-domain2.com
        //Session["URL"] = Request.Url.ToString(); // Or use this?

Open in new window

Question by:ViceroyFizzlebottom
1 Comment
LVL 17

Accepted Solution

Daniel Reynolds earned 1000 total points
ID: 20744921
The session variables will be unique for each user.
the application variables will be shared and could cause a variable to be overwritten by a different user.

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over time, the online landscape has altered considerably, but that’s nothing compared to the up-and-coming trends that will shape the web design industry in the coming year. Keep reading to find out which trends will shape B2B web design in 2018.
Now many of you may wonder how you can reach great design with least number of essentials. Isn’t stuffing ‘more and more number of elements that speak for the purpose’ the right way to do it? Erm, not always, and in this write-up, you will see why.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question