Interview question for Asp.Net in .NET


1. What is ASP.NET?

ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server. ASP.NET provides increased performance by running compiled code.

2. What are the advantages of ASP.Net?

ASP.NET makes development simpler and easier to maintain with an event-driven, server-side programming model. ASP.NET offers built-in security features through windows authentication or other authentication methods. Content and program logic are separated which reduces the inconveniences of program maintenance. Built-in caching features.

3. What is the main difference between Asp.net and Vb.net?

Asp.net is a web technology used for designing webforms and Vb.net is a programming language ASP.NET is a powerful technology for writing dynamic web pages. ASP.NET is a way of creating dynamic web pages while making use of the innovations present in .NET. VB.NET is a language.But ASP.NET is the Environment where we can create websites or webpages.

4. What methods are fired during the page load?

Init() - when the page is instantiated. Load() - when the page is loaded into server memory. PreRender() - the brief moment before the page is displayed to the user as HTML. Unload() - when page finishes loading.

5. What namespace does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page

6. Which are the namespaces that are imported automatically by Visual Studio in ASP.Net?

There are 7 namespaces which are imported automatically. System System.Collections System.IO System.web System.web.UI System.web.UI.HTMLControls System.web.UI.WebControls.

7. what are the types of ASP Objects?

There are various types of Asp objects Session Object Application Object Server Object Request Object Request Object Response Object Object Context Error Object

8. What are different types of directives in .NET?

@Page @Control @Import @Implements @Register @Assembly @OutputCache @Reference

9. What is the use of @ Register directives?

@Register directive informs the compiler of any custom server control added to the page.

10. What is the difference between ASP Session and ASP.NET Session?

Asp.net session supports cookie less session & it can span across multiple servers.

11. What is the difference between ASP Session State and ASP.Net Session State?

ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm.

12. What is the difference between Server.Transfer and response.Redirect?

The Server.Transfer () method stops the current page from executing, and runs the content on the specified page, when the execution is complete the control is passed back to the calling page. While the Response.Redirect () method transfers the control on the specified page and the control is never passed back to calling page after execution.

13. What is a PostBack?

The process in which a Web page sends data back to the same page on the server.

14. How do you identify that the page is post back?

By checking the IsPostBack property. If IsPostBack is True, the page has been posted back.

15. What’s a bubbled event?

When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents.

16. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?

All the global declarations or the variables used commonly across the application can be deployed under Application_Start. All the user specific tasks or declarations can be dealt in the Session_Start subroutine.

17. How to Manage State in ASP.Net?

There are several ways to manage a state. ViewState QueryString Cookies Session Application

18. What is a SESSION and APPLICATION object?

Session object store information between HTTP requests for a particular user. Session variables are used to store user specific information where as in application variables we can’t store user specific information. while application object are global across users.

19. What are the different types of Caching?

There are three types of Caching : Output Caching: stores the responses from an asp.net page. Fragment Caching: Only caches/stores the portion of page (User Control) Data Caching: is Programmatic way to Cache objects for performance.

20. What’s the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?

Visual Studio uses the Codebehind attribute to distinguish the page source or programming logic from the design. Also the src attribute will make the page compile on every request. That is the page will not be compiled in advance and stored in the bin as a dll instead it will be compiled at run time.

21. How do you hide the columns?

One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s “Visible” property.

22. What is cookies?

Cookies are small pieces of text, stored on the client’s computer to be used only by the website setting the cookies. This allows webapplications to save information for the user, and then re-use it on each page if needed

23. How to Create a Cookie?

Cookie are one of several ways to store data about web site visitors during the time when web server and browser are not connected. Common use of cookies is to remember users between visits. Practically, cookie is a small text file sent by web server and saved by web browser on client machine. The“Response.Cookies” command is used to create cookies.

24. How do you turn off cookies for one page in your site?

Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user's hard disk when a session ends. We may not use them at the max, However to allow the cookies or not, is client side functionality.

25. How do you create a permanent cookie?

Permanent cookies are available until a specified expiration date, and are stored on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which never expires set its Expires property equal to DateTime.maxValue.

26. What is cookie less session? How it works?

By default, ASP.NET will store the session state in the same process that processes the request, just as ASP does. If cookies are not available, a session can be tracked by adding a session identifier to the URL.

27. Which method do you use to redirect the user to another page without performing a round trip to the client?

Server.Transfer Server.Execute.

28. What tag do you use to add a hyperlink column to the DataGrid?

< asp:HyperLinkColumn > < / asp:HyperLinkColumn >

29. What is web.config file?

Web.config file is the configuration file for the Asp.net web application. There is one web.config file for one asp.net application which configures the particular application. Web.config file is written in XML with specific tags having specific meanings.It includes databa which includes connections,Session States,Error Handling,Security etc.

30. What is the difference between in-proc and out-of-proc?

An Inproc is one which runs in the same process area as that of the client giving tha advantage of speed but the disadvantage of stability becoz if it crashes it takes the client application also with it. Outproc is one which works outside the clients memory thus giving stability to the client, but we have to compromise a bit on speed.

31. What is smart navigation?

The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

32. What is the difference between HTTP-Post and HTTP-Get?

The GET method creates a query string and appends it to the script's URL on the server that handles the request. The POST method creates a name/value pairs that are passed in the body of the HTTP request message.

33. What are the different types of Session state management options available with ASP.NET?

ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

34. What’s the difference between Response.Write () and Response.Output.Write()?

Response.Outout.Write allows us to write the formatted out put.

35. What’s the use of “GLOBAL.ASAX” file?

It allows to executing ASP.NET application level events and setting application-level variables.

36. What is the difference between “Web.config” and “Machine.Config”?

“Web.config” files apply settings to each web application. While “Machine.config” file apply settings to all ASP.NET applications.

37. what is use of web.config?

Web.config is used connect database from front end to back end. Web.config is used to maintain the Appsettimgs instead of static variables.

38. What are Master Pages in ASP.NET?

ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the pages in your application. You can then create individual content pages that contain the content you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page.

39. What is WSDL?

WSDL stands for Web Services Description Language is an XML-based language for describing Web services and how to access them. WSDL is used to describe Web services.

40. How do you identify a Master Page?

The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .aspx pages.

41. Explain what a diffgram is and a good use for one?

The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.