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.
- 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.
The primary built-in objects in Asp.net are as follows:
- Application
- Request
- Response
- Server
- Session
- Context
- Trace
The process in which a Web page sends data back to the equal page on the server.
The trip of a Web page from the client to the server and then behind to the client is known as a round trip.
There are two types of Cookies applicable in Asp.net :
- Session Cookie
- Persistent Cookie
The System.Web.UI.Control class is the father class for all Web server controls.
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.
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.
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.
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.
In two ways are used to send data across pages in Asp.net:
- Session
- Public properties
The ViewState information is saved in the HTML hidden fields.
The default timeout for a cookie is 30 minutes.
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.
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.
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.
- Server.Transfer
- Server. Execute.
< asp:HyperLinkColumn > < / asp:HyperLinkColumn >
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.
The cursor position is to keep up when the page gets refreshed due to the server-side validation and the page gets refreshed.
Using particular validation controls that are meant for this. We have Range Validator, Email Validator
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.
The Global.asax file contains some of the following specified event handlers:
- Application_Error
- Application_Start
- Application_End
- Session_Start
- Session_End
The Session Object.
There are six categories of validation controls in Asp.net:
- Compare Validator
- Custom Validator
- Range Validator
- Regular Expression Validator
- RequiredField Validator
- Validation Summary
System.Diagnostic
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.
@Register directive informs the compiler of any custom server control added to the page.
It checks whether the control has any value. It’s used when you need the control should not be empty.
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.
The ValidationSummary control shows all validation messages in one 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.
Asp.net session supports cookie less session & it can span across several servers.
It accesses the customized validation code to perform client-side validation and server-side validation.
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.
ViewState can be disabled by using the “EnableViewState” condition set to false.
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.
System.web.UI.Page class
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.
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.
It permits to executing ASP.NET application-level events and setting application-level variables.
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.
It is used for displaying a string.
Twice:
- Before the Page_Load().
- Init() afterwards
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. |
They are retrieved from Page class. It is a base class and helps in inheriting web forms.
There are following validator provided:
- Required field
- Compare
- Range
- Custom
- Summary
- Regular expression
By using a validator control called Compare Validator you can make sure they are matched.
It is used for retaining the object state amid page postback at server-side.
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.
Current page’s life.
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.
From control on server side, use Attributes property.
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.
3 types of caching in ASP.NET are:
- Data Caching.
- Output Caching,
- Fragment Caching,
Such type is called Fragment Caching.
That can be done.
Yes. By including some assembly references of MVC hybrid application can be created.
They can’t be added. They should all be in one language.
A trait used to lock connection string data to secure it.
- Databases
- Business Objects
- XML documents
- Flat files
There are many. But some of these are:
- DataSetName
- CaseSensitive
- Container
- Events
- DesignMode
- HasErrors etc.
The finest way is validation on Client-side. It decreases the network stream of traffic as well as keeps server resources by saving it.
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
Yes, the protocol is called HTTP Protocol. It can be used for calling service from web.
Manifold web config archives are possible for the location of asp.net.
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 |
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.
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.
Yes. The theme can be stated in file – web.config.
It causes a permanent rerouting from the demanded URL to stated URL. When the rerouting is completed, 301 move is returned as response.
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.
- 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.
- 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.
- <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.
It is used to tell if string comparisons run within data tables show case-sensitivity.
Load event is executed when pages are completely loaded.
- Assignment of a value kind to reference kind variable is called Boxing.
- Assignment of a reference kind to value kind variable is called UnBoxing.
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. |
By using Page.IsValid property.
- SeparatorTemplate
- AlternatingltemTemplate
- ItemTemplate
- FooterTemplate
- HeaderTemplate
- Application
- Response
- Request
- Server
- Trace
- Context
- Session
For the entire application, this unit is used for setting the user-defined values.
- HtmlInputCheckBox control allows many item selections.
- HtmlInputRadioButton control allows only one item selection from the set.
Localized applications can be created using namespaces. System.Globalization as well as System.Resources is used for this matter.
- 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.
.asmx is File extension for web service.
Following are constituents or modules associated with ADO.Net:
- Dataset
- Data Adaptor
- Data Reader
- Connection
- Command
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 |
- Integer
- String
- Double
- Date
- Currency