Click here to Skip to main content
15,905,776 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Making Forum in asp.net Pin
manikebs7-Dec-09 0:29
manikebs7-Dec-09 0:29 
GeneralRe: Making Forum in asp.net Pin
Ashfield7-Dec-09 1:23
Ashfield7-Dec-09 1:23 
QuestionGetting cell values for selected rows in server side Pin
NK76-Dec-09 18:19
NK76-Dec-09 18:19 
AnswerRe: Getting cell values for selected rows in server side Pin
Nishant Singh6-Dec-09 19:35
Nishant Singh6-Dec-09 19:35 
GeneralRe: Getting cell values for selected rows in server side Pin
NK77-Dec-09 23:34
NK77-Dec-09 23:34 
QuestionWhat exactly Difference between Application and Session ? Pin
satyamzen6-Dec-09 14:47
satyamzen6-Dec-09 14:47 
AnswerRe: What exactly Difference between Application and Session ? Pin
Dennis Dykstra6-Dec-09 16:23
Dennis Dykstra6-Dec-09 16:23 
AnswerRe: What exactly Difference between Application and Session ? PinPopular
Abhijit Jana6-Dec-09 16:48
professionalAbhijit Jana6-Dec-09 16:48 
satyamzen wrote:
While i went to an interview interviewer asked me Difference between Application and Session ?

I guess he has asked about "Application State" Not "Application" . You can explain them in following way.

System.Web.HttpApplicationState class is used to maintain the Application State For ASP.NET Application.It provides methods for storing information which can be accessed globally means it common for the all used.

As For Example :

Storing Info At Application Variable :
Application["Title"] = "Welcome";


// Reading the Information from application variable
string Title;
if (Application["Title"] != null)
     Title = Application["Title"].ToString();


On the other hand Session stored on server side and its unique for each and every user. We can interact with Session State with System.Web.SessionState.HttpSessionState class, because this provides built in Session Object with Asp.Net Pages.

As For Example :
Following code is used for storing a value to session

//Storing UserName in Session
 Session["UserName"] = txtUser.Text;


Now, let see how we can retrieve values from Session

//Check weather session variable null or not
        if (Session["UserName"] != null)
        {
            //Retrieving UserName from Session
            lblWelcome.Text = "Welcome : " + Session["UserName"].ToString();
        }
        else
        {
         //Do Something else
        }


Below are the associated events that are used for Session and Application State. This are events for Global.asax file.
For Application : Application_Start, Application_End
For Session : Session_Start and Session_End

Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.

AnswerRe: What exactly Difference between Application and Session ? Pin
Dinesh Mani6-Dec-09 20:30
Dinesh Mani6-Dec-09 20:30 
GeneralRe: What exactly Difference between Application and Session ? Pin
Abhijit Jana6-Dec-09 20:42
professionalAbhijit Jana6-Dec-09 20:42 
GeneralRe: What exactly Difference between Application and Session ? Pin
Dinesh Mani6-Dec-09 20:49
Dinesh Mani6-Dec-09 20:49 
Question[Message Deleted] Pin
Dhisni De Costa6-Dec-09 14:02
Dhisni De Costa6-Dec-09 14:02 
AnswerRe: “Publisher could not be verified” Error message Pin
Abhijit Jana6-Dec-09 18:20
professionalAbhijit Jana6-Dec-09 18:20 
GeneralRe: “Publisher could not be verified” Error message Pin
Dhisni De Costa6-Dec-09 18:32
Dhisni De Costa6-Dec-09 18:32 
QuestionDistinguishing dialup users from broadband users without javascript Pin
Dennis Dykstra6-Dec-09 8:38
Dennis Dykstra6-Dec-09 8:38 
AnswerRe: Distinguishing dialup users from broadband users without javascript Pin
Abhishek Sur6-Dec-09 10:27
professionalAbhishek Sur6-Dec-09 10:27 
GeneralRe: Distinguishing dialup users from broadband users without javascript Pin
Dennis Dykstra6-Dec-09 14:00
Dennis Dykstra6-Dec-09 14:00 
GeneralRe: Distinguishing dialup users from broadband users without javascript Pin
Abhishek Sur6-Dec-09 20:58
professionalAbhishek Sur6-Dec-09 20:58 
QuestionServing multiple ads on single ad using AdRotator Pin
Krishhhhhhhhhhhhhh6-Dec-09 8:02
Krishhhhhhhhhhhhhh6-Dec-09 8:02 
AnswerRe: Serving multiple ads on single ad using AdRotator Pin
Abhishek Sur6-Dec-09 9:16
professionalAbhishek Sur6-Dec-09 9:16 
GeneralRe: Serving multiple ads on single ad using AdRotator Pin
Krishhhhhhhhhhhhhh6-Dec-09 19:16
Krishhhhhhhhhhhhhh6-Dec-09 19:16 
GeneralRe: Serving multiple ads on single ad using AdRotator Pin
Abhishek Sur6-Dec-09 20:56
professionalAbhishek Sur6-Dec-09 20:56 
GeneralRe: Serving multiple ads on single ad using AdRotator Pin
Krishhhhhhhhhhhhhh6-Dec-09 21:58
Krishhhhhhhhhhhhhh6-Dec-09 21:58 
QuestionHelp me update product [modified] Pin
trinhitc6-Dec-09 6:08
trinhitc6-Dec-09 6:08 
AnswerRe: Help me update product Pin
Abhishek Sur6-Dec-09 8:09
professionalAbhishek Sur6-Dec-09 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.