Interview Questions.

ASP.NET Interview Questions and Answers For Experienced

fluid

ASP.NET Interview Questions and Answers For Experienced

Q1. What is ASP.NET?

Ans: ASP.NET changed into advanced in direct acknowledgment to the troubles that builders had with popular ASP. Since ASP is in such huge use, Microsoft assured that ASP scripts execute without modification on a gadget with the .NET Framework (the ASP engine, ASP.DLL, is not changed whilst putting in the .NET Framework). Thus, IIS can residence each ASP and ASP.NET scripts on the identical system.

Q2. What is XHTML? Are ASP.NET Pages compliant with XHTML?

Ans: In plain phrases, XHTML is a stricter and cleaner model of HTML. XHTML stands for EXtensible Hypertext Markup Language and is a W3C Recommendation.

Yes, ASP.NET 2.0 Pages are XHTML compliant. However the power has been given to the consumer to feature the relevant file kind declaration.

Q3. Does ViewState have an effect on overall performance? What is the right size of a ViewState? How can you compress a viewstate?

Ans: Viewstate stores the state of controls in HTML hidden fields. At times, this facts can develop in capacity. This does have an effect on the comprehensive responsiveness of the page, thereby affecting performance. The ideal size of a viewstate ought to be now not more than 25-30% of the web page size.

ViewState may be compressed to nearly 50% of its length. .NET also affords the GZipStream orDeflateStream to compress viewstate

Q4. How can you hit upon if a viewstate has been tampered?

Ans: By setting the EnableViewStateMac to true in the @Page directive. This attribute tests the encoded and encrypted viewstate for tampering.

Q5. Can the App_Code folder include supply code documents in exceptional programming languages?

Ans: No. All source code files saved within the root App_Code folder have to be inside the identical programming language. However, you may create two subfolders in the App_Code and then upload each C# and VB.NET in the respective subfolders. You also have to upload configuration settings inside the net.Config for this to paintings.

Q6. Can I set up the software with out deploying the supply code at the server?

Ans: Yes. You can complicate your code by way of using a new precompilation technique called ‘precompilation for deployment’. You can use the aspnet_compiler.Exe to precompile a site. This system builds each web page in your net application right into a unmarried application DLL and a few placeholder files. These documents can then be deployed to the server.

You can also finish the identical mission the use of Visual Studio 2005 via the usage of the Build->Publish menu.

Q7. Can I use exceptional programming languages within the same utility?

Ans: Yes. Each web page may be written with a distinctive programming language in the identical software. You can create some pages in C# and a few in VB.NET.

Q8. How to secure your connection string records?

Ans: By using the Protected Configuration feature.

Q9. What is Cross Page Posting? How is it accomplished?

Ans: By default, ASP.NET submits a shape to the same web page. In cross-page posting, the shape is submitted to a exclusive page. This is accomplished by means of setting the ‘PostBackUrl’ property of the button(that reasons postback) to the preferred page. In the code-in the back of of the page to which the shape has been posted, use the ‘FindControl’technique of the ‘PreviousPage’ belongings to reference the facts of the manage in the first page.

Q10. Can you convert a Master Page dynamically at runtime? How?

Ans: Yes. To change a master page, set the MasterPageFile assets to point to the .Master page at some point of the PreInit page occasion.

Q11. How to at ease your configuration files to be accessed remotely by way of unauthorized users?

Ans: ASP.NET configures IIS to disclaim access to any user that requests get admission to to the Machine.Config or Web.Config files.

Q12. How to  configure ASP.NET applications which can be jogging on a far off system?

Ans: You can use the Web Site Administration Tool to configure faraway web sites.

Q13. How many net.Config documents can I have in an application?

Ans: You can preserve multiple internet.Config documents in an software. You can place a Web.Config document inside a folder or wherever you need (apart from a few exceptions) to override the configuration settings that are inherited from a configuration report located at a higher level inside the hierarchy.

Q14. What is the difference between Response.Write and Response.Output.Write?

Ans: As quoted by using Scott Hanselman, the quick answer is that the latter offers you String.Format-style output and the previous doesn't.

HubSpot Video
 

Q15. How do you apply Themes to a whole utility?

Ans: By specifying the topic inside the web.Config report.

< configuration >

 

< system.Web >

 

< pages theme=”BlueMoon” />

 

</ system.Web >

 

</ configuration >
 

Q16. How do you exclude an ASP.NET web page from using Themes?

Ans: To take away topics out of your web page, use the EnableTheming attribute of the Page directive.

Q17. Your client complains that he has a big shape that collects user input. He desires to ruin the shape into sections, maintaining the information inside the forms related. Which control will you operate?

Ans: The ASP.NET Wizard Control.

Q18.  Webservices aid statistics reader?

Ans: No. However it does guide a dataset.

Q19. Can you programmatically get admission to IIS configuration settings?

Ans: Yes. You can use ADSI, WMI, or COM interfaces to configure IIS programmatically. 

Q20. What is caching in ASP.NET?

Ans: Caching is one of the maximum interesting concept and operation in ASP.NET. If you could deal with it, you can run any internet utility by means of making use of the caching concept depending on the necessities.Caching is for imparting answers or the effects to the users relying on their request, admin needs to recreate the pages regularly relying on consumer requests…STOP!!! "A cache truly stores the output generated through a web page inside the reminiscence and this stored output (cache) will serve us (customers) inside the destiny.

Types

Page Caching

Fragment Caching

Data Caching

 

Q21. What are the fundamental occasions in global.Aspx?

 

Ans: The Global.Asax report, that's derived from the HttpApplication magnificence, continues a pool of HttpApplication objects, and assigns them to applications as wanted. The Global.Asax file includes the following activities:
 

Application_Init

Application_Disposed

Application_Error

Application_Start

Application_End

Application_BeginReques

Q22. What is use of the AutoEventWireup characteristic inside the Page directive ?

Ans: The AutoEventWireUp is a boolean attribute that permits computerized wireup of page events when this attribute is set to authentic on the page. It is ready to True via default for a C# net shape whereas it's far set as False for VB.NET forms. Pages advanced with Visual Studio .NET have this characteristic set to fake, and web page activities are personally tied to handlers.

Q23. What takes place when you exchange the net.Config file at run time?

Ans: ASP.NET invalidates the present cache and assembles a brand new cache. Then ASP.NET automatically restarts the utility to use the changes.

Q24. What are Cookies in ASP.NET?

Ans: Cookies are a State Management Technique that may shop the values of manage after a put up-back. Cookies can keep person-unique Information at the consumer's device like when the user ultimate visited your website. Cookies are also regarded by many names, such as HTTP Cookies, Browser Cookies, Web Cookies, Session Cookies and so on. Basically cookies are a small text document sent with the aid of the web server and saved by means of the Web Browser at the client's device.

Q25. What is the code behind and Inline Code?Code Behind

Ans: Code Behind refers to the code for an ASP.NET Web page this is written in a separate elegance document that can have the extension of .Aspx.Cs or .Aspx.Vb depending on the language used. Here the code is compiled right into a separate magnificence from which the .Aspx document derives. You can write the code in a separate .Cs or .Vb code record for every .Aspx web page. One main point of Code Behind is that the code for all the Web pages is compiled into a DLL report that permits the internet pages to be hosted free from any Inline Server Code.

Inline Code

Inline Code refers back to the code that is written internal an ASP.NET Web Page that has an extension of .Aspx. It lets in the code to be written in conjunction with the HTML source code the usage of a <Script> tag. It's foremost factor is that due to the fact it's physically inside the .Aspx record it is deployed with the Web Form page on every occasion the Web Page is deployed.

Q26. What is the ASP.NET page life Cycle?

Ans: When a web page is requested with the aid of the person from the browser, the request goes through a sequence of steps and lots of things manifest within the heritage to supply the output or ship the response again to the patron. The durations between the request and reaction of a web page is referred to as the "Page Life Cycle".

Request: Start of the life cycle (sent by using the person).

Response: End of the life cycle (sent by the server).

There are four ranges that arise for the duration of the Page Life Cycle before the HTML Response is lower back to the customer. Later in this article we"ll have a look at these kind of levels and their sub activities.

Initialization :During this level the IsPostback property is set. The web page determines whether the request is a Postback (antique request) or if that is the primary time the page is being processed (new request). Controls on the page are available and every manipulate's UniqueID property is ready. Now if the present day request is a postback then the statistics has no longer been loaded and the value of the controls have not but been restored from the view state.

Loading :At this stage if the request is a Postback then it loads the data from the view country.

Rendering : Before rendering, the View State is stored for the page and its controls. During this section, the web page calls the render approach for each manipulate, providing a textual content creator that writes its output to the OutputStream of the page's Response belongings.

Unloading :Unload is called after the web page has been fully rendered, despatched to the customer and is prepared to be discarded. At this point additionally the web page homes along with Response and Request are unloaded.

Q27. What is the Difference between session and caching?

Ans: The first foremost distinction between consultation and caching is: a consultation is in step with-user based however caching isn't always according to-user based totally, So what does that imply? Session facts is stored on the consumer degree however caching statistics is saved at the utility stage and shared by way of all of the customers. It method that it's miles absolutely consultation statistics a good way to be unique for the various users for all of the various users, session reminiscence might be allotted in a different way on the server but for the caching best one memory could be allocated at the server and if one user modifies the statistics of the cache for all, the consumer facts will be modified.

Q28. Explain Web Services in ASP.NET?

Ans: A Web Service is a software software that makes use of XML to trade records with different software via common net protocols. In a easy feel, Web Services are a manner for interacting with objects over the Internet.

A internet service is:

Language Independent.

Protocol Independent.

Platform Independent.

It assumes a stateless provider structure.

Scalable (e.G. Multiplying  numbers collectively to a whole purchaser-courting management gadget).

Programmable (encapsulates a assignment).

Based on XML (open, text-primarily based standard).

Self-describing (metadata for get entry to and use).

Discoverable (seek and find in registries)- ability of applications and developers to search for and locate favored Web offerings through registries. This is primarily based on UDDI.

Q29. Explain  the ideas of Globalization and Localization in .NET?

Ans: Localization method "manner of translating sources for a specific lifestyle", and Globalization approach "technique of designing packages that could adapt to one-of-a-kind cultures".

Proper Globalization: Your utility have to be capable of Accept, Verify, and Display all international kind of statistics. It ought to properly also be able to operate over this facts, for this reason. We will discuss more about this "Accordingly operations over diff. Lifestyle statistics".

Localizability and Localization: Localizability stands for without a doubt setting apart the components of subculture based totally operations concerning the person interface, and different operations from the executable code.

.NET framework has significantly simplified the mission of creating the applications focused on the clients of multiple cultures. The namespaces worried in introduction of globalize, localizing packages are:

System.Globalization

System.Resources

System.Text

Q30. What is tracing in .NET?

Ans: Tracing facilitates to peer the information of issues on the runtime of the software. By default Tracing is disabled.

Tracing has the subsequent essential functions:
 

We can see the execution route of the web page and application using the debug declaration.

We can access and manipulate hint messages programmatically.

We can see the most latest tracing of the records.

Tracing can be carried out with the following 2 kinds.

Page Level: When the hint output is displayed at the web page and for the web page-degree tracing we want to set the belongings of tracing at the web page degree.<%@ Page Trace="true" Language="C#"

Application: Level: In Application-Level tracing the information is stored for every request of the application. The default quantity of requests to shop is 10. But if you want to boom the range of requests and discard the older request and show a current request you then want to set the assets in the net.Config file.<trace enabled="true"/>




CFG