ASP.NET Cookies Overview
A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. The cookie contains information the Web application can read whenever the user visits the site.
For example, if a user requests a page from your site and your application sends not just a page, but also a cookie containing the date and time, when the user's browser gets the page, the browser also gets the cookie, which it stores in a folder on the user's hard disk.
Later, if user requests a page from your site again, when the user enters the URL the browser looks on the local hard disk for a cookie associated with the URL. If the cookie exists, the browser sends the cookie to your site along with the page request. Your application can then determine the date and time that the user last visited the site. You might use the information to display a message to the user or check an expiration date.
Cookies are associated with a Web site, not with a specific page, so the browser and server will exchange cookie information no matter what page the user requests from your site. As the user visits different sites, each site might send a cookie to the user's browser as well; the browser stores all the cookies separately.
Cookies help Web sites store information about visitors. More generally, cookies are one way of maintaining continuity in a Web application—that is, of performing state management. Except for the brief time when they are actually exchanging information, the browser and Web server are disconnected. Each request a user makes to a Web server is treated independently of any other request. Many times, however, it's useful for the Web server to recognize users when they request a page. For example, the Web server on a shopping site keeps track of individual shoppers so the site can manage shopping carts and other user-specific information. A cookie therefore acts as a kind of calling card, presenting pertinent identification that helps an application know how to proceed.
Cookies are used for many purposes, all relating to helping the Web site remember users. For example, a site conducting a poll might use a cookie simply as a Boolean value to indicate whether a user's browser has already participated in voting so that the user cannot vote twice. A site that asks a user to log on might use a cookie to record that the user already logged on so that the user does not have to keep entering credentials.
Cookie Limitations
Most browsers support cookies of up to 4096 bytes. Because of this small limit, cookies are best used to store small amounts of data, or better yet, an identifier such as a user ID. The user ID can then be used to identify the user and read user information from a database or other data store. (See the section "Cookies and Security" below for information about security implications of storing user information.)
Browsers also impose limitations on how many cookies your site can store on the user's computer. Most browsers allow only 20 cookies per site; if you try to store more, the oldest cookies are discarded. Some browsers also put an absolute limit, usually 300, on the number of cookies they will accept from all sites combined.
A cookie limitation that you might encounter is that users can set their browser to refuse cookies. If you define a P3P privacy policy and place it in the root of your Web site, more browsers will accept cookies from your site. However, you might have to avoid cookies altogether and use a different mechanism to store user-specific information. A common method for storing user information is session state, but session state depends on cookies, as explained later in the section "Cookies and Session State."
Database Interview: Difference between Index defrag and Index rebuild?
When you create an index in the database, the index information used
by queries is stored in index pages. The sequential index pages are
chained together by pointers from one page to the next. When changes
are made to the data that affect the index, the information in the
index can become scattered in the database. Rebuilding an index
reorganizes the storage of the index data (and table data in the case
of a clustered index) to remove fragmentation. This can improve disk
performance by reducing the number of page reads required to obtain
the requested data
DBCC INDEXDEFRAG - Defragments clustered and secondary indexes of the
specified table or view.
C# interview questions and answers, part 2
14. What debugging tools come with the .NET SDK?
Cordbg - command-line debugger, and DbgCLR - graphic debugger. Visual Studio. NET uses the DbgCLR. Cordbg To use, you must compile the original C # using the / debug.
15. What does assert() do?
In debug compilation, assert themselves in a Boolean condition as a parameter, and displays the error dialog if the condition is false. The program continues without interruption if the condition is true.
16. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be detailed for some applications that are constantly walking, you run the risk of overloading the machine and the hard drive there. Six levels range from None to detail, which allows you to change search activities.
17. How do you debug an ASP.NET Web application?
Attach the aspnet_wp.exe process to the DbgClr debugger.
18. What are three test cases you should go through in unit testing?
Positive check cases (correct information, correct output), negative check cases (broken or missing information, proper handling), exception check cases (exceptions are thrown & caught properly).
19. Can you change the value of a variable while debugging a C# application?
Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
20. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET information provider is high speed and robust, but requires purchasing a license for Microsoft SQL Server. OLE-DB.NET is universal for accessing other sources, such as Oracle, DB2, Informix and Microsoft Access, but it is. Network layer on top of OLE layer, so do not fastest in the world. ODBC.NET is a deprecated layer provided for backward compatibility with ODBC engines.
21. What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La.
The wildcard character is %, the proper query with LIKE would involve ‘La%’.
22. Explain ACID rule of thumb for transactions.
Transaction must be atomic (that is four units of work and not depend on previous and subsequent transactions), made (the information is confirmed or roll back, no "between" if something has been updated and something is not any), isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the information had been committed, even if the process is blocked just after).
23. What does the parameter Initial Catalog define inside Connection String?
The database name to connect to.
24. What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where each parameter is the same, including security settings.
what is Reflection in dotNet
Reflection is the feature in .Net, which enables us to get some information about object in runtime. That information contains data of the class. Also it can get the names of the methods that are inside the class and constructors of that object.
program should use the reflection derived from namespace System.Reflection .
using reflection can dynamically load assembly