What is ASP.Net?
What is .NET Framework?
.NET Framework is a complete environment that allows developers to develop, run, and deploy the following applications:
- Console applications
- Windows Forms applications
- Windows Presentation Foundation (WPF) applications
- Web applications (ASP.NET applications)
- Web services
- Windows services
- Service-oriented applications using Windows Communication Foundation (WCF)
- Workflow-enabled applications using Windows Workflow Foundation (WF)
.NET Framework also enables a developer to create sharable components to be used in distributed computing architecture. NET Framework supports the object-oriented programming model for multiple languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple programming languages in a manner that allows language interoperability. This implies that each language can use the code written in some other language.
What’s the use of Response.Output.Write()?
We can write formatted output using Response.Output.Write().
What are the main components of .NET Framework?
.NET Framework provides enormous advantages to software developers in comparison to the advantages provided by other platforms. Microsoft has united various modern as well as existing technologies of software development in .NET Framework. These technologies are used by developers to develop highly efficient applications for modern as well as future business needs. The following are the key components of .NET Framework:
- .NET Framework Class Library
- Common Language Runtime
- Dynamic Language Runtimes (DLR)
- Application Domains
- Runtime Host
- Common Type System
- Metadata and Self-Describing Components
- Cross-Language Interoperability
- .NET Framework Security
- Side-by-Side Execution
In which event of page cycle is the ViewState available?
After the Init() and before the Page_Load().
List the new features added in .NET Framework 4.0.
The following are the new features of .NET Framework 4.0:
- Improved Application Compatibility and Deployment Support
- Dynamic Language Runtime
- Managed Extensibility Framework
- Parallel Programming framework
- Improved Security Model
- Networking Improvements
- Improved Core ASP.NET Services
- Improvements in WPF 4
- Improved Entity Framework (EF)
- Integration between WCF and WF
What is the difference between Server.Transfer and Response.Redirect?
In Server.Transfer page processing transfers from one page to the other page without making a round-trip back to the client’s browser. This provides a faster response with a little less overhead on the server. The clients url history list or current url Server does not update in case of Server.Transfer.
Response.Redirect is used to redirect the user’s browser to another page or site. It performs trip back to the client where the client’s browser is redirected to the new page. The user’s browser history list is updated to reflect the new address.
What is an IL?
Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
From which base class all Web Forms are inherited?
What is Manifest?
Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things
- Version of assembly.
- Security identity.
- Scope of the assembly.
- Resolve references to resources and classes.
The assembly manifest can be stored in a PE file either (an .exe or) .dll with Microsoft
intermediate language (MSIL code with Microsoft intermediate language (MSIL) code or in a
stand-alone PE file, that contains only assembly manifest information.
What are the different validators in ASP.NET?
Required field Validator
Regular expression Validator
What are code contracts?
Code contracts help you to express the code assumptions and statements stating the behavior of your code in a language-neutral way. The contracts are included in the form of pre-conditions, post-conditions and object-invariants. The contracts help you to improve-testing by enabling run-time checking, static contract verification, and documentation generation.
Which validator control you use if you need to make sure the values in two different controls matched?
Compare Validator control.
Name the classes that are introduced in the System.Numerics namespace.
The following two new classes are introduced in the System.Numerics namespace:
- BigInteger – Refers to a non-primitive integral type, which is used to hold a value of any size. It has no lower and upper limit, making it possible for you to perform arithmetic calculations with very large numbers, even with the numbers which cannot hold by double or long.
- Complex – Represents complex numbers and enables different arithmetic operations with complex numbers. A number represented in the form a + bi, where a is the real part, and b is the imaginary part, is a complex number.
What is ViewState?
ViewState is used to retain the state of server-side objects between page post backs.
What is managed extensibility framework?
Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement.
Where the viewstate is stored after the page postback?
ViewState is stored in a hidden field on the page at client side. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.
Explain memory-mapped files.
emory-mapped files (MMFs) allow you map the content of a file to the logical address of an application. These files enable the multiple processes running on the same machine to share data with each Other. The MemoryMappedFile.CreateFromFile() method is used to obtain a MemoryMappedFile object that represents a persisted memory-mapped file from a file on disk.
These files are included in the System.IO.MemoryMappedFiles namespace. This namespace contains four classes and three enumerations to help you access and secure your file mappings.
How long the items in ViewState exists?
They exist for the life of the current page.
What is Common Type System (CTS)?
CTS is the component of CLR through which .NET Framework provides support for multiple languages because it contains a type system that is common across all the languages. Two CTS-compliant languages do not require type conversion when calling the code written in one language from within the code written in another language. CTS provide a base set of data types for all the languages supported by.NET Framework. This means that the size of integer and long variables is same across all .NET-compliant programming languages. However, each language uses aliases for the base data types provided by CTS. For example, CTS uses the data type system. int32 to represent a 4 byte integer value; however, Visual Basic uses the alias integer for the same; whereas, C# uses the alias int. This is done for the sake of clarity and simplicity.
What are the different Session state management options available in ASP.NET?
- Out-of-Process.In-Process stores the session in memory on the web server.Out-of-Process Session state management stores data in an external server. The external server may be either a SQL Server or a State Server. All objects stored in session are required to be serializable for Out-of-Process state management.
How you can add an event handler?
Using the Attributes property of server side control.
What is caching?
Caching is a technique used to increase performance by keeping frequently accessed data or files in memory. The request for a cached file/data will be accessed from cache instead of actual location of that file.
What are the different types of caching?
ASP.NET has 3 kinds of caching :
Which type if caching will be used if we want to cache the portion of a page instead of whole page?
Fragment Caching: It caches the portion of the page generated by the request. For that, we can create user controls with the below code:
|<%@ OutputCache Duration=”120″ VaryByParam=”CategoryID;SelectedID”%>|
List the events in page life cycle?
Can we have a web application running without web.Config file?
Is it possible to create web application with both webforms and mvc?
Yes. We have to include below mvc assembly references in the web forms application to create hybrid application.
Can we add code files of different languages in App_Code folder?
No. The code files must be in same language to be kept in App_code folder.
What is Protected Configuration?
It is a feature used to secure connection string information.
Write code to send e-mail from an ASP.NET application?
|MailMessage mailMess = new MailMessage ();mailMess.From = “[email protected]”;
mailMess.To = “[email protected]”;
mailMess.Subject = “Test email”;
mailMess.Body = “Hi This is a test mail.”;
SmtpMail.SmtpServer = “localhost”;
MailMessage and SmtpMail are classes defined System.Web.Mail namespace.
How can we prevent browser from caching an ASPX page?
We can SetNoStore on HttpCachePolicy object exposed by the Response object’s Cache property:
|Response.Cache.SetNoStore ();Response.Write (DateTime.Now.ToLongTimeString ());|
What is the good practice to implement validations in aspx page?
Client-side validation is the best way to validate data of a web page. It reduces the network traffic and saves server resources.
What are the event handlers that we can have in Global.asax file?
Application Events:Application_Start , Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,
Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache
Which protocol is used to call a Web service?
Can we have multiple web config files for an asp.net application?
What is the difference between web config and machine config?
Web config file is specific to a web application where as machine config is specific to a machine or server. There can be multiple web config files into an application where as we can have only one machine config file on a server.
Explain role based security ?
Role Based Security used to implement security based on roles assigned to user groups in the organization.
Then we can allow or deny users based on their role in the organization. Windows defines several built-in groups, including Administrators, Users, and Guests.
|<AUTHORIZATION>< authorization >< allow roles=”Domain_Name\Administrators” / > < !– Allow Administrators in domain. — >
< deny users=”*” / > < !– Deny anyone else. — >
< /authorization >
What is Cross Page Posting?
When we click submit button on a web page, the page post the data to the same page. The technique in which we post the data to different pages is called Cross Page posting. This can be achieved by setting POSTBACKURL property of the button that causes the postback. Findcontrol method of PreviousPage can be used to get the posted values on the page to which the page has been posted.
How can we apply Themes to an asp.net application?
We can specify the theme in web.config file. Below is the code example to apply theme:
<pages theme=”Windows7″ />
What is RedirectPermanent in ASP.Net?
RedirectPermanent Performs a permanent redirection from the requested URL to the specified URL. Once the redirection is done, it also returns 301 Moved Permanently responses.
What is MVC?
MVC is a framework used to create web applications. The web application base builds on Model-View-Controller pattern which separates the application logic from UI, and the input and events from the user will be controlled by the Controller.
Explain the working of passport authentication?
First of all it checks passport authentication cookie. If the cookie is not available then the application redirects the user to Passport Sign on page. Passport service authenticates the user details on sign on page and if valid then stores the authenticated cookie on client machine and then redirect the user to requested page.
What are the advantages of Passport authentication?
All the websites can be accessed using single login credentials. So no need to remember login credentials for each web site.
Users can maintain his/ her information in a single location.
What are the asp.net Security Controls?
- <asp:Login>: Provides a standard login capability that allows the users to enter their credentials
- <asp:LoginName>: Allows you to display the name of the logged-in user
- <asp:LoginStatus>: Displays whether the user is authenticated or not
- <asp:LoginView>: Provides various login views depending on the selected template
- <asp:PasswordRecovery>: email the users their lost password
In which event are the controls fully loaded?
Page load event.
what is boxing and unboxing?
Boxing is assigning a value type to reference type variable.
Unboxing is reverse of boxing ie. Assigning reference type variable to value type variable.
Differentiate strong typing and weak typing?
In strong typing, the data types of variable are checked at compile time. On the other hand, in case of weak typing the variable data types are checked at runtime. In case of strong typing, there is no chance of compilation error. Scripts use weak typing and hence issues arises at runtime.
How we can force all the validation controls to run?
The Page.Validate() method is used to force all the validation controls to run and to perform validation.
List all templates of the Repeater control?
List the major built-in objects in ASP.NET?
What is the appSettings Section in the web.configfile?
The appSettings block in web config file sets the user-defined values for the whole application.
For example, in the following code snippet, the specified ConnectionString section is used throughout the project for database connection:
<add key=”ConnectionString” value=”server=local; pwd=password; database=default” />
Which data type does the RangeValidatorcontrol support?
The data types supported by the RangeValidator control are Integer, Double, String, Currency, and Date.
What is the difference between an HtmlInputCheckBoxcontrol and an HtmlInputRadioButtoncontrol?
In HtmlInputCheckBoxcontrol, multiple item selection is possible whereas in HtmlInputRadioButton controls, we can select only single item from the group of items.
Which namespaces are necessary to create a localized application?
What are the different types of cookies in ASP.NET?
Session Cookie – Resides on the client machine for a single session until the user does not log out.
Persistent Cookie – Resides on a user’s machine for a period specified for its expiry, such as 10 days, one month, and never.
What is the file extension of web service?
Web services have file extension .asmx..
What are the components of ADO.NET?
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection.
What is the difference between ExecuteScalar and ExecuteNonQuery?
ExecuteScalar returns output value where as ExecuteNonQuery does not return any value but the number of rows affected by the query. ExecuteScalar used for fetching a single value and ExecuteNonQuery used to execute Insert and Update statements.
NET Framework class library?
The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.
What is CLS (Common Language Specification)?
This is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow, so that it can communicate with other .NET languages in a seamless manner.
What is .Net Assembly?
.Net Assembly is one basic building of application. It can be an .exe or .dll file.
.Net Assembly can be used to
- Simplify application deployment
- Solves the versioning problems that can occur with component-based applications
What are the Different elements in .Net Assembly?
- Assembly manifest
- Type Metadata
- MSIL Code
- Set of Resources
What is Global Assembly catche?
If the machine installs with .NetFramework, then the machine contains a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the machine/computer.
What are different ways to deploy an assembly in to global assembly catche?
- We can use the Global Assembly Cache tool (Gacutil.exe), GAC Tool has provided by the .NET Framework SDK.
- We can use Windows Explorer to drag assemblies into the cache.
- We can use an installer designed to work with the global assembly cache.
Explain the Application Domain in .NetFramework?
Application Domain will isolate applications that are running on same computer. Application domains will provide more secure and versatile unit of processing that CLR can use to provide isolation between applications.
What are the benefits of isolation provided by the Application domains?
- Faults in one application cannot affect other applications. The application domains ensure that code running in one domain cannot affect other applications in the process.
- Individual applications can be stopped without stopping the entire process. Application domains will enable you to unload the code running in a single application.
What are the types of Authentication in ASP.NET?
There are three types of authentication available in ASP.NET:
- Windows Authentication: This authentication method uses built-in windows security features to authenticate user.
- Forms Authentication: authenticate against a customized list of users or users in a database.
- Passport Authentication: validates against Microsoft Passport service which is basically a centralized authentication service.
What are Session state modes in ASP.NET?
ASP.NET supports different session state storage options:
- In-Processis the default approach. It stores session state locally on same web server memory where the application is running.
- StateServermode stores session state in a process other than the one where application is running. Naturally, it has added advantages that session state is accessible from multiple web servers in a Web Farm and also session state will remain preserved even web application is restarted.
- SQLServermode stores session state in SQL Server database. It has the same advantages as that of StateServer.
- Custommodes allows to define our custom storage provider.
- Offmode disables session storage
What are the different types of Validation controls in ASP.NET?
In order to validate user input, ASP.NET provides validation server controls. All validation controls inherit from BaseValidator class which contains the common validation properties and methods like ControlToValidate, Enabled, IsValid, EnableClientScript, ValidationGroup,Validate(), etc.
ASP.NET provides a range of validation controls:
- RequiredFieldValidator validates compulsory/required input.
- RangeValidator validates the range. Validates that input falls between the given range values.
- CompareValidator validates or compares the input of a control with another control value or with a fixed value.
- RegularExpressionValidator validates input value against a defined regular expression pattern.
- CustomValidator allows to customize the validation logic with respect to our application logic.
- ValidationSummary displays all errors on page collectively.
What is the difference between custom controls and user controls?
Custom controls are basically compiled code, i.e., DLLs. These can be easily added to toolbox, so it can be easily used across multiple projects using drag and drop approach. These controls are comparatively hard to create.
But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly coupled with respect to User Interface and code. In order to use across multiple projects, we need to copy and paste to the other project as well.