ASP.NET interview questions, part 1
- Whats an assembly? Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.
- Describe the difference between inline and code behind - which is best in a loosely coupled solution? ASP.NET supports two modes of page development: Page logic code that is written inside <script runat=server> blocks within an .aspx file and dynamically compiled the first time the page is requested on the server. Page logic code that is written within an external class that is compiled prior to deployment on a server and linked "behind" the .aspx file at run time.
- Explain what a diffgram is, and a good use for one? A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.
- Where would you use an iHTTPModule, and what are the limitations of anyapproach you might take in implementing one? One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
- What are the disadvantages of viewstate/what are the benefits?
- Describe session handling in a webfarm, how does it work and what are the limits?
- How would you get ASP.NET running in Apache web servers - why would you even do this?
- Whats MSIL, and why should my developers need an appreciation of it if at all?
- In what order do the events of an ASPX page execute. As a developer is it important to undertsand these events? Every Page object (which your .aspx page is) has nine events, most of which you will not have to worry about in your day to day dealings with ASP.NET. The three that you will deal with the most are: Page_Init, Page_Load, Page_PreRender.
- Which method do you invoke on the DataAdapter control to load your generated dataset with data?
System.Data.Common.DataAdapter.Fill(System.Data.DataSet);
If my DataAdapter is sqlDataAdapter and my DataSet is dsUsers then it is called this way:
sqlDataAdapter.Fill(dsUsers);
- ata in the Repeater control?
- Which template must you provide, in order to display data in a Repeater control? ItemTemplate
- How can you provide an alternating color scheme in a Repeater control?
AlternatingItemTemplate Like the ItemTemplate element, but rendered for every other
row (alternating items) in the Repeater control. You can specify a different appearance
for the AlternatingItemTemplate element by setting its style properties. - What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?
You must set the DataMember property which Gets or sets the specific table in the DataSource to bind to the control and the DataBind method to bind data from a source to a server control. This method is commonly used after retrieving a data set through a database query. - What base class do all Web Forms inherit from? System.Web.UI.Page
- What method do you use to explicitly kill a user’s session?
The Abandon method destroys all the objects stored in a Session object and releases their resources.
If you do not call the Abandon method explicitly, the server destroys these objects when the session times out.
Syntax: Session.Abandon - How do you turn off cookies for one page in your site?
Use the Cookie.Discard Property which 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. - Which two properties are on every validation control? ControlToValidate & ErrorMessage properties
- What tags do you need to add within the asp:datagrid tags to bind columns manually?
- How do you create a permanent cookie? Setting the Expires property to MinValue means that the Cookie never expires.
- What tag do you use to add a hyperlink column to the DataGrid?
- What is the standard you use to wrap up a call to a Web service?
- Which method do you use to redirect the user to another page without performing a round trip to the client? Server.transfer()
- What is the transport protocol you use to call a Web service? SOAP. Transport Protocols: It is essential for the acceptance of Web Services that they are based on established Internet infrastructure. This in fact imposes the usage of of the HTTP, SMTP and FTP protocols based on the TCP/IP family of transports. Messaging Protocol: The format of messages exchanged between Web Services clients and Web Services should be vendor neutral and should not carry details about the technology used to implement the service. Also, the message format should allow for extensions and different bindings to specific transport protocols. SOAP and ebXML Transport are specifications which fulfill these requirements. We expect that the W3C XML Protocol Working Group defines a successor standard.
- True or False: A Web service can only be written in .NET. False.
- What does WSDL stand for? Web Services Description Language
- What property do you have to set to tell the grid which page to go to when using the Pager object?
- Where on the Internet would you look for Web services? UDDI repositaries like uddi.microsoft.com, IBM UDDI node, UDDI Registries in Google Directory, enthusiast sites like XMethods.net.
- What tags do you need to add within the asp:datagrid tags to bind columns manually? Column tag and an ASP:databound tag.
- Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
- How is a property designated as read-only? In VB.NET:
Public ReadOnly Property PropertyName As ReturnType Get ‘Your Property Implementation goes in here End Get End Property
in C#
public returntype PropertyName { get{ //property implementation goes here } // Do not write the set implementation } - Which control would you use if you needed to make sure the values in two different controls matched? Use the CompareValidator control to compare the values
of 2 different controls. - True or False: To test a Web service you must create a windows application or Web application to consume this service? False.
- How many classes can a single .NET DLL contain? Unlimited.
>

19 Comments on ASP.NET questions, part 2
@Everybody, Isn’t it much easier to print this page than to have the admin send it to you…
Do you know Where the reference assemblies are stored in .NET application?
Hello Admin, [long time]
6. Describe session handling in a webfarm, how does it work and what are the limits?
Set the sessionState mode in the web.config file to “StateServer”.
StateServer mode uses an out-of-process Windows NT Server to store state information.
It solves the session state loss problem in InProc mode.
Allows a webfarm to store session on a central server.
It provides a Single point of failure at the State Server.
Follow these simple steps: in all your web servers.
- In a web farm, make sure you have the same
- Also, make sure your objects are serializable.
- For session state to be maintained across different web servers in the web farm, the Application Path of the website in the IIS Metabase should be identical in all the web servers in the web farm.
5) Disadvantage of viewstate is that additional data is sent to the browser. The benefits are that you do not have to manually manage refreshing the page fields after a submit, (when re-displaying the same page).
I don’t need to preserve session variables between servers, but would like to preserve them between different .Net applications on the same server. Is there a way to do this?
Thanks
This is also one difference between ADO and ADO.Net
Performance
Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.
What tag do you use to add a hyperlink column to the DataGrid?
Click this for answer
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolshyperlinkcolumnclassformatdatanavigateurlvaluetopic.asp
What tags do you need to add within the asp:datagrid tags to bind columns manually?
Set AutoGenerateColumns Property to false on the datagrid tag
by
Milan Mathew
http://www.emilan.tk
What are the disadvantages of view state / what are the benefits?
Automatic view-state management is a feature of server controls that enables them to repopulate their property values on a round trip (without you having to write any code). This feature does impact performance, however, since a server control’s view state is passed to and from the server in a hidden form field. You should be aware of when view state helps you and when it hinders your page’s performance.
What is State Management in .Net and how many ways are there to maintain a state in .Net? What is view state?
Web pages are recreated each time the page is posted to the server. In traditional Web programming, this would ordinarily mean that all information associated with the page and the controls on the page would be lost with each round trip.
To overcome this inherent limitation of traditional Web programming, the ASP.NET page framework includes various options to help you preserve changes  that is, for managing state. The page framework includes a facility called view state that automatically preserves property values of the page and all the controls on it between round trips.
However, you will probably also have application-specific values that you want to preserve. To do so, you can use one of the state management options.
Client-Based State Management Options:
View State
Hidden Form Fields
Cookies
Query Strings
Server-Based State Management Options
Application State
Session State
Database Support
http://www.emilan.tk
What is the major difference between Ado and Ado.net?
Using Dataset Navigation is possible?Explain(First,Next,last,back)
what is asp.net archietechure?
[From part 1]
3. Should validation (did the user enter a real date) occur server-side or client-side? Why?
Client-side validation because there is no need to request a server side date when you could obtain a date from the client machine. so many other reasons, see answer #1
I heavily disagree. Data validation on client-side is always optional. The only time you should be validating data on the client-side is to make the process smoother for the end-user. Any data that you actually plan on using anywhere should be validated on the server-side and should be considered to have the potential to fail. Without this you are opening yourself to people probing your application for error output or attempting injection or overflow errors.
19. What tags do you need to add within the asp:datagrid tags to bind columns manually?
tag and either or tags (with appropriate attributes of course)
21. What tag do you use to add a hyperlink column to the DataGrid?
Depends on who’s definition of hyperlink your using. Manually a std html anchor tag (a) will work or you can use the micro-magical tag
22. What is the standard you use to wrap up a call to a Web service?
Several possible answers depending on your interpretation of the quesiton, but I think you were aiming for SOAP (with the caveat that this is MS’s version of SOAP)
24. What is the transport protocol you use to call a Web service?
SOAP is not the transport protocol. SOAP is the data encapsulation protocol that is used but the transport protocol is fairly unlimited. Generally HTTP is the most common transport protocol used though you could conceivanly use things like SMTP or any others. SOAP is not dependant on any single transport protocol or OS, it is a syntactical and logical definition, not a transport protocol.
- anyway, those were the ones I saw that were unanswered or mostly wrong
Sorry, apparently missed the part that said tags would be removed from posts:
19: Columns tag and either asp:BoundColumn or Asp:TemplateColumn tags (with appropriate attributes of course)
21. Depends on who’s definition of hyperlink your using. Manually a std html anchor tag (a) will work or you can use the micro-magical asp:HyperLink tag
How to abandon the session which is already running.
Let I have a ID, I login once, if some other try to login same time with same ID my first session should be stopped and new session should be start.
reply ASAP
Pawan Kumar
Soft Engr.
ASP.Net, VB.Net
22. SOAP Envelope
What is the difference between boxing and unboxing???
. Describe garbage collection (in simple terms).
Garbage collection eliminates uneeded objects.
1. the new statement allocates memory for an object on the heap.
2. When no objects reference the object it may be removed from the heap (this is a non deterministic process).
3. Finalize is called just before the memory is released.
Q:What is the difference between boxing and unboxing???
A: Boxing allows us to convert value types to reference types. Basically, the runtime creates a temporary reference-type box for the object on heap.
Eg:
int i=20;
object o=i;
what is difference between .dll & .exe?
ACTIVEX DLL:
An in-process component, or ActiveX DLL, runs in another application’s process.In-process components are used by applications or other in-process components. this allows you to wrap up common functionality (like an ActiveX Exe).
ACTIVEX EXE:
An out-of-process component, or ActiveX EXE, runs in its own address space. The client is usually an application running in another process.The code running in an ActiveX Exe is running in a separate process space. You would usually use this in N-Tier programming. An ActiveX EXE runs out of process while an ActiveX DLL runs in the same process space as VB app. Also, and ActiveX EXE can be run independent of your application if desired.