Answer:
Session["uname"]=TextBox1.Text and Session.Add("uname",TextBox1.Text) are both
used to assign data from the TextBox1 to a key known as "uname". Both commands will create a row in the Session Object.
Difference:
Session["uname"]=TextBox1.Text ; It uses an indexer to assign the data. The indexer refers to the particular row of the session object. The key "uname" is
used to identify the row.
Assigning data using an indexer is faster and more efficient than assigning the data
using the method--Session.Add("uname",TextBox1.Text)
|
Alert Moderator