ASP.NET Interview Questions and Answers
Q1. What is ASP?
Q2. What is ASP.NET?
Ans: ASP.NET is a detail created by Microsoft to make dynamic Web applications, Web destinations, and Web administrations. It is a piece of .NET Framework. You can make ASP.NET applications in the vast majority of the .NET viable dialects, like Visual Basic, C#, and J#. The ASP.NET arranges the Web pages and gives much preferred execution over prearranging dialects, like VBScript. The Web Forms backing to make strong structures based Web pages. You can utilize ASP.NET Web server controls to make intuitive Web applications. With the assistance of Web server controls, you can undoubtedly make a Web application.
Or on the other hand
What is ASP.NET?
Ans: ASP.NET was created in direct reaction to the issues that designers had with exemplary ASP. Since ASP is in such wide use, nonetheless, Microsoft guaranteed that ASP scripts execute without change on a machine with the .NET Framework (the ASP motor, ASP.DLL, isn't altered while introducing the .NET Framework). Hence, IIS can house both ASP and ASP.NET scripts on a similar machine.
Q3. What Are Advantages of ASP.NET?
Ans: Advantages of Asp.net are:
Division of Code from HTML:
To make a decisive victory, with ASP.NET you can totally different format and business rationale. This makes it a lot simpler for groups of software engineers and planners to productively team up.
Support for aggregated dialects:
Designer can utilize VB.NET and access elements, for example, solid composing and article arranged programming. Utilizing aggregated dialects additionally implies that ASP.NET pages don't experience the exhibition punishments related with deciphered code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) assembled when originally mentioned. Resulting demands are coordinated to the completely ordered code, which is reserved until the source changes.
Use administrations gave by the .NET Framework:
The .NET Framework gives class libraries that can be utilized by your application. A portion of the key classes assist you with input/yield, admittance to working framework administrations, information access, or in any event, troubleshooting. We will meticulously describe the situation on some of them in this module.
Graphical Development Environment:
Visual Studio .NET gives an exceptionally rich improvement climate for web engineers. You can move controls and set properties the manner in which you do in Visual Basic 6. Furthermore, you have full IntelliSense support, for your code, yet in addition for HTML and XML.
State the executives:
To allude to the issues referenced previously, ASP.NET gives answers for meeting and application state the board. State data can, for instance, be kept in memory or put away in a data set. It very well may be shared across web homesteads, and state data can be recuperated, regardless of whether the server comes up short or the association separates.
Update records while the server is running:
Parts of your application can be refreshed while the server is on the web and clients are associated. The structure will utilize the new records when they are replicated to the application. Eliminated or old records that are still being used are kept in memory until the clients have wrapped up.
XML-Based Configuration Files:
Arrangement settings in ASP.NET are put away in XML records that you can without much of a stretch read and alter. You can likewise effectively duplicate these to another server, alongside different documents that involve your application.
Or then again
ASP.NET offers types of assistance to permit the creation, organization, and execution of Web Applications and Web Services like ASP, ASP.NET is a server-side innovation. Web Applications are constructed utilizing Web Forms. ASP.NET accompanies worked in Web Form controls, which are answerable for creating the UI. They reflect regular HTML gadgets, for example, text boxes or fastens. On the off chance that these controls don't meet your requirements, you are allowed to make your own client controls.
Benefits of ASP.NET:
Division of Code from HTML
Support for aggregated dialects
Use administrations gave by the .NET Framework
Graphical Development Environment
Update records while the server is running
XML-Based Configuration Files
Q4. What is the fundamental contrast among ASP and ASP.NET?
Ans: The essential distinction among ASP and ASP.NET is that ASP is deciphered; while, ASP.NET is arranged. This infers that since ASP utilizes VBScript; subsequently, when an ASP page is executed, it is deciphered. Then again, ASP.NET utilizes .NET dialects, for example, C# and VB.NET, which are aggregated to Microsoft Intermediate Language (MSIL).
Q5. In which occasion are the controls completely stacked?
Ans: Page load occasion ensures that all controls are completely stacked. Controls are additionally gotten to in Page_Init occasions yet you will see that view state isn't completely stacked during this occasion
[teaserbox type="5" img="2802" title="Interested in learning Asp.net" subtitle="Join Us Today! We are myTectra!" link_url="http://www.mytectra.com/web-programming interface preparing in-bangalore.html" target="blank"]
Q6. How might we recognize that the Page is Post Back?
Ans: Page object has an "IsPostBack" property, which can be checked to realize that is the page posted back.
Q7. What is the life expectancy for things put away in ViewState?
Ans: The things put away in ViewState live until the lifetime of the ongoing page terminates including the postbacks to a similar page.
Q8. How data about the client's area can be gotten to?
Ans: The data with respect to a client's district can be gotten to by utilizing the System.Web.UI.Page.Cultureproperty.
Q9. What is the distinction between SQL warning and SQL negation?
Ans: The SQL store warning creates notices when the information of a data set changes, on which your reserve thing depends. The SQL reserve negation makes a stored thing invalid when the information put away in a SQL server data set changes.
Q10. Which is the parent class of the Web server control?
Ans: The System.Web.UI.Control class is the parent class for all Web server controls.
Q11. What are the different validators in ASP.NET?
Ans: ASP.NET approval controls characterize a significant job in approving the client input information. Whenever the client gives the information, it should continuously be approved prior to sending it across to different layers of an application. In the event that we get the client input with approval, odds are we are sending some unacceptable information. In this way, approval is smart to do at whatever point we are taking contribution from the user.There are the accompanying two sorts of approval in ASP.NET:
At the point when approval happens on the server, then, at that point, it is known as Server-Side Validation. Server-Side Validation is a protected type of approval. The primary benefit of Server-Side Validation is assuming that the client some way or another detours the Client-Side Validation, we can in any case get the issue on server-side.
Coming up next are the Validation Controls in ASP.NET:
Q12. Might you at any point set which kind of examination you need to perform by the CompareValidator control?
Ans: Yes, by setting the Operator property of the CompareValidator control.
Q13. What is the way of behaving of a Web program when it gets an invalid component?
Ans: The way of behaving of a Web program when it gets an invalid component relies upon the program that you use to peruse your application. The greater part of the programs disregard the invalid component; while, some of them show the invalid components on the page.
Q14. What are the benefits of the code-behind include?
Ans: The code-behind element of ASP.NET offers various benefits:
Makes code straightforward and investigate by isolating application rationale from HTML labels
Gives the disconnection of exertion between visual creators and computer programmers
Eliminates the issues of program contradiction by giving code documents to exist on the Web server and supporting Web pages to be assembled on request.
Q15. How would you sign out from structures confirmation?
Ans: The FormsAuthentication.Signout() strategy is utilized to sign out from the structures verification.
Q16. What is AutoPostBack?
Ans: If you need a control to postback naturally when an occasion is raised, you want to set the AutoPostBackproperty of the control to True.
Q17. What is View State?
Ans: View State is the strategy to protect the Value of the Page and Controls between full circle trips. It is a Page-Level State Management strategy. View State is turned on as a matter of course and ordinarily serializes the information in each control on the page whether or not it is really utilized during a post-back.A web application is stateless. That implies that another case of a page is made each time when we make a solicitation to the server to get the page and after the full circle our page has been lost right away
Highlights of View State
These are the primary highlights of view state:
Holds the worth of the Control after post-back without utilizing a meeting.
Stores the worth of Pages and Control Properties characterized in the page.
Makes a custom View State Provider that gives you store View State Information access a SQL Server Database or in another information store.
Q18. What Are Advantages of View State?
Ans: Advantages of view state are:Easy to Implement. No server assets are required: The View State is held in a design inside the page load. Upgraded security highlights: It can be encoded and compacted or Unicode execution.
Q19. What is the capability of the ViewState property?
Ans: The ASP.NET 4.0 presented another property called ViewStateMode for the Control class. Presently you can empower the view state to a singular control regardless of whether the view state for an ASP.NET page is incapacitated.
Q20. For what reason do you involve the App_Code envelope in ASP.NET?
Ans: The App_Code envelope is naturally present in the task. It stores the records, for example, classes, composed informational collection, text documents, and reports. In the event that this envelope isn't accessible in the application, you can add this organizer. One of the significant elements of the App_Code organizer is that only one dll is made for the total envelope, independent of the number of documents it that contains.
Q21. Characterize a multilingual Web website.
Ans: A multilingual Web website serves content in various dialects. It contains various duplicates for its substance and different assets, like date and time, in various dialects.
Q22. What is an ASP.NET Web Form?
Ans: ASP.NET Web structures are intended to utilize controls and highlights that are nearly all around as strong as the ones utilized with Windows structures, thus they are called as Web structures. The Web structure utilizes a server-side item model that permits you to make practical controls, which are executed on the server and are delivered as HTML on the client. The characteristic, runat="server", related with a server control demonstrates that the Web structure should be handled on the server.
Q23. What is the distinction between a default skin and a named skin?
Ans: The default skin is applied to all the Web server controls in a Web structure, which are of comparable sort, and it doesn't give a Skin ID quality. The named skin gives a Skin ID characteristic and clients need to set the Skin ID property to apply it.
Q24. What are the information controls accessible in ASP.NET?
Ans: The Controls having DataSource Property are called Data Controls in ASP.NET. ASP.NET permits strong element of information restricting, you can tie any server control to basic properties, assortments, articulations or potentially techniques. At the point when you use information restricting, you have greater adaptability when you use information from a data set or different means.
Information Bind controls are compartment controls.
Controls - > Child Control
Information Binding will be restricting controls to information from data sets. With information restricting we can tie a control to a specific segment in a table from the data set or we can tie the entire table to the information lattice.
Information restricting gives straightforward, helpful, and strong method for making a read/compose connect between the controls on a structure and the information in their application.
Information restricting permits you to take the aftereffects of properties, assortment, technique calls, and data set inquiries and coordinate them with your ASP.NET code. You can consolidate information restricting with Web control delivering to free much from the programming trouble encompassing Web control creation. You can likewise utilize information restricting with ADO.NET and Web controls to populate control contents from SQL select proclamations or put away techniques.
Information restricting purposes an exceptional grammar:
The <%#, which educates ASP.NET to assess the articulation. The distinction between an information restricting labels and an ordinary code inclusion labels <% and %> becomes obvious when the articulation is assessed. Articulations inside the information restricting labels are assessed just when the DataBind technique in the Page items or Web control is called.
Information Bind Control can show information in associated and separated model.
Following are information tie controls in ASP.NET:
BulletList and so forth.
Q25. What is IIS? For what reason is it utilized?
Ans: Internet Information Services (IIS) is made by Microsoft to give Internet-based administrations to ASP.NET Web applications. It makes your PC to fill in as a Web server and gives the usefulness to create and convey Web applications on the server. IIS handles the solicitation and reaction cycle on the Web server. It additionally offers the administrations of SMTP and FrontPage server augmentations. The SMTP is utilized to send messages and use FrontPage server expansions to get the unique elements of IIS, like structure overseer.
Q26. What is Query String? What are its benefits and constraints?
Ans: The Query String helps in sending the page data to the server.
The Query String enjoys the accompanying benefits:
Each program works with Query Strings.
It doesn't need server assets thus applies no sort of weight on the server.
Coming up next are the restrictions of Query String:
Data should be inside the cutoff since URL doesn't uphold many characters.
Data is obviously apparent to the client, which prompts security dangers.
Q27. What is really gotten back from server to the program when a program demands an .aspx document and the record is shown?
Ans: When a program demands an .aspx record then the server returns a reaction, which is delivered into a HTML string.
Q28. How might you show all approval messages in a single control?
Ans: The ValidationSummary control shows all approval messages in a single control.
Q29. Which two new properties are included ASP.NET 4.0 Page class?
Ans: The two new properties included the Page class are MetaKeyword and MetaDescription.
Q30. What is following? Where is it utilized?
Ans: Tracing shows the insights regarding how the code was executed. It alludes to gathering data about the application while it is running. Following data can assist you with investigating an application. It empowers you to keep data in different log documents about the mistakes that could happen at run time. You can break down these log documents to track down the reason for the mistakes.
In .NET, we have objects called Trace Listeners. An audience is an item that gets the follow result and stores it to better places, for example, a window, a record on your region drive, or a SQL Server.
The System.Diagnostics namespace contains the predefined points of interaction, classes, and designs that are utilized for following. It supplies two classes, Trace and Debug, which permit you to compose mistakes and logs connected with the application execution. Follow audience members are objects that gather the result of following cycles.
Or then again
Following assists with seeing the data of issues at the runtime of the application. As a matter of course Tracing is incapacitated.
Following has the accompanying significant highlights:
We can see the execution way of the page and application utilizing the investigate explanation.
We can get to and control follow messages automatically.
We can see the latest following of the information.
Following should be possible with the accompanying 2 sorts.
Page Level: When the follow yield is shown on the page and for the page-level following we want to set the property of following at the page level.
<%@ Page Trace="true" Language="C#"
Application: Level: In Application-Level following the data is put away for each solicitation of the application. The default number of solicitations to store is 10. Be that as it may, if you need to expand the quantity of solicitations and dispose of the more seasoned solicitation and show a new solicitation then you really want to set the property in the web.config document.
Q31. What is the distinction among verification and approval?
Ans: Authentication confirms the personality of a client and approval is a cycle where you can check whether the character approaches privileges to the framework. All in all, you can say that verification is a methodology of getting a few qualifications from the clients and confirm the client's personality against those certifications. Approval is a system of conceding access of specific assets to a validated client. You ought to take note of that confirmation generally happens before approval.
Q32. What is the confirmation and approval in ASP.NET?
Ans: Authentication: Prove validity
Approval: interaction of conceding endorsement or authorization on assets.
In ASP.NET confirmation means to distinguish the client or as such its only to approve that he exists in your data set and he is the legitimate client.
Approval implies does he approach a specific asset on the IIS site. An asset can be an ASP.NET website page, media records (MP4, GIF, JPEG and so forth), compacted document (ZIP, RAR) and so on.
Q33. What are the kinds of verification and approval in ASP.NET
Sorts of verification and approval in ASP.NET:
Ans: There are four different ways of doing verification and approval in ASP.NET:
Windows verification: In this system ASP.NET website pages will utilize nearby windows clients and gatherings to confirm and approve assets.
Structures Authentication: This is a treat based confirmation where username and secret key are put away on client machines as treat documents or they are sent through URL for each solicitation. Structure based validation gives the client a HTML-based Web page that prompts the client for accreditations.
Visa verification: Passport confirmation depends on the identification site given by the Microsoft .So when client logins with qualifications it will be reached to the visa site ( for example hotmail,devhood,windows live and so on) where verification will occur. On the off chance that Authentication is fruitful it will restore a token to your site.
Unknown access: If you need no sort of verification then you will go for Anonymous access.
In 'web.config' record set the validation mode to 'Windows' as displayed in the underneath code bits.
We additionally need to guarantee that all clients are denied with the exception of approved clients. The underneath code piece inside the approval label that all clients are denied. '?' shows any obscure client.
Q34. How might you enroll a custom server control to a Web page?
Ans: You can enroll a custom server control to a Web page utilizing the @Register order.
Q35. Which ASP.NET objects embody the condition of the client and the program?
Ans: The Session object epitomizes the condition of the client and program.
Separate globalization and limitation.
The globalization is a strategy to recognize the particular piece of a Web application that is different for various dialects and make separate that part from the center of the Web application. The restriction is a system of designing a Web application to be upheld for a particular language or region.
Q36. What is ViewState?
Ans: The ViewState is a component utilized by ASP.NET Web page to store the worth of a page and its controls not long prior to posting the page. When the page is posted, the primary undertaking by the page handling is to reestablish the ViewState to get the upsides of the controls.
Q37. Which technique is utilized to compel all the approval controls to run?
Ans: The Page.Validate() strategy is utilized to compel all the approval controls to run and to perform approval.
Q38. Which strategy has been acquainted in ASP.NET 4.0 with divert a page for all time?
Ans: The RedirectPermanent() strategy included ASP.NET 4.0 to forever divert a page. The accompanying code piece is an illustration of the RedirectPermanent() strategy:
Q39. How might you send an email message from an ASP.NET Web page?
Ans:Youcan utilize the System.Net.Mail.MailMessage and the System.Net.Mail.SmtpMail classes to send an email in your Web pages. To send an email through your mail server, you really want to make an object of the SmtpClient class and set the server name, port, and accreditations.
Q40. What is the contrast between the Response.Write() and Response.Output.Write() techniques?
Ans: The Response.Write() technique permits you to compose the ordinary result; though, the Response.Output.Write() strategy permits you to compose the arranged result.
Q41. What does the Orientation property do in a Menu control?
Ans: Orientation property of the Menu control sets the flat or vertical presentation of a menu on a Web page. As a matter of course, the direction is vertical.
Q42. Separate between client-side and server-side approvals in Web pages.
Q43. How does a substance page vary from an expert page?
Ans: A substance page doesn't have total HTML source code; though an expert page has total HTML source code inside its source record.
Q44. Assume you need an ASP.NET capability (client side) executed on the MouseOver occasion of a button. Where do you add an occasion overseer?
Ans: The occasion overseer is added to the Add() strategy for the Attributes property.
Q45. What is the default break for a Cookie?
Ans: The default time length for a Cookie is 30 minutes.
Q46. What are HTTP controllers in ASP.NET?
Ans: HTTP controllers, as the name recommends, are utilized to deal with client demands for Web application assets. They are the foundation of the solicitation reaction model of Web applications. There is a particular occasion overseer to deal with the solicitation for every client demand type and send back the comparing reaction object.
Every client solicitations to the IIS Web server moves through the HTTP pipeline, which alludes to a progression of parts (HTTP modules and HTTP controllers) to deal with the solicitation. HTTP modules go about as channels to deal with the solicitation as it goes through the HTTP pipeline. The solicitation, in the wake of going through the HTTP modules, is appointed to a HTTP overseer that decides the reaction of the server to the client demand. The reaction then, at that point, goes through the HTTP modules indeed and is then sent back to the client.
You can characterize HTTP controllers in the <httpHandlers> component of a design record. The <add> component tag is utilized to add new overseers and the <remove> component tag is utilized to eliminate existing controllers. To make a HTTP controller, you want to characterize a class that executes the IHttpHandler interface.
Q47. What are the occasions that happen when a client demands an ASP.NET page from IIS server?
Ans: The accompanying occasions happen when a client demands an ASP.NET page from the IIS server:
Client demands for an application asset.
The incorporated solicitation handling pipeline gets the principal client demand.
Reaction objects are made for every client demand.
An object of the HttpApplication class is made and assigned to the Request object.
The HttpApplication class processes the client demand.
Q48. Make sense of record based reliance and key-based reliance.
Ans: In record based reliance, you need to rely upon a document that is saved in a plate. In key-based reliance, you need to rely upon one more stored thing.
Q49. How might you execute the postback property of an ASP.NET control?
Ans: You want to set the AutoPostBack property to True to carry out the PostBack property of controls.
Q50. Make sense of how Cookies work. Give an illustration of Cookie misuse.
Ans: The waiter advises the program to place a few records in a treat, and the client then sends every one of the treats for the space in each solicitation. An illustration of treat misuse is enormous treats influencing the organization traffic.
Q51. What are Cookies in ASP.NET?
Ans: Cookies are a State Management Technique that can store the upsides of control after a post-back. Treats can store client explicit Information on the client's machine like when the client last visited your site. Treats are additionally known by many names, like HTTP Cookies, Browser Cookies, Web Cookies, Session Cookies, etc. Fundamentally treats are a little message record sent by the web waiter and saved by the Web Browser on the client's machine.List of properties containing the HttpCookies Class:
Area: Using these properties we can set the space of the treat.
Terminates: This property sets the Expiration season of the treats.
HasKeys: If the treats have a subkey then it brings True back.
Name: Contains the name of the Key.
Way: Contains the Virtual Path to be submitted with the Cookies.
Gotten: If the treats are to be passed in a protected association then it just brings True back.
Esteem: Contains the worth of the treats.
Impediment of the Cookies
The size of treats is restricted to 4096 bytes.
A sum of 20 treats can be utilized in a solitary site.
Q52. Make sense of login controls.
Ans: Login controls are implicit controls in ASP.Net for giving a login answer for ASP.NET application. The login controls utilize the participation framework to verify a client qualifications for a Web webpage.
There are many controls in login controls.
ChangePassword control - Allows clients to change their secret key.
CreateUserWizard control - Provides a point of interaction to the client to enroll for that Web webpage.
Login control - Provides a point of interaction for client validation. It comprises of a bunch of controls, like TextBox, Label, Button, CheckBox, HyperLink.
LoginView control - Displays fitting data to various clients as per the client's status.
LoginStatus control - Shows a login connection to clients, who are not confirmed and logout interface, who are validated
LoginName control - Displays a client name, on the off chance that the client signs in.
PasswordRecovery control - Allows clients to help back the secret phrase through an email, assuming that they neglect.
Q53. Utilization of CheckBox in .NET?
Ans: The CheckBox control is an exceptionally normal control of HTML, not at all like radio buttons it can choose different things on a website page. The CheckBox control in ASP.NET has numerous properties and some of them are recorded underneath.
AutoPostBack Specifies whether the structure ought to be posted following the Checked property has changed or not. The default is bogus.
CausesValidation Specifies on the off chance that a page is approved when a Button control is clicked.
Checked Specifies regardless of whether the check box is checked.
InputAttributes Attribute names and values utilized for the Input component for the CheckBox control.
LabelAttributes Attribute names and values utilized for the Label component for the CheckBox control.
runat Specifies that the control is a server control. Should be set to "server".
Text The text close to the actually look at box.
TextAlign On which side of the check box the text ought to show up (right or left).
ValidationGroup Group of controls for which the Checkbox control makes approval when it posts back the server.
OnCheckedChanged The name of the capability to be executed when the Checked property has changed.
Q54. What is the utilization of PlaceHolder control? Could we at any point see it at runtime?
Ans: The PlaceHolder control goes about as a compartment for those controls that are progressively produced at runtime. We can't see it at runtime in light of the fact that it delivers no apparent result. It utilized exclusively as a compartment.
Q55. What setting should be included the setup record to deny a specific client from getting to the gotten assets?
Ans: To deny a specific client structure getting to the gotten assets, the web.config document should contain the accompanying code:
Q56. What are the occasion controllers that can be remembered for the Global.asax document?
Ans: The Global.asax document contains a portion of the accompanying significant occasion overseers:
Or on the other hand
The Global.asax document, which is gotten from the HttpApplication class, keeps a pool of HttpApplication protests, and doles out them to applications depending on the situation. The Global.asax record contains the accompanying occasions:
Q57. What is reserving in ASP.NET?
Ans: Caching is one of the most intriguing idea and activity with regards to ASP.NET. On the off chance that you can deal with it, you can run any web application by applying the reserving idea relying upon the necessities.
Reserving is for giving arrangements or the outcomes to the clients relying upon their solicitation, administrator requirements to reproduce the pages frequently relying upon client demands… STOP!!! "A reserve basically stores the result created by a page in the memory and this saved result (reserve) will serve us (clients) later on".
What are Types of storing?
Kinds of Caching are:
Q58. What is the distinction between page-level reserving and part storing?
Ans: In the page-level storing, a whole Web page is reserved; though, in the piece reserving, a piece of the Web page, for example, a client control added to the Web page, is reserved.
Q59. Make a rundown of all layouts of the Repeater control.
Ans: The Repeater control contains the accompanying formats:
Q60. What is MVC?
Ans: Model-View-Controller (MVC) is an example to isolate an application into the accompanying three principal parts:
Q61. What are the upsides of The ASP.NET MVC system?
Ans: The ASP.NET MVC structure offers the accompanying benefits:
It makes it exceptionally simple to oversee intricacy by separating an application into the Model, View and Controller.
It doesn't utilize view state or server-based structures.
It offers better help for Test-Driven Development (TDD).
It functions admirably for Web applications that are upheld by huge groups of engineers and for website specialists who need a serious level of command over the application conduct.
Of course backing of Facebook and Google Authentication.
It simple to deal with an enormous application to separate in various regions.