Our Special Offer - Get 3 Courses at 24,999/- Only. Read more
Hire Talent (HR):+91-9707 240 250

Interview Questions

ASP.NET  Interview Questions and Answers

ASP.NET Interview Questions and Answers

ASP.NET  Questions and answers

ASP .NET  Interview Questions and answers for beginners and experts. List of frequently asked ASP .NET  Interview Questions with answers by Besant Technologies. We hope these ASP .NET  Interview Questions and answers are useful and will help you to get the best job in the networking industry. This ASP .NET  Interview Questions and answers are prepared by ASP .NET  Professionals based on MNC Companies expectation. Stay tuned we will update New ASP .NET  Interview questions with Answers Frequently.

Best ASP.NET Interview Questions and answers

Besant Technologies supports the students by providing ASP .NET  Interview Questions and answers for the job placements and job purposes. ASP .NET  is the leading important course in the present situation because of more job openings and the high salary pay for this ASP .NET  and more related jobs. These are top ASP .NET  Interview Questions and answers, prepared by our institute experienced trainers. If you want to learn Practical ASP.NET Training then please go through this ASP.NET Training in Chennai.

ASP.NET  Interview Questions and answers for the job placements

Here is the list of most frequently asked ASP .NET Interview Questions and Answers in technical interviews. These questions and answers are suitable for both freshers and experienced professionals at any level. The questions are for intermediate to somewhat advanced ASP .NET  professionals, but even if you are just a beginner or fresher you should be able to understand the answers and explanations here we give.

Q1) What is a Cookie?
  • A cookie is a lightweight executable program, which the server posts to client machines.
  • Cookies store the identity of a user at the first visit of the Web site and validate them later of the next visits for their authenticity.
  • The values of a cookie can be transferred between the user’s request and the server’s response.
Q2) What are the primary built-in objects in Asp.net?

The primary built-in objects in Asp.net are as follows:

  • Application
  • Request
  • Response
  • Server
  • Session
  • Context
  • Trace
Q3) What is a PostBack?

The process in which a Web page sends data back to the equal page on the server.

Q4) What is a round trip?

The trip of a Web page from the client to the server and then behind to the client is known as a round trip.

Q5) What are the types of cookies in Asp.net?

There are two types of Cookies applicable in Asp.net :

  • Session Cookie
  • Persistent Cookie
Q6) Which is the father class of the Web server control?

The System.Web.UI.Control class is the father class for all Web server controls.

Q7) What is the change between Custom Control and User Control?

Custom Controls are compiled code (Dlls), smoother to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Various Applications (If Shared Dlls), Even if Private can copy to the bin directory of web application add reference and use. Normally designed to provide common functionality autonomous of consuming Application.
User Controls are compared to those of ASP include files, easy to create, can not be placed in the toolbox and dragged – dropped from it. A User Control is distributed among the single application files.

Q8) How can you classify that the Page is PostBack?

The Page object uses the IsPostBack property to research whether the page is posted back or not. If the page is postback, this property is set to correct.

Q9) What are Authentication and Authorization?

Authentication is the process of identifying users. Authentication is identifying/validating the user across the credentials (username and password) and Authorization acts after authentication. Authorization is the process of permit access to those users based on identity. Authorization allowing access of particular resource to user.

Q10) What are the types of Authentication?

There are 3 types of Authentication. Windows, Forms and Passport Authentication.

  • Windows authentication uses the security features integrated into the Windows NT and Windows XP operating systems to authenticate and authorize Web application users.
  • Forms authentication allows you to create your own list/database of users and validate the identity of those users when they visit your Web site.
  • Passport authentication uses the Microsoft centralized authentication provider to identify users. Passport provides a way to for users to use a single identity across various Web applications. To service Passport authentication in your Web application, you must install the Passport SDK.
Q11) What are the various ways to send data across pages in Asp.net?

In two ways are used to send data across pages in Asp.net:

  • Session
  • Public properties
Q12) Where is the ViewState information saved?

The ViewState information is saved in the HTML hidden fields.

Q13) What is the default timeout for a cookie?

The default timeout for a cookie is 30 minutes.

Q14) What is the change between HTML and Web server controls?

HTML controls are client-side controls, therefore, all the validations for HTML controls are acting at the client side.
On the other side, Web server controls are server-side controls; therefore, all the validations for Web server controls are performed at the server side.

Q15) What is the change between Server-side scripting and Client-side scripting?

Server-side scripting means that all the script will be completed by the server and interpreted as wanted. ASP doesn’t have a few of the functionality like sockets, uploading, etc.
Client-side scripting means that the script will be completed immediately in the browser such as form field validation, clock, email validation, etc. Client-side scripting is normally done in VBScript or JavaScript.

Q16) How do you create a permanent cookie?

Permanent cookies are available until a described expiration date and are saved on the hard disk. So Set the ‘Expires’ property any value greater than DateTime.MinValue with respect to the current DateTime. If u need the cookie which never expires set its Expires property equal to DateTime.maxValue.

Q17) Which method do you access to redirect the user to another page without performing a round trip to the client?
  • Server.Transfer
  • Server. Execute.
Q18) What tag do you access to add a hyperlink column to the DataGrid?

< asp:HyperLinkColumn > < / asp:HyperLinkColumn >

Q19) How many languages .NET is supporting now?

When .NET was introduced it came with multiple languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.

Q20) What is smart navigation?

The cursor position is to keep up when the page gets refreshed due to the server-side validation and the page gets refreshed.

Q21) How do you verify the controls in an ASP .NET page?

Using particular validation controls that are meant for this. We have Range Validator, Email Validator

Q22) How do you turn off cookies for one page in the site?

Access Cookie. Discard property, Gets or sets the discard flag set by the server. When true, this condition instructs the client application not to save the Cookie on the user’s hard disk when a session ends.

Q23) What are the event handlers that can be combined in the Global.asax file?

The Global.asax file contains some of the following specified event handlers:

  • Application_Error
  • Application_Start
  • Application_End
  • Session_Start
  • Session_End
Q24) What Asp.net objects encapsulate the state of the customer and the browser?

The Session Object.

Q25) What are the categories of validation controls in Asp.net?

There are six categories of validation controls in Asp.net:

  • Compare Validator
  • Custom Validator
  • Range Validator
  • Regular Expression Validator
  • RequiredField Validator
  • Validation Summary
Q26) Which namespace is wanted to implement debug and trace?

System.Diagnostic

Q27) In which activities are the controls fully loaded?

Page_load action guarantees that all controls are fully loaded. Controls are also accessed.
In Page_Init actions but you will see that ViewState is not fully loaded during this event.

Q28) What is the use of @ Register directives?

@Register directive informs the compiler of any custom server control added to the page.

Q29) Define RequiredFieldValidator?

It checks whether the control has any value. It’s used when you need the control should not be empty.

Q30) What are the various types of Session state management options available with ASP.NET?

ASP.NET provides In-Process and Out-of-Process state management. In-Process saves the session in memory on the webserver. Out-of-Process Session state management saves data in an external data source. The extra data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects saved in session are serializable.

Q31) How can you show all validation messages in one control?

The ValidationSummary control shows all validation messages in one control.

Q32) What is the change between a Label control and a Literal control?

The Label control’s final HTML code has an HTML tag; whereas the Literal control’s final HTML code consists only text, which is not surrounded by any HTML tag.

Q33) What is the change between ASP Session and ASP.NET Session?

Asp.net session supports cookie less session & it can span across several servers.

Q34) What is the function of Custom Validator?

It accesses the customized validation code to perform client-side validation and server-side validation.

Q35) What is Role-based security?

A role is a named set of principals that have the same privileges with respect to security (such as a teller or a manager). A principal can be a member of one or extra roles. Therefore, applications can use role membership to determine whether a principal is authorized to perform a needed action.

Q36) Can we disable ViewState, If, yes how?

ViewState can be disabled by using the “EnableViewState” condition set to false.

Q37) Can you give a model of what might be best suited to place in the Application_Start and Session_Start subroutines?

All the global declarations or the variables used generally across the application can be deployed under Application_Start. All the user particular tasks or declarations can be dealt with in the Session_Start subroutine.

Q38) What common class do all Web Forms inherit from?

System.web.UI.Page class

Q39) What is a Literal Control?

The Literal control is used to show text on a page. The text is programmable. The Literal control does not let you apply styles to its content.

Q40) What is Remoting?

Remoting is a means by which one operating system process, or program, can connect with another process. The two actions can exist on the same computer or on two computers connected by a LAN or the Internet.

Q41) What’s the use of “GLOBAL.ASAX” file?

It permits to executing ASP.NET application-level events and setting application-level variables.

Q42) Explain the term ASP.Net?

ASP.Net represents a framework established by Microsoft for developing innovative web sites. It can be done by with facilities provided by this framework. Some of the facilities are

  • Web forms
  • HTML & CSS
  • MVC
  • Javascript

There are numerous page extensions delivered by Microsoft used for development of web sites. Some of these are aspx, ascx, asmx, ashx, vb, cs, html and XML.

Q43) Why do we use Response.Write()?

It is used for displaying a string.

Q44) When does ViewState become obtainable?

Twice:

  • Before the Page_Load().
  • Init() afterwards
Q45) How is Server.Transfer different from Response.Redirect?
Server.Transfer Response.Redirect
Page processing on one page handovers to another page with no round-trip to client’s browser. It is used for transmitting the browser (user side) to other sites. It completes a trip back for the client and the browser (client side) goes to a new page.
There is no updating with regards to client’s URL history etc. New address is reflected by updating browser history of user.
Q46) How are Web Forms retrieved?

They are retrieved from Page class. It is a base class and helps in inheriting web forms.

Q47) Are there validators provided with ASP.NET?

There are following validator provided:

  • Required field
  • Compare
  • Range
  • Custom
  • Summary
  • Regular expression
Q48) How do you make sure that values in dissimilar controls matched?

By using a validator control called Compare Validator you can make sure they are matched.

Q49) Explain ViewState?

It is used for retaining the object state amid page postback at server-side.

Q50) Once page postback is achieved, where is the viewstate saved?

It is saved in a concealed spot on page from client side. It is transported first to client then to server. It is kept neither on server nor on source anywhere outside.

Q51) For what time the articles in ViewState usually exist?

Current page’s life.

Q52) Explain session preferences for state management of ASP.NET?

There are two choices here:

  • In Process: Session is stored on web server and it is kept in memory.
  • Out Process: Data is stored in external server. This server could be SQL or State Server. In this type, objects kept in session should be serializable.
Q53) How do you add event handler?

From control on server side, use Attributes property.

Q54) Explain caching?

It is a method used to expand performance by observing regularly accessed data in memory. If a request is made for cached file, it will be retrieved from cache and not from real file location.

Q55) Name various categories of caching?

3 types of caching in ASP.NET are:

  • Data Caching.
  • Output Caching,
  • Fragment Caching,
Q56) What type of caching is used to cache some section of page?

Such type is called Fragment Caching.

Q57) Can you run web application with no use of file called ‘web.Config’?

That can be done.

Q58) Can you build web application using webforms in addition to MVC?

Yes. By including some assembly references of MVC hybrid application can be created.

Q59) Can code files in various languages be added in folder named ‘App_Code’?

They can’t be added. They should all be in one language.

Q60) Explain Protected Configuration?

A trait used to lock connection string data to secure it.

Q61) What sources are accessible with ASP.NET?
  • Databases
  • Business Objects
  • XML documents
  • Flat files
Q62) Explain properties of a DataSet class?

There are many. But some of these are:

  • DataSetName
  • CaseSensitive
  • Container
  • Events
  • DesignMode
  • HasErrors etc.
Q63) How can you run validations or authentications in aspx page?

The finest way is validation on Client-side. It decreases the network stream of traffic as well as keeps server resources by saving it.

Q64) Name Global.asax file’s event handlers?

Session Events: 

  • Session_Start,
  • Session_End

Application Events: 

  • Application_AcquireRequestState,
  • Application_End,
  • Application_Start,
  • Application_AuthenticateRequest,
  • Application_BeginRequest,
  • Application_AuthorizeRequest,
  • Application_Disposed,
  • Application_Error,
  • Application_EndRequest,
  • Application_PostRequestHandlerExecute,
  • Application_PreSendRequestContent,
  • Application_PreRequestHandlerExecute,
  • Application_PreSendRequestHeaders,
  • Application_ResolveRequestCache,
  • Application_ReleaseRequestState,
  • Application_UpdateRequestCache
Q65) Is there a protocol for calling services from Web?

Yes, the protocol is called HTTP Protocol. It can be used for calling service from web.

Q66) Are manifold web config records possible for the location of asp.net?

Manifold web config archives are possible for the location of asp.net.

Q67) How is web config different from machine config? Explain.
Web config Machine config
Meant for web application Meant for machine
Numerous web config records are possible into given application On server, only single machine config record is possible
Q68) What is role based access?

Security or access built on roles is called role based security. These roles have been assigned to groups of users. Users can be allowed or denied depending on roles assigned to them. Windows defines many built-in sets viz. Administrators, Guests and users.

Q69) Explain Cross Page Postback?

Once submit button is clicked on web page, data is posted on similar page. Cross page posting is method in which data is posted to dissimilar pages.

This is attained by setting property ‘POSTBACKURL’ of button which causes the method postback. Findcontrol is used to obtain posted values of page.

Q70) Can themes be applied to applications of asp.net?

Yes. The theme can be stated in file – web.config.

Q71) What is ASP.Net’s RedirectPermanent?

It causes a permanent rerouting from the demanded URL to stated URL. When the rerouting is completed, 301 move is returned as response.

Q72) Explain MVC?

A framework useful for creating web applications is called MVC. Outline used for it is Model, View and Controller outline which splits the application and UI. The input plus user events are controlled by Controller.

Q72) How does passport authentication work?
  • It will check cookie of passport authentication in the very beginning.
  • If the cookie is unobtainable the application forwards user to page of Passport Sign.
  • Passport service validates the user particulars of the page – sign-on.
  • If legal then it stores the validated cookie on the machine (client-side).
  • Send user to page requested.
Q73) Name some advantages with Passport authentication?
  • Every website is accessible with one and only login credentials.
  • There is no requirement to recall login credentials over again for every web site.
  • As user you can maintain your information in one location.
Q74) Name some Security Controls in asp.net?
  • <asp:Login>: Lets users enter their identifications with standard login competence.
  • <asp:LoginName>: To display logged-in user’s name.
  • <asp:LoginStatus>: Displays authentication of user.
  • <asp:LoginView>: As per selected template different log-in views are shown.
  • <asp:PasswordRecovery>: Lost password is mailed to user.
Q75) What is CaseSensitive property used for?

It is used to tell if string comparisons run within data tables show case-sensitivity.

Q76) What is the name of the event when pages are completely loaded?

Load event is executed when pages are completely loaded.

Q77) How is boxing different from unboxing?
  • Assignment of a value kind to reference kind variable is called Boxing.
  • Assignment of a reference kind to value kind variable is called UnBoxing.
Q78) How is strong typing different from weak typing?
Strong Typing Weak Typing
Variable’s data types are tested at the time of compilation. Allows the checking of data types at the time of running or runtime.

 

Compilation errors are not found. Issues might come at the time of code running.
Q79) How can you check if validation was a success?

By using Page.IsValid property.

Q80) What templates are present in Repeater control?
  • SeparatorTemplate
  • AlternatingltemTemplate
  • ItemTemplate
  • FooterTemplate
  • HeaderTemplate
Q81) What are ASP.NET’s built-in or permanent objects?
  • Application
  • Response
  • Request
  • Server
  • Trace
  • Context
  • Session
Q82) What do you know about web.config file’s appSettings unit?

For the entire application, this unit is used for setting the user-defined values.

Q83) How is HtmlInputCheckBox control different from HtmlInputRadioButton control?
  • HtmlInputCheckBox control allows many item selections.
  • HtmlInputRadioButton control allows only one item selection from the set.
Q84) Name namespaces that are required for creation of localized application?

Localized applications can be created using namespaces. System.Globalization as well as System.Resources is used for this matter.

Q85) Name different kinds of ASP.NET cookies?
  • Session Cookie –Alive for a one session while waiting for the log out. It is present in client machine.
  • Persistent Cookie – Present on user’s machine. Alive for the time mentioned for its expiration. It could be month, day etc. In some cases, it never expires.
Q86) What file extension is used for web service?

.asmx is File extension for web service.

Q87) Name ADO.NET components?

Following are constituents or modules associated with ADO.Net:

  • Dataset
  • Data Adaptor
  • Data Reader
  • Connection
  • Command
Q88) How is ExecuteScalar different from ExecuteNonQuery?
ExecuteScalar ExecuteNonQuery
Output value is returned. Returns count of rows the query affected
Used to fetch single value Used for execution of statements like Insert, Update
Q89) Name data types maintained by RangeValidator control?
  • Integer
  • String
  • Double
  • Date
  • Currency
Besant Technologies WhatsApp