Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests. When an ASP.NET request is
received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the
request to the actual worker process aspnet_wp.exe.
4. Where does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page
8. Suppose you want a certain ASP.NET function executed on MouseOver over a certain button.
Where do you add an event handler?
It’s the Attributesproperty, the Add function inside that property. So
btnSubmit.Attributes.Add("onMouseOver","someClientCode();")
12. Should validation (did the user enter a real date) occur server-side or client-side? Why?
Client-side. This reduces an additional request to the server to validate the users input.
13. What does the "EnableViewState" property do? Why would I want it on or off?
It enables the viewstate on the page. It allows the page to save the users input on a form.
14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one
over the other?
Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to
another page or site.
15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
A DataSet is designed to work without any continuing connection to the original data source.
Data in a DataSet is bulk-loaded, rather than being loaded on demand.
There's no concept of cursor types in a DataSet.
DataSets have no current record pointer You can use For Each loops to move through the data.
You can store many edits in a DataSet, and write them to the original data source in a single operation.
Though the DataSet is universal, other objects in ADO.NET come in different versions for different data
sources.
16. Can you give an example of what might be best suited to place in the Application_Start and
Session_Start subroutines?
This is where you can set the specific variables for the Application and Session objects.
17. If I’m developing an application that must accommodate multiple security levels though secure
login and my ASP.NET web application is spanned across three web-servers (using round-robin load
balancing) what would be the best approach to maintain login-in state for the users?
Maintain the login state security through a database.
18. Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class.
Base Class Employee.
A Manager class could be derived from the Employee base class.
21. 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.
22. Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.
23. Which method do you invoke on the DataAdapter control to load your generated dataset with
data?
The .Fill() method
25. Which template must you provide, in order to display data in a Repeater control?
ItemTemplate
26. How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate
27. 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 DataSource property and call the DataBind method.
30. 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
31. What tag do you use to add a hyperlink column to the DataGrid?
32. What is the transport protocol you use to call a Web service?
SOAP is the preferred protocol.
35. Where on the Internet would you look for Web services?
http://www.uddi.org
36. 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?
DataTextField property
37. Which control would you use if you needed to make sure the values in two different controls
matched?
CompareValidator Control
38. To test a Web service you must create a windows application or Web application to consume this
service?
False, the webservice comes with a test page and it provides HTTP-GET method to test.
40. Briefly explain how code behind works and contrast that using the inline style.
Many of the web developers that are currently moving to ASP.NET were previously ASP developers, which
made them used to developing their script code inline with the HTML.
This coding style of using inline code is still available within the ASP.NET framework, but a new coding style
designed for large team development has also been introduced with ASP.NET this has been dubbed code-
behind.
This coding style places all the code that is to be executed by the server into separate files for each .aspx
page. This allows web designers who specialize in the HTML development of a site, and application
developers who specialize in the programming logic of the site to work together in a way that the page
designer does not disturb the code in the page. This also allows a company who is interested in protecting
it’s investment or who are developing web applications for resale to distribute just the .aspx files and the
compiled code-behind files as a .dll file for the site.
41. What are HTML controls, Web controls, and server controls?
HTML controls- represent common HTML elements and are available through the HTML tab of the Visual
Studio .NET toolbox. You can drag these controls to a Web form and set their properties in the Properties
window. An HTML control, such as Text Field or Label, is converted to its appropriate HTML equivalent, such
as the <INPUT> and <DIV> element, respectively, in the source code of the ASPX file. All the HTML controls
are automatically placed inside an HTML <FORM> element.
HTML server controls are similar to HTML controls with the added feature of server-side availability. You can
convert any HTML control to run as an HTML server control by adding a runat="server" attribute to its
declaration. You can accomplish the same task visually by right-clicking an HTML control and selecting Run
As Server Control from the shortcut menu.
Web server controls provide a higher level of abstraction than HTML server controls because their object
model matches closely with the .NET Framework rather than matching with the requirements of HTML
syntax.
Web server controls provide a rich object model that closely matches with the rest of the .NET Framework.
Some Web server controls provide richer functionality, such as the Calendar control, AdRotator control, and
so on, not available with HTML controls.
Web server controls have advanced features such as automatic browser detection, automatic postback, and
event bubbling.
Web server controls are declared in code explicitly by prefixing the class name of the Web server control
with the namespace asp and separating both with a colon (:), as well as including the runat="server"
attribute in its definition. For example, a Label Web server control can be declared in code as <asp:Label
runat="server"/>.
Most Web server controls derive their functionality from the WebControl class of the
System.Web.UI.WebControls namespace.
42. Briefly explain how the server control validation controls work.
User Input Validation
ASP.NET provides a set of Web server controls called validation controls that provide sophisticated
validation on both the client side and the server side depending on the validation settings and the browser's
capabilities.
ASP.NET ensures that validations are performed on the server side even if they were already performed on
the client side. This ensures that validations are not bypassed if a malicious user circumvents client-side
validation. If the client-side validation fails, the server-side validation is never performed.
43. Briefly explain what user controls are and what server controls are and the differences between
the two.
A user control could simply be an extension of the functionality of an existing server control(s) (such as an
image control that can be rotated or a calendar control that stores the date in a text box). Or, it could consist
of several elements that work and interact together to get a job done (such as several controls grouped
together that gather information about a user's previous work experience).
An ASP.NET control (sometimes called a server control) is a server-side component that is shipped with
.NET Framework. A server control is a compiled DLL file and cannot be edited. It can, however, be
manipulated through its public properties at design-time or runtime. It is possible to build a custom server
control (sometimes called a custom control or composite control).
In contrast, a user control will consist of previously built server controls (called constituent controls when
used within a user control). It has an interface that can be completely edited and changed. It can be
manipulated at design-time and runtime via properties that you are responsible for creating. While there will
be a multitude of controls for every possible function built by third-party vendors for ASP.NET, they will exist
in the form of compiled server controls, as mentioned above. Custom server controls may be the .NET
answer to ActiveX Web controls.
44. Briefly explain how server form post-back works (perhaps ask about view state as well).
One of the most important features of the ASP.NET environment is the ability to declare controls that run on
the server, and post back to the same page. Remember the days of classic ASP? We would create a form
which would accept the user's input, and then we would most probably have to create another page that
would accept all those inputs, either through HTTP GET or POST, and perform some kind of validation,
display and action. Sometimes, even a third page was necessary to perform our actions. This wasted a lot of
time and complicated things when you had to make a change. But of course, this is not necessary any more
with ASP.NET. There is no need to create second pages that accept the inputs of the first, process them and
so on. Form fields and other controls can be declared to run on the server, and the server simply posts the
page back to itself and performs all the validation, display and actions. Our life as web developers has
become a million times better. But how exactly is this done?
When a control is declared to run on the server, a VIEWSTATE is created which remembers the ID of that
control, and the method to call when an action is performed.submit event calls the javascript function
__doPostBack (that's 2 underscore symbols in front of it). You do not write this function, instead it is
generated by the ASP.NET engine and automatically included in our page. It submits the form to the same
page, and accepts 2 arguments:
At least one control needs to be set to Visible, for the server to generate the __doPostBack function in our
page. Even if we have numerous web controls declared to run on the server, but they are all set to
Visible=false, then the javascript function will not be included and we will not be able to perform any actions.
45. Can the action attribute of a server-side <form> tag be set to a value and if not how can you
possibly pass data from a form page to a subsequent page. (Extra credit: Have you heard of comdna.
:-)
.NET pages are set to postback to themselves by default and this cannot be changed. You must process
your form data in the same page if you want to use .NET controls. It's the way it works.
If you truly want to move to another page when you submit your form you can. However; you must process
the form data from the page you are on first. Then redirect to the next page using Response.Redirect or
Server.Transfer. If you care to pass the form values to the next page then you must do it in the query string.
Read more -http://www.tconsult.com/aspnet/action.aspx
47. How would ASP and ASP.NET apps run at the same time on the same server?
http://www.iprisma.com/aspbridge/faq.htm has some FAQs on how to work(migrate) with (from) asp and(to)
asp.net
48. What are good ADO.NET object(s) to replace the ADO Recordset object.
ADO.net Datasets replace the ADO recordset objects. I did not find any good article on any good objects in
ado.net. but reading the links below should provide the information to answer the question.
Read more - http://www.eggheadcafe.com/articles/20010920.asp
http://builder.com.com/5100-6388-5047655.html
good discussion about ado vs ado.net -
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=5029
Note : - Virtual method has an implementation & provide the derived class with the option of overriding it.
Abstract method does not provide an implementation & forces the derived class to override the method.
57. What is the difference between abstract class and an interface? What is shadowing ?
Differentiate between Overriding and Overloading.
Answer - Interfaces, like classes, define a set of properties, methods, and events. But unlike classes,
interfaces do not provide implementation. An interface represents a contract, and a class that implements an
interface must implement every aspect of that interface exactly as it is defined.
It is important to note here that an interface is very different from a base class. An interface is implemented,
not extended.
1. A class can implement multiple interfaces.
2. An interface cannot contain data declarations but you can declare properties.
3. All method declarations in an interface are public.
4. There can be no implementation in an interface.
5. The class implementing the interface must provide implementation code.
6. An interface can be derived from another interface
An abstract class is a class that cannot be instantiated, but must be inherited from. An abstract class may be
fully implemented, but is more usually partially implemented or not implemented at all, thereby encapsulating
common functionality for inherited classes.
When you have a class that contains methods that have no implementation (i.e. abstract methods), the class
is said to be abstract as well. An abstract method is simply a shell or place-marker for a method that will be
defined later in a derived class. The intention of abstract methods is to force every derivation of the class to
implement those methods. If a derived class does not implement an abstract method, then that class must
also be declared as abstract.
Shadowing is used when 2 programmers come up with same method in the same class one of the methods
gets shadowed by scope or inheritance.
58. How do you declare a static variable and what is its lifetime?
Answer -
59. How do you get a record no from 5 to 15 from a dataset of 100 records?
Answer -
.... Every application was self-contained. A program would consist of a single executable (EXE) file. Complex
applications might consist of several executables that were chained to each other. One thing, however, was
certain - the executables that accompanied a particular application could be used only by that application.
For most programs, you could distribute all of the files used by that program without being concerned that
other products might interfere with yours.
In the past few years the size of application files has grown dramatically. The Windows operating
environment took advantage of a capability called dynamic linking to allow code modules to be shared by
applications. The most important demonstration of the use of this capability is Windows itself - the code
modules that contain the functions that make Windows work (the Windows API), are shared by all Windows
applications. A code module that can be shared in this way is called a dynamic link library and normally has
the extension .DLL.
MajorVersion.MinorVersion.BuildNumber.Revision.
The parts of the version number are major, minor, build and revision. There are no semantics applied to the
parts of the version number. That is, the common language runtime does not infer compatibility or any other
characteristic of an assembly based on how the version number is assigned (version 1.0.0.0 of some
assembly and version 2.1.0.2 are completely different identities as far as the class loader is concerned). As
a developer you are free to change any portion of this number as you see fit. Even though there are no
semantics applied to the format of the version number, individual organizations will likely find it useful to
establish conventions around how the version number is changed. This helps maintain consistency
throughout an organization and makes it easier to determine things like which build a particular assembly
came from. One typical convention is as follows:
Major or minor. Changes to the major or minor portion of the version number indicate an incompatible
change. Under this convention then, version 2.0.0.0 would be considered incompatible with version 1.0.0.0.
Examples of an incompatible change would be a change to the types of some method parameters or the
removal of a type or method altogether.
Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases.
Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a
particular bug. You'll sometimes hear this referred to as the "emergency bug fix" number in that the revision
is what is often changed when a fix to a specific bug is shipped to a customer.
65. What are the ASP.NET list controls and differentiate between them?
Answer - In real-world web applications most of the time data is retrieved from the database source and
displayed in tabular or list format. In theory we got to be spending most of our time solving application logic
but in practice we spend most of the time in managing the state of the data between web pages and
displaying the data. It looks like Microsoft has been listening to these problems ;asp.net provides new set of
list controls like Repeater, DataList and DataGrid which will help the developers save lot of time in this area.
All these controls are built with a specific purpose in mind. It’s good to know the purpose of the controls so
as to reap the maximum benefit from these controls.
These controls have the data binding property where you can retrieve data from the database and bind to
the control and define how you want the data to look like and the rest of the work is done with great ease.
Let us start looking closely and find what each one of these controls has to offer.
Repeater control is one of the simplest among the controls. It basically iterates through the bound-data and
displays it in a single list. All we got to do is just bind the data to the Repeater control and tell the control how
we want the data to look like using controls Template. This is useful for;example to display list of employees,
products, articles where there is no sorting, editing and paging of data is needed.
DataList is one step a head of the repeater control, it can do all that repeater can do and has additional
flexibility to control the layout of the list. For example this has features where you can mention the direction
of the list like horizontal,vertical and also select, edit, update and cancel items by using there respective
events. This control is very useful when you want to display list of products and also have some additional
features like adding then to shopping cart or any other editable capability.
DataGrid control is the most powerful and fascinating among the three controls.It displays data in a tabular
from . By default, the DataGrid displays data in read-only mode, but the DataGrid is also capable of
automatically displaying the data in editable controls at run-time. The DataGrid control can also create the
Select, Edit, Update, and Cancel buttons. Additionally paging, sorting are inbuilt feature. This control can be
used whenever we require displaying data in a grid format and requires a whole range of functionality like
sorting and paging.
more info - http://www.code101.com/Code101/DisplayArticle.aspx?cid=1
66. What is the difference between ASP State Management and ASP.NET State Management?
68. Diff between Web User Control and Web Custom Control.
Answer - If none of the existing ASP.NET server controls meet the specific requirements of your applications,
you can create either a Web user control or a Web custom control that encapsulates the functionality you
need. The main difference between the two controls lies in ease of creation vs. ease of use at design time.
Web user controls are easy to make, but they can be less convenient to use in advanced scenarios. You
develop Web user controls almost exactly the same way that you develop Web Forms pages. Like Web
Forms, user controls can be created in the visual designer, they can be written with code separated from the
HTML, and they can handle execution events. However, because Web user controls are compiled
dynamically at run time they cannot be added to the Toolbox, and they are represented by a simple
placeholder glyph when added to a page. This makes Web user controls harder to use if you are
accustomed to full Visual Studio .NET design-time support, including the Properties window and Design view
previews. Also, the only way to share the user control between applications is to put a separate copy in each
application, which takes more maintenance if you make changes to the control.
Web custom controls are compiled code, which makes them easier to use but more difficult to create; Web
custom controls must be authored in code. Once you have created the control, however, you can add it to
the Toolbox and display it in a visual designer with full Properties window support and all the other design-
time features of ASP.NET server controls. In addition, you can install a single copy of the Web custom
control in the global assembly cache and share it between applications, which makes maintenance easier.
using System;
namespace ExampleToDo {
public class ToDo {
private string[] my_tasks;
public ToDo() {
my_tasks = new string[10];
}
public string this[int index]
{
get
{
return my_task[index];
}
set
{
return my_task[index] = value;
}
}
}
}
ToDo is a simple class that basically wraps an array of type string. However, notice, the Indexed Property (or
indexer) defines access to the array. Thus, you’re providing array-like access to “this” object, the class ToDo.
The indexer returns a string and is implemented to index on values of type int. The beauty of indexers is that
we could have defined the type we are indexing on to be something else, a string or perhaps a class we
have written.
will be glad if any one can explain indexer property. I dont think I understood this clearly.
70. I have 2 buttons on an asp.net page(.aspx). I want to execute same routine clicking on 2 buttons.
How do I do it?