50 ASP - NET Interview Questions and Answers (PDF) in 2021
50 ASP - NET Interview Questions and Answers (PDF) in 2021
We have covered 50 most important .NET interview questions for fresher candidates as
well as .NET interview questions for experienced developers to help them prepare for the
interview. This detailed guide will help you to crack your Job interview for ASP .NET.
1. What is ASP.Net?
10 Most Common
10 Most Common Interview Questions and Answe… Interview Questions and
NOW
PLAYING Answers ????
https://www.guru99.com/asp-net-interview-questions-answers.html 1/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
PLAYING Answers ????
Top 10 Behavioral
Interview Questions and
Answers
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.
Page class.
7. Which validator control you use if you need to make sure the values in two different
controls matched?
8. What is ViewState?
ViewState is used to retain the state of server-side objects between page post backs.
https://www.guru99.com/asp-net-interview-questions-answers.html 2/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
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.
11. What are the different Session state management options available in ASP.NET?
1. In-Process
2. Out-of-Process.
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.
Starting at
₹1,29,990*
Legal Rollover
e.g.
btnSubmit.Attributes.Add("onMouseOver","JavascriptCode();")
https://www.guru99.com/asp-net-interview-questions-answers.html 3/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
1. Output Caching,
2. Fragment Caching,
3. Data Caching.
15. 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:
1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_LoadComplete
7) Page_PreRender
8) Render
Yes
18. 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
https://www.guru99.com/asp-net-interview-questions-answers.html 4/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
Yes. We have to include below mvc assembly references in the web forms application to
create hybrid application.
System.Web.Mvc
System.Web.Razor
System.ComponentModel.DataAnnotations
No. The code files must be in same language to be kept in App_code folder.
mailMess.From = "[email protected]";
mailMess.To = "[email protected]";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send (mailMess);
Response.Cache.SetNoStore ();
Client-side validation is the best way to validate data of a web page. It reduces the
network traffic and saves server resources.
24. What are the event handlers that we can have in Global.asax file?
HTTP Protocol
26. Can we have multiple web config files for an asp.net application?
Yes.
https://www.guru99.com/asp-net-interview-questions-answers.html 6/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
27. 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.
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.
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.
Thi b hi db tti POSTBACKURL
https://www.guru99.com/asp-net-interview-questions-answers.html
t f th b tt th t th 7/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
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.
We can specify the theme in web.config file. Below is the code example to apply theme:
<configuration>
<system.web>
</system.web>
</configuration>
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.
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
All th b it b d i
https://www.guru99.com/asp-net-interview-questions-answers.html i l l i d ti l S dt b 8/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
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.
<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
36. How do you register JavaScript for webcontrols ?We can register javascript for
controls using <CONTROL -name>Attribtues.Add(scriptname,scripttext) method.
Unboxing is reverse of boxing ie. Assigning reference type variable to value type variable.
In strong typing, the data types of variable are checked at compile time. On the other
h d i f k i h i bl d
https://www.guru99.com/asp-net-interview-questions-answers.html h k d i f 9/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
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.
The Page.Validate() method is used to force all the validation controls to run and to
perform validation.
ItemTemplate
AlternatingltemTemplate
SeparatorTemplate
HeaderTemplate
FooterTemplate
Application
Request
Response
Server
Session
Context
Trace
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:
<em><configuration>
<appSettings>
</appSettings></em>
https://www.guru99.com/asp-net-interview-questions-answers.html 10/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
</appSettings></em>
The data types supported by the RangeValidator control are Integer, Double, String,
Currency, and Date.
System.Globalization
System.Resources
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.
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command,
connection.
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.
https://www.guru99.com/asp-net-interview-questions-answers.html 11/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
ASP.NET Quiz
Response.Outputs.Write()
Response.Output.Writes
https://www.guru99.com/asp-net-interview-questions-answers.html 12/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
About
About Us
Advertise with Us
Write For Us
Contact Us
Career Suggestion
SAP Career Suggestion Tool
Interesting
eBook
Blog
Quiz
SAP eBook
Execute online
Execute Javascript
Execute HTML
Execute Python
https://www.guru99.com/asp-net-interview-questions-answers.html 13/14
12/10/21, 11:05 PM 50 ASP.NET Interview Questions and Answers (PDF) in 2021
https://www.guru99.com/asp-net-interview-questions-answers.html 14/14