What are the different components of .NET?
Following are the components of .NET
- Common Language run-time
- Application Domain
- Common Type System
- .NET Class Library
- .NET Framework
What do you know about CTS?
CTS stands for Common Type System. It follows certain rules according to which a data type should be declared and used in the program code. CTS also describes the data types that are going to be used in the application. We can even make our own classes and functions following the rules in the CTS, it helps in calling the data type declared in one program language by other programming languages.
What is CLR?
CLR stands for common language run-time, it is an important component of the .NET framework. We can use CLR as a building block of various applications and provides a secure execution environment for applications.
Whenever an application written in C# is compiled, the code is converted into an intermediate language. After this, the code is targeted to CLR which then performs several operations like memory management, security checks, loading assemblies, and thread management.
Common language specification helps the developers to use the components that are inter-language compatible with certain rules that come with CLS. It then helps in reusing the code in other .NET compatible languages.
What do you know about JIT?
JIT is a compiler which stands for Just In Time. It is used to convert the intermediate code into the native language. During the execution, the intermediate code is converted into the native language.
Why do we use Response.Output.Write()?
Response.Output.Write() is used to get the formatted output.
What is the difference between Response.Redirect and Server.Transfer?
Response.Redirect basically redirects the user’s browser to another page or site. The history of the user’s browser is updated to reflect the new address as well. It also performs a trip back to the client where the client’s browser is redirected to the new page.
Whereas, Server.Transfer transfers from one page to the other without making any round-trip back to the client’s browser. The history does not get updated in the case of Server.Transfer.
Is ASP.NET different from ASP? If yes, explain how?
Yes, ASP.NET is different from ASP. These are the main differences:
- ASP.NET is developed by Microsoft to create dynamic web applications while ASP (Active Server Pages) is a Microsoft’s server side technology use to create web pages.
- ASP.NET is compiled while ASP is interpreted.
- ASP uses the technology named ADO while ASP.NET uses ADO.NET.
- ASP.NET is completely object oriented while ASP is partially object oriented.
What are differences between function and stored procedure in .Net programming language?
The difference between function and stored procedure:
- Function returns only one value but procedure can return one or more than one value.
- Function can be used in select statements but procedure cannot be used.
- Function has only input parameters while Procedure can have an input and output parameters.
- Exceptions can be handled by try catch block in procedures but that is not possible in function.
Advantages of ASP.NET
Separation of Code from HTML
To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently.
Support for compiled languages
Developers can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.
Use services provided by the .NET Framework
The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. We will go into more detail on some of them in this module.
Graphical Development Environment
Visual Studio .NET provides a very rich development environment for web developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code but also for HTML and XML.
To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. State information can, for example, be kept in memory or stored in a database. It can be shared across web farms, and state information can be recovered, even if the server fails or the connection breaks down.
Update files while the server is running
Components of your application can be updated while the server is online and clients are connected. The framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.
XML-Based Configuration Files
Configuration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.
What are the different validators in ASP.NET?
ASP.NET validation controls define an important role in validating the user input data. Whenever the user gives the input, it must always be validated before sending it across to various layers of an application. If we get the user input with validation, then chances are that we are sending the wrong data. So, validation is a good idea to do whenever we are taking input from the user. There are the following two types of validation in ASP.NET,
- Client-Side Validation
- Server-Side Validation
- RequiredFieldValidator Control
- CompareValidator Control
- RangeValidator Control
- RegularExpressionValidator Control
- CustomFieldValidator Control
What are Cookies in ASP.NET?
Cookies are a State Management Technique that can store the values of control after a post-back. Cookies can store user-specific information on the client’s machine, such as when the user last visited your site. Cookies are also known by many names, such as HTTP Cookies, Browser Cookies, Web Cookies, Session Cookies and so on. Basically cookies are a small text file sent by the web server and saved by the Web Browser on the client’s machine. List of properties containing the HttpCookies Class,
- Domain: Using these properties we can set the domain of the cookie.
- Expires: This property sets the Expiration time of the cookies.
- HasKeys: If the cookies have a subkey then it returns True.
- Name: Contains the name of the Key.
- Path: Contains the Virtual Path to be submitted with the Cookies.
- Secured: If the cookies are to be passed in a secure connection then it only returns True.
- Value: Contains the value of the cookies.
Limitation of the Cookies
- The size of cookies is limited to 4096 bytes.
- A total of 20 cookies can be used in a single website.
What is Ajax in ASP.NET?
- The power of AJAX lies in its ability to communicate with the server asynchronously, using a XMLHttpRequest object without requiring a browser refresh.
What are the data controls available in ASP.NET?
The Controls having DataSource Property are called Data Controls in ASP.NET. ASP.NET allows a powerful feature of data binding, you can bind any server control to simple properties, collections, expressions and/or methods. When you use data binding, you have more flexibility when you use data from a database or other means. Data Bind controls are container controls. Controls -> Child Control Data Binding is binding controls to data from databases. With data binding we can bind a control to a particular column in a table from the database or we can bind the whole table to the data grid. Data binding provides simple, convenient, and powerful way to create a read/write link between the controls on a form and the data in their application. Data binding allows you to take the results of properties, collection, method calls, and database queries and integrate them with your ASP.NET code. You can combine data binding with Web control rendering to relieve much of the programming burden surrounding Web control creation. You can also use data binding with ADO.NET and Web controls to populate control contents from SQL select statements or stored procedures. Data binding uses a special syntax <%# %> The <%#, which instructs ASP.NET to evaluate the expression. The difference between a data binding tags and a regular code insertion tags <% and %> becomes apparent when the expression is evaluated. Expressions within the data binding tags are evaluated only when the DataBind method in the Page objects or Web control is called. Data Bind Control can display data in connected and disconnected model. Following are data bind controls in ASP.NET,
- Repeater Control
- DataGrid Control
- DataList Control
- GridView Control
- BulletList etc.
What is the code behind and Inline Code?
Code Behind Code Behind refers to the code for an ASP.NET Web page that is written in a separate class file that can have the extension of .aspx.cs or .aspx.vb depending on the language used. Here the code is compiled into a separate class from which the .aspx file derives. You can write the code in a separate .cs or .vb code file for each .aspx page. One major point of Code Behind is that the code for all the Web pages is compiled into a DLL file that allows the web pages to be hosted free from any Inline Server Code. Inline Code Inline Code refers to the code that is written inside an ASP.NET Web Page that has an extension of .aspx. It allows the code to be written along with the HTML source code using a <Script> tag. It’s major point is that since it’s physically in the .aspx file it’s deployed with the Web Form page whenever the Web Page is deployed.