ASP.NET Interview Questions with Answers For Experienced
Question: 1. What is ASP.NET?
Answer: 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.
Question: 2. What is XHTML? Are ASP.NET Pages compliant with XHTML?
Answer: 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.
Question: 3. Does ViewState have an effect on overall performance? What is the right size of a ViewState? How can you compress a viewstate?
Answer: 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
Question: 4. How can you hit upon if a viewstate has been tampered?
Answer: By setting the EnableViewStateMac to true in the @Page directive. This attribute tests the encoded and encrypted viewstate for tampering.
Question: 5. Can the App_Code folder include supply code documents in exceptional programming languages?
Answer: 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.
Question: 6. Can I set up the software with out deploying the supply code at the server?
Answer: 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.
Question: 7. Can I use exceptional programming languages within the same utility?
Answer: 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.
Question: 8. How to secure your connection string records?
Answer: By using the Protected Configuration feature.
Question: 9. What is Cross Page Posting? How is it accomplished?
Answer: 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.
Question: 10. Can you convert a Master Page dynamically at runtime? How?
Answer: Yes. To change a master page, set the MasterPageFile assets to point to the .Master page at some point of the PreInit page occasion.
Question: 11. How to at ease your configuration files to be accessed remotely by way of unauthorized users?
Answer: ASP.NET configures IIS to disclaim access to any user that requests get admission to to the Machine.Config or Web.Config files.
Question: 12. How to configure ASP.NET applications which can be jogging on a far off system?
Answer: You can use the Web Site Administration Tool to configure faraway web sites.
Question: 13. How many net.Config documents can I have in an application?
Answer: 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.
Question: 14. What is the difference between Response.Write and Response.Output.Write?
Answer: 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
Question: 15. How do you apply Themes to a whole utility?
Answer: By specifying the topic inside the web.Config report.
< configuration >
< system.Web >
< pages theme=”BlueMoon” />
system.Web >
configuration >
Question: 16. How do you exclude an ASP.NET web page from using Themes?
Answer: To take away topics out of your web page, use the EnableTheming attribute of the Page directive.
Question: 17. 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?
Answer: The ASP.NET Wizard Control.
Question: 18. Webservices aid statistics reader?
Answer: No. However it does guide a dataset.
Question: 19. Can you programmatically get admission to IIS configuration settings?
Answer: Yes. You can use ADSI, WMI, or COM interfaces to configure IIS programmatically.
Question: 20. What is caching in ASP.NET?
Answer: 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
Question: 21. What are the fundamental occasions in global.Aspx?
Answer: 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
Question: 22. What is use of the AutoEventWireup characteristic inside the Page directive ?
Answer: 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.
Question: 23. What takes place when you exchange the net.Config file at run time?
Answer: ASP.NET invalidates the present cache and assembles a brand new cache. Then ASP.NET automatically restarts the utility to use the changes.
Question: 24. What are Cookies in ASP.NET?
Answer: 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.
Question: 25. What is the code behind and Inline Code?Code Behind
Answer: 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
