Interview Questions.

ASP.Net Interview Questions

fluid

ASP.Net Interview Questions

You are an ASP.NET programmer… Your subsequent activity interview is round the corner… You want to score that activity… All which means is which you need to prepare nicely no matter being informed inside the domain. Generally, in technical activity interviews, interviewers will no longer most effective ask complicated questions, however you can additionally even face a few very fundamental and rudimentary questions which could make or wreck the risk to win.

ASP.Net Interview Questions and Answers

You may additionally need extra than this set of inquiries to arm yourself completely for the interview. We endorse you to go to ASP .NET Tutorials and Courses, wherein you can locate more reading material and get a complete grip of ASP.NET.

Question: What is ASP.NET?

Answer: ASP.NET is an open-source server-aspect application framework designed for net builders to provide dynamic internet pages with .NET framework. It became advanced by means of Microsoft to allow programmers to build dynamic internet websites, internet programs and internet services.

Question: What is ASP.NET MVC framework?

Answer: ASP.NET MVC is a web application framework for the .NET Platform used for building complete stack internet programs using the Model-View-Controller pattern.

Question: What is an ASP.NET Web API framework?

Answer: ASP.NET Web API is used in simple terms for constructing backend internet APIs which may be used by an array of customers, from the web to laptop to cellular. It paperwork the server factor in the RESTful (Representational State Transfer) architecture.

Question: Which will be the proper framework to be used ASP.NET MVC or ASP.NET Web API?

Answer: If one intends to build a server aspect that may be effortlessly used by an array of customers then ASP.NET Web API is the way to head. If, but, the task is solely going for use as an internet utility, then ASP.NET MVC is a more appropriate preference.

Question: What is the net.Config file and what's used for?

Answer: The web.Config record is essential because it consists of the configuration settings for the utility. It maintains your complete configuration separate from your code so that you can easily change settings with out code changes. It additionally permits you to potentially encrypt the configuration settings for improved security.

Question: Which compiler is used in ASP.NET?

Answer: Roslyn is the call of the compiler used by .NET Framework.

Question: ASP.NET is open-supply. Explain.

Answer: Microsoft is presenting the full .NET server stack in open source this means that it's far a ‘unfastened’ download. This includes ASP.NET, the .NET compiler, the .NET Core Runtime, Framework, and Libraries, permitting developers to build with .NET throughout Windows, Mac or Linux.

Question: Explain the request glide in ASP.NET MVC framework.

Answer: Request flow handles the request from the clients and passes it to the server. Request hits the controller coming from the consumer. Controller plays its position and decides which model to use on the way to serve the request in addition, passing that model to view which then transforms the version and generates the perfect reaction this is rendered to the customer.

Question: Explain the diverse modes for the Session state in ASP.NET?

Answer: There are numerous modes for storing consultation kingdom:

InProc: The session nation is saved within the reminiscence on the internet server. This is the default mode.

Custom mode: you may specify a custom garage company.

Off mode: disables the session nation.

OutProc: There are two approaches to handle this mode:

StateServer: The session nation is stored in a separate system called ASP.Net kingdom service. The session nation is retained although the utility server is restarted and is to be had to multiple Web servers.

SQLServer: Session kingdom is stored in a database, thereby keeping the consultation state despite the fact that the Web software is restarted. Session kingdom may be accessed by multiple Web servers in a Web farm.

Question: Explain the variations between GridView and DataGrid?

Answer: 

GridView DataGrid
In-built support for paging, sorting and in-place editing using PagerSettings property. Requires custom code for paging, sorting and editing.
Uses data source control's sorting, update, delete, and paging options. Only data selection is supported by default. Updates and deletions need custom code.
Supports additional column types like HyperLinkField, ButtonField etc. Supports only limited column types.
Supports both preoperative and postoperative events. Raises single events for operations.

Question: How could you provide an explanation for the variations between ListView and Repeater?

Answer: 

Repeater ListView
Flexible layout introduced in .NET 1.0. Flexible layout with easy customization introduced with .NET 3.5
No built-in support, custom code should be written for data grouping and paging. Provides built-in support for data grouping and paging.
Update, insert, delete and sorting operations are not supported. All the operations are supported.
Offers better performance. Slower performance compared to a repeater.

Question: Explain Local Resources and Global Resources?

Answer: 

Local Resources Global Resources
A local resource can only be accessed by the page that created it. Accessible by all pages.
Difficult to maintain when the website has a lot of localized content as each page requires a resource file for each language. Only one file per language is required.
Stored in the App_LocalResources folder. Stored in the App_GlobalResources folder.

Question: Briefly Describe Globalization and Localization?

Answer: Globalization is the increase of commercial enterprise outside the country wide borders. It includes expertise the laws and regulations of numerous international locations to build the enterprise surroundings. Globalization includes internalization and localization.

Localization is a procedure where a product is made available for the neighborhood marketplace via making it appealing for the local community. It consists of local possibilities, culture and nearby elements aside from simply the interpretation of web pages within the neighborhood language. 

For a solid international business, you need both globalization – through which you could growth the reach of your commercial enterprise and localization – wherein you may display customized content material based on the neighborhood options and different factors.

These help in powerful goal marketing and cohesive global approach.

Question: How are User Control and Custom Control distinctive?

Answer: 

User Control Custom Control
Stored as .ascx extension. It is a .dll extension.
They have a visual interface. These controls don't have a visual interface.
Do not appear in the toolbox and does not have design support; loaded at runtime. Can be added to the toolbox and used in various applications without re-compilation.
If we need controls particular to a website, user control is a good option. Custom controls can be created to be used across various applications.

Question: Explain server controls in ASP.NET?

Answer: Server controls are the number one controls in ASP.NET and are categorised within the following agencies:

Validation controls:  These controls validate person enter through running the customer-side script

Data supply controls:  These are used to provide statistics binding for more than one information resources.

Data view controls:  These controls are used to view/display listing and table statistics this is obtained from information assets

Login and protection controls:  used for person authentication

Master pages:  used for giving a constant interface and format for the entire software

Rich controls:  These are used to implement unique functions like fileupload, calendar control, AdRotator and so forth.

Navigation controls:   help in navigation through menus, tree perspectives and so forth

Personalization controls:   used for personalization of page based on consumer statistics and options

Question: Explain various page events in ASP.NET?

Answer: The diverse web page occasions in ASP.NET are:

Event Description
Page request This event happens before the lifecycle begins. Whenever a user requests a page, ASP.NET parses and compiles the page.
Start Properties like Request and response are set, and the Request type is determined through this event
Initialize This event sets each control's UniqueID property and applies the Master page to the page.
Rendering In this event, 'Render' method is called for each control. A text writer writes the output (view state) to OutputStream object of the page's Response property
Load control properties are loaded with information if page request is a postback,
Postback event handling If page request is a postback, an event handler is called through this event. Afterwards, the Validate method of all validator controls is called
Unload This event happens after the requested page is fully rendered and is ready to discontinue. All properties are unloaded, and cleanup is done.

Question: Define a connection string in Web.Config report?

Answer: Connection string includes statistics approximately the information supply and how to hook up with it.

Connection string is introduced as follows:

<configuration>  
  <connectionStrings>  
    <add name="myConnection" connectionString="server=localhost;database=mydatabase;" />
  </connectionStrings>
</configuration>

Question: Explain the difference between Web.Config and Machine.Config report?

Answer: 

web.config machine.config
Stores the configuration settings for a particular web application. Specifies the configuration settings for all the websites hosted on the web server.
Located in the application's root directory.  Located in $WINDOWSDIR$\Microsoft.Net\Framework\Version\Config
Overrides the settings in machine.config file. It is a master file that provides default settings that can be overridden.

Question: Explain the Global.Asax file?

Answer: It is an elective report and is also called because the application file for ASP.NET. It contains code that responds to session-stage and alertness-degree activities raised by means of HTTP modules or ASP.NET.

Question: Briefly describe the difference between the Web Site and Web Application?

Answer: 

 

 

Website Web Application
Contains static content available publicly to all the visitors. Dynamic and interactive content. 
The content is readable by all but cannot be changed or manipulated. An end-user can read and manipulate the restricted data.
These are mostly informational websites hence authentication is not mandatory. Needs authentication as these have more features and options for the user.
It is simple to create as just information is loaded and updated. Since there is interaction with the end-user, web applications are complex and perform more functions.
Website is a whole product that is accessible through the browser. It is one part of the whole website. it cannot be accessed directly.
No pre-compilation is required, only HTML code needs to be refreshed. Pre-compilation is required before deployment.

Question: Explain View State? And its advantages and drawbacks.

Answer: Suppose a user submits a form and there are validation mistakes or if the page refreshes after the person enters a variety of information at the page. In such cases, the statistics already written by using the person can be lost, and he/she has to fill the entirety again. To avoid this from happening, ASP.NET makes use of ViewState, which retains the values already entered via the user. It is a integrated kingdom control method to keep the form records. 

Advantages:

Ensures security as information is stored in an encrypted layout.

No server resources used.

ViewState residences can be easily enabled or disabled.

Developers can increase it at web page level or manage stage as in step with want.

Disadvantages:

If a massive amount of facts is stored, loading the page can also take longer than required.

Data would not transfer from one web page to any other (between pages).

Question: Explain Cookies in ASP.NET?

Answer: A cookie is part of text that stores person-precise records. Cookies are saved by way of the browser in a consumer's difficult force and used every time the user requests for a particular web page. Cookies help in improving user enjoy and loading pages faster based totally at the date and time records stored as part of the facts. In ASP, cookies can be created as well as retrieved. There are two sorts of cookies in ASP – persist, non-persist.

Question: Explain the cause of Web Services in ASP.NET?

Answer: ASP.NET can create net offerings which can be nothing however programs that use XML to trade information with different software program programs through normally used internet protocols. We can talk with any item over the net the use of web service.

Web services are language-independent, platform-impartial, protocol-independent, self-describing and programmable.

Question: Explain App Domain Concept in ASP.NET with Example.

Answer: App area or software area in ASP.NET is a light-weight technique that has its very own set of code, configuration and records settings. It is a logical boundary that separates one application from having access to or interfering with others. App domain names assist in higher usage of sources by way of using fewer processes for executing special applications. For instance, ASP.NET is a runtime host that creates exclusive application domain names for each user who accesses an internet web site. These can be created and set up for apps that want to isolate code or to load extensions dynamically.

Question: What is Query String in ASP? And what are its advantages and disadvantages?

Answer: A query string is a technique of transporting data from web page to page the usage of the browser URL. It is connected to the URL using the query mark symbol (?). For example, http://xyz.Com?Userid=12334&pwd=rf5r5jm3smQ

Advantages: Easy to apply, no server assets required, supported with the aid of all the browsers, contained in the HTTP request of the URL

Disadvantages: URL length can't be extra than 255 characters; statistics is directly seen to all of us compromising the safety.

Question: What is tracing in .NET?

Answer: Tracing in .Internet permits one to observe the execution route of a page, debug the application and show diagnostic information at runtime. Trace messages can be accessed and manipulated from the code bearing in mind finer manage to feature more details. The tracing records is organized into a fixed of tables by way of ASP.NET. 

Question: Why will we use CheckBox in .NET?

Answer: The checkbox is used to get multiple inputs from the person. Users can choose a couple of preference from the given alternatives. In the code, it's miles set as a sure/no or actual/fake option, while it is ticked, the cost of the checkbox is proper, else fake.  

Question: Explain the HTML server controls in ASP.NET?

Answer: HTML server controls offer automatic nation and server-side occasion control. These are HTML factors that have the attribute runat=server. The HTML server manipulate houses and output are similar to their equal HTML tags. These controls are compiled when the ASP.NET application is compiled.  

Question: Briefly describe the software of nation management in ASP.NET? Add Examples.

Answer: HTTP is stateless, i.E. Does not don't forget the kingdom of a user, for example, his previously visited websites, requests and URLs. However, for sure requests, we need to keep the nation of software until the give up, and ASP.NET has  procedures for the identical: 

Client-side country management: on this approach, the kingdom statistics is at once stored on the client machine. Whenever there is a consumer request, the specified data travels to and fro to cater to Request and reaction—for example, cookies, question string.

Server-facet nation control: in this approach, the state information is stored in user memory. There are more at ease domains on the server-aspect in comparison to customer-facet. Application kingdom and consultation kingdom come underneath server-side country control which include In-Proc, State server and SQL server.

Question: Describe login Controls in ASP? Also, upload source code and examples.

Answer: Login control offers a secure login answer with a user interface and properties for the customized display of textual content fields, messages and links for forgotten password and to different pages. 

We can adjust the existing LoginControl and select the format. Login manipulate homes may be written in HTML as follows:

<form id="form1" runat="server">  
 <div>  
 <asp:Login ID="Login1" runat="server" BackColor="#FFFFFF" BorderColor="#CDCC99" BorderStyle="Solid" BorderWidth="1px" Font-Names="Times New Roman" Font-Size="10pt">  
 <TitleTextStyle BackColor="#6B6B6B" Font-Bold="True" ForeColor="#E9967A" />  
 </asp:Login>  
 </div>  
</form>  
These can be set in CSS file too:
.LoginControl    
{    
      background-color:#FFFFFF;    
      border-color:#CDCC99;    
      border-style:solid;    
      border-width:1px;    
      font-family:Times New Roman;    
      font-size:10px;    
}

We can follow the CSS to the manage the usage of the CssClass characteristic:

<asp:Login ID="Login1" runat="server" CssClass="LoginControl">  

Question: What does “PostBack” mean in ASP.NET?

Answer: A PostBack takes place when a consumer takes some action (like filing a form) that sends information from the page to the server for processing thru POST approach.

Question: Explain the ASP.NET page life cycle in brief.

Answer: ASP.NET is going through a chain of levels within the life cycle of every web page.

Page request. The user requests a page. ASP.NET comes to a decision whether to compile it or serve it from a cache.

Page Start. The Request and Response gadgets are created.

Page Initialization. All page controls are initialized, and any subject matters are carried out.

Page Load. ASP.NET makes use of the view country and control country properties to set the manage homes. Default values are set inside the controls.

Postback event handling. This occasion is precipitated if the equal web page is loaded once more.

Rendering. ASP.NET saves the view kingdom for the page and writes the output of rendering to the output flow. It occurs simply earlier than the complete internet web page is sent to the person.

Unload. The rendered page receives despatched to the customer. ASP.NET unloads page properties and performs cleanup. All undesirable gadgets are eliminated from reminiscence.

Question: What is view state in ASP.NET?

Answer: View nation is where statistics is used to preserve page values and manipulate values of Web Forms for the duration of postback occasion managing. Data may be saved as hidden fields on the patron net page.

Question: What is the distinction between custom controls and consumer controls?

Answer: Custom controls are basically compiled code, i.E., DLLs. These may be without difficulty delivered to the toolbox, so it can be effortlessly used across multiple projects using a drag-and-drop technique. These controls are relatively tough to create. But User Controls (.Ascx) are similar to pages (.Aspx). These are relatively smooth to create however tightly coupled with appreciate to User Interface and code.

Question: What are the distinct Validators in ASP.NET?

Answer: ASP.NET validation controls outline an essential function in validating the user enter records. Whenever the consumer gives input, it must usually be verified before sending it across the numerous layers of an utility. There are two kinds of validation in ASP.NET:

Client-Side Validation

Server-Side Validation

Client-Side Validation: When validation is executed at the consumer browser, it's miles referred to as Client-Side Validation. You can use JavaScript to do the Client-Side Validation.

Server-Side Validation: When validation takes place at the server, then it's miles called Server-Side Validation. Server-Side Validation is a at ease form of validation. The predominant gain of Server-Side Validation is that if the consumer bypasses the Client-Side Validation, the hassle may be stuck at the server-facet.

The following are the Validation Controls in ASP.NET:

RequiredFieldValidator Control

CompareValidator Control

RangeValidator Control

RegularExpressionValidator Control

CustomFieldValidator Control

ValidationSummary

Question: What does the technique Finalize do in ASP.NET?

Answer: The Finalize technique is used to carry out cleanup operations on unmanaged assets held via an item. It puts an object inside the finalization queue. The Object will then be collected via the garbage collector geared up to be wiped clean up.

Question: What is RedirectPermanent in ASP.Net?

Answer: RedirectPermanent Performs a everlasting redirection from the asked URL to the required URL. Once the redirection is done, it additionally returns http 301 reputation code to the browser.

Question: What is the feature of the LoginStatus Control?

Answer: LoginStatus control is used to display Login/Logout links primarily based at the login/authorization status of the present day person. If the consumer has correctly logged in, the Logout hyperlink may be displayed.

Question: What is a Repeater Control and what are the templates supported with the aid of the Repeater?

Answer: A Repeater is a Data-sure control. Data-certain controls are field controls. It creates a hyperlink between the Data Source and the presentation UI to display the information. The repeater manipulate is used to show a repeated list of objects. A Repeater has 5 inline templates to layout it:

Displays Header textual content for a Data Source series and applies a unique fashion for the Header text.

Changes the history color or style of alternating items in a Data Source collection.

It defines how each object is rendered from the Data Source collection.

It will determine the separator element that separates each item inside the object series. It could be a

or

HTML element.

Displays a footer detail for the Data Source series.

Question: What are the distinctive Session kingdom management alternatives available in ASP.NET?

Answer: In-Process and Out-of-Process are the 2 consultation state management options.

In-Process shops the session in reminiscence at the web server.

Out-of-Process Session country control shops records in an outside server. All items stored in session are required to be serializable.

Question: What is the distinction Between Server.Transfer and Response.Redirect?

Answer: Server. Transfer sends records from one internet request to some other, all at the server aspect. A reaction isn't always despatched to the browser. On the opposite hand, Response.Redirect sends an HTTP 302 message to the browser and causes a redirect inside the browser.

Question: What is fragment caching?

Answer: Fragment caching refers back to the caching of character user controls within a Web Form. Each user control could have independent cache intervals and implementations of how the caching conduct is to be applied. Fragment caching is beneficial whilst you want to cache simplest a subset of a web page.

Question: What are internet controls in ASP.NET?

Answer: Web controls are lessons within the .NET framework. The controls have unique tags understood via the server. They are created at the server and require a run at=”server” attribute to execute. They generate HTML code this is sent lower back to the browser.

Question: Give some examples of web controls.

Answer:

Button

Calendar

Checkboxlist

DropDownList

RadioButtonList

Question: What is an internet carrier?

Answer: A Web service, in the context of .NET, is part that is living on a Web server and affords records and services to different network packages the use of standard Web protocols together with HTTP and Simple Object Access Protocol (SOAP).

Question: What is the distinction among consultation and alertness item?

Answer: The difference among session and application item is that every one customers percentage one Application item and with classes, there's one session item for every person. Data saved inside the utility item may be shared by using all of the classes of the application. Application item shops data inside the key-cost pair. Session object shops consultation-specific facts and the statistics are visible within the consultation simplest. ASP.NET creates precise SessionId for every consultation of the software. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the applications configuration settings. By default, SessionID values are saved in cookies.

Question: What is Caching and what are the blessings of the use of it?

Answer: Caching is a mechanism that improves performance for an application through storing facts in the reminiscence for quicker get entry to. When the software accesses information from Cache (i.E. In-memory) in place of fetching it from the authentic facts shop (perhaps a database), it actually improves performance. But Caching benefits are not constrained most effective to performance; it additionally improves software Scalability and Availability.

Question: What are the types of Authentication in ASP.NET?

Answer: There are three types of authentication available in ASP.NET:

Windows Authentication: This authentication technique makes use of built-in Windows protection functions to authenticate a user.

Forms Authentication: Authenticates in opposition to a customized listing of users or users in a database.

Passport Authentication: Validates in opposition to Microsoft Passport carrier which is essentially a centralized authentication service.

Question: What is ASP.NET AJAX?

Answer: Microsoft has furnished an implementation of AJAX capability referred to as ASP.NET AJAX. AJAX stands for Asynchronous JavaScript and XML. This is a pass-platform technology that hastens reaction time and decreases visitors among patron and server. ASP.NET AJAX is a hard and fast of extensions to ASP.NET and is derived with reusable AJAX controls.

Question: What is the REST structure?

Answer: REST (Representational State Transfer) is an architectural style for designing programs and it dictates to apply HTTP for making calls for communications as opposed to complex mechanism like CORBA, RPC or SOAP. There are few concepts associated with REST architectural style:

Everything is a aid i.E. File, Images, Video, WebPage and many others.

Every Resource is diagnosed by using a Unique Identifier.

Use easy and Uniform Interfaces.

Everything is performed thru representation (sending requests from a patron to server and receiving responses from server to purchaser).

Be Stateless- Every request should be an impartial request.

Question: ASP.NET is cross-platform Explain.

Answer: ASP.NET programs can be developed and run on any running structures like Windows, Linux, macOS, and Docker. Hence it's far known as a Cross-platform framework.

Question: What is Razor in ASP.NET

Answer: Razor is a markup syntax that lets you embed server-based code (Visual Basic and C#) into net pages. The server-based code can create dynamic internet content on the fly, while a web web page is written to the browser. When a web web page is referred to as, the server executes the server-based totally code inside the web page before it returns the page to the browser. By going for walks at the server, the code can carry out complicated obligations, like gaining access to databases. Razor is primarily based on ASP.NET, and designed for growing internet applications. It has the strength of conventional ASP.NET markup, but it's far simpler to use and less difficult to examine.

Question: What is ASP.NET Core?

Answer: ASP.NET Core is the open-supply and cross-platform model of ASP.NET. The Windows-most effective versions of ASP.NET, that existed earlier than ASP.NET Core, is typically simply known as ASP.NET.

Here you could download ASP.Internet Interviews Questions PDF.

Looking to comb up your ASP.NET before the interview? This first-rate udemy route can be a first-rate asset to you in getting ready for your ASP.Net interview: The Complete ASP.NET MVC five Course.




CFG