It contains Asp.net,C#.net,Vb.net,Sql server FAQ's.
Difference between Session and Cookies
Sessions
It is used to store user information in server memory. Usually it stores userid, name etc.. sensitive information stored in session and it will maintain its state when you navigate through a website. You can store the session information either in cookies or cookieless mode.
If cookieless = false, session value stored in cookies, if it true it will be stored in the browser URL. but if you copy the URL and paste in another tab of the same browser the session will be expired.
You can store the session in three modes
In-Proc
State server
SQL server
Example
Session["userName"] = "Ganesh Ram";
if(Session["UserName"] != null)
lblUserName.Text = Session["UserName"].ToString();
Cookies
Cookies
are stored per-user on the users machine. A cookie is usually just a
bit of information. Cookies are usually used for simple user settings
colours preferences etc. No sensitive information should ever be stored in a cookie.
You can never fully trust that a cookie has not been tampered with by
a user or outside source however if security is a big concern and you
must use cookies then you can either encrypt your cookies or set them to
only be transmitted over SSL. A user can clear there cookies at any
time or not allow cookies altogether so you cannot count on them being
there just because I user has visited your site in the past.
//add a username Cookie
Response.Cookies["UserName"].Value = "
Ganesh Ram
";
Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(10);
//request a username cookie
if(Request.Cookies["UserName"] != null)
lblUserName.Text = Server.HtmlEncode(Request.Cookies["UserName"].Value);
Difference between Clustered index and Non-Clustered index
Indexing is way to sort and search
records in the table. It will improve the speed of locating and
retrieval of records from the table
In SQL there are two types of index.
1. Clustered index
2. Non-Clustered index.
Clustered index is unique for any given table
and we can have only one clustered index on a table. The leaf level of a
clustered index is the actual data and the data is resorted in case of
clustered index.
Whereas in case of non-clustered index the leaf level is actually a pointer to the data in rows so we can have as many non-clustered indexes as we can on the db
Whereas in case of non-clustered index the leaf level is actually a pointer to the data in rows so we can have as many non-clustered indexes as we can on the db
In SQL 2005
Clustered index - 1 Clustered index
Non-Clustered index - 249 Non-Clustered index
In SQL 2008
Clustered index - 1 Clustered index
Non-Clustered index - 999 Non-Clustered index
Example
USE Sample
GO
CREATE TABLE Employee
(ID bigint PRIMARY KEY CLUSTERED,
Name nvarchar(150),
Address nvarchar(250),
Salary varchar(25) )
GO
CREATE NONCLUSTERED INDEX EmpName ON Employee(Name)
GO
Example
USE Sample
GO
CREATE TABLE Employee
(ID bigint PRIMARY KEY CLUSTERED,
Name nvarchar(150),
Address nvarchar(250),
Salary varchar(25) )
GO
CREATE NONCLUSTERED INDEX EmpName ON Employee(Name)
GO
Subscribe to:
Posts (Atom)
About Me
I am Venkatesan.M
Working as a Senior Developer with 4+ years of experience in Dot Net.
Working as a Senior Developer with 4+ years of experience in Dot Net.