Beruflich Dokumente
Kultur Dokumente
NET
FUNDAMENTALS
ASP.NET is tool for creating web application and web services.
ASP.NET is server side scripting technology.
ASP.NET is a part of microsoft .net framework.
.NET Framework includes an execution engine called common language runtime, CLR
and class library.
Like Asp, ASP.NET also runs inside IIS. It is tightly integrated with the microsoft server,
programming, data access, and security tools.
When browser requests an ASP.NET file, IIS passes the request to ASP.NET engine
which after having executed the script sends file back to browser as a simple HTML
page.
ASP.NET is not backward compatible with classic ASP.
Unlike interpreted classic ASP, ASP.NET is compiled CLR code.
Being part of CLR, it has advantages of early binding, JIT compilation, caching services,
garbage collection etc.
ASP.NET uses ADO.NET for data access and is well integrated with VB.NET, C#.Net,
Jscript etc.
ASP.NET provides two sets of controls - HTML and server control.
ASP.NET employs a text-based configuration settings and thus, server does't get
restarted in case of change in setting.
ASP.NET executes new code on request and thus, server restarts only when new code
executes.
ASP.NET is part of the .NET framework and is made up of several components like
Visual Studio .NET Web development tools, System.Web namespaces, Server and
HTML controls.
System.Web namespaces is the part of the .NET Framework that include classes.
Server and HTML controls are the two sets of user-interface components of ASP.NET
Advantages of ASP.NET
Executable of ASP.NET application is compiled that runs faster than interpreted scripts
Automatic state management for controls
Access to the .NET Framework
Introduction of VB.NET that is evolution version of VB
Fully supports object-oriented programming,
Can create new and customized server controls from existing controls
Built-in security through the windows server or other authentication/authorization
methods
Integration with ADO.NET
Full support for XML and CSS
Built-in features for caching frequently requested web pages on the server.
Navigation sequence of ASP.NET web form
IIS starts the ASP.NET worker process that in turn, loads the assembly,
The assembly composes a response to the user and
IIS returns the response to the user in the form of HTML.
ASP.NET web form components
Server controls define the user interface of a Web form and built-in features for saving
data.
HTML controls are visual element provided by HTML. They are useful when complete
features of server controls are not needed.
Data controls connect to SQL and OLE databases and XML data files.
Examples of such controls are SqlConnection, SqlCommand, OleDbConnection,
OleDbCommand, DataSet.
System components provide access to various system-level events that occur on the
server. Ex. EventLog, MessageQueue.
.NET Framework includes an execution engine called CLR and class library.
Shared (VB.NET) or static members (C#) - These are class methods that can be used
directly without first creating an object from the class. These members can be called
from the class name. Example of such member is Math class.
Virtual folder: Web applications can exist only in a location that has been published by
IIS as a virtual folder. It is shared resource identified by an alias that represents a
physical location on a server. The virtual folder named //localhost is the web root folder
on your computer. IIS determines the physical location of your Web root folder. By
default, IIS installs the folder on your root drive at \Inetpub\wwwroot.
View state: ASP.NET preserves data between requests using view state. View state is
available only within the web page.
State variable: It allows data entered on a web page available on other web pages in
an application.
Application state variables: The value of these variables are available to all users of an
application.
Session state variables: The value of these variables are available only to a single
session (user).
Application event handlers in ASP.NET
Application_Start: occurs when first user visits a page.
Application_End: occurs when last user exit from the site.
Application_BeginRequest: occurs at the beginning of each request to the server.
Application_EndRequest: occurs at the end of each request to the server.
Session_Start: occurs when a new user visits a page within your application.
Session_End: occurs when a user stops requesting pages from the web application.
ASP.NET web form events
Page_Init: server controls are loaded and initialized.
Page_Load: server controls are loaded in the page object.
Page_PreRender: application is about to render the Page object.
Page_Unload: page is unloaded from memory.
Page_Disposed: page object is released from memory.
ASP.NET transaction events are
Page_AbortTransaction: occurs when transaction is aborted.
Page_CommitTransaction: occurs when transaction is accepted.
Page_DataBinding: occurs when server control on the page binds to a data source.
Server control events in ASP.NET
Postback events cause the web page to be sent back to the server for immediate
processing. These events have performance issue because they trigger a round-trip to
the server.
Cached events save controls in the pages view state to be processed when a postback
event occurs.
Validation events occur before the page is post back to the server. .
Application domain: The process space where ASP.NET worker process loads the
Web applications assembly.
Namespaces organizes code and provide protection from conflicting names
(namespace collisions)
Access modifier for classes and modules
Public (VB.NET) or public (C#) can be accessed by all members in all classes and
projects.
Friend (VB.NET) or internal(C#) can be accessed by all members in the current project
Protected (VB.NET) or protected(C#) can be accessed in the current class and in
classes derived from this members class
Protected Friend (VB.NET) or protected internal(C#) can be accessed by all members in
the current project and all members in classes derived from this members class
Private (VB.NET) or private(C#) can be accessed by members of the current class only
Inheritance: With this facility, base class provides methods, properties, and other
members to a derived class.
Abstract classes defines an interface for derived classes. Abstract classes are
declared with the MustInherit (in VB.NET) or abstract (in C#) keyword. Methods and
properties of these classes are declared as MustOverride (in VB.NET) or as abstract in
C#.
Delegates are strong types function pointer used to invoke one or more methods where
the actual method invoked is determined at run time.
Interfaces are similar to abstract classes except interfaces dont provide any
implementation of class members.
Global.asax: The Global object is defined in Global.asax that starts automatically when
an application starts. A developer can use events in global object to initialize applicationlevel state variables.
Maintaining state information: Context.Handler, Query strings, Cookies, View state,
Session state, Application state.
Being part of VS.net suite, C#.NET can access a common .NET library and
supports all CLS features.
.Net Framework is divided into CLS (Common language Runtime) and base
class library.
Base class library has many pre-developed classes that can be used by the
developer.
Assembly contains manifest which describes the assembly and its modules.
Value type contains data of the type whereas reference type contains pointer
to an instance of an object of that type.
Value type is created at the time of declaration whereas reference type must
be instantiated after declaration to create object.
Method can have parameters that are passed by value by default. We can
pass parameters by reference with the ref keyword in C#.NET and byref
in VB.NET.
The constructor is like any method of the class, but gets created before the
object is available for use. This is the first method to get called on the
instantiation of the class.
The destructor is called just before an object is destroyed. It is used for code
clean-up when object is no longer in use. Developer has no control when a
destructor is called, since it gets called by CLR.
Form is the basic unit of user interface. We can add form in the application at
design time or run time. We can create one general parent form and can
inherit forms from parent form using visual inheritance. While using visual
inheritance, we ensures uniform look to all the forms of the application.
Forms have various properties that control their appearance, namely text,
font, cursor, background Image, Opacity, backcolor and forecolor.
Forms intrinsic methods cause changes in the visual interface and various
events get raised like load, activated/deactivate, visiblechanged, closing,
closed.
We can also create our own event handler which will get called when
associated event is raised.
Each control on the form can have order of navigation which can be set using
tabindex property of the control.
A control can contain other controls. For example panel, groupbox and
tabpage.
We can resize and change position of the form and controls on it, manually.
We can make use of docking and anchor properties for automatic resizing
and positioning of the controls as we change size or position of the form.
Dock property ensures the controls to an edge of the form on change in size
or repositioning of the form.
Menu is the best navigation way in the application. We can create MainMenu
control that allows rapid creating of menu for the application. Developer can
apply separator bars, access keys and shortcut keys.
Developer can create this kind of menu same as MainMenu but at run-time.
We can control the menu dynamically at run-time. We can enable and disable
the menu items, make menu items invisible etc. We can change the structure
of menu dynamically at run-time by creating new menu with the CloneMenu
method.
We can validate all fields of the form at one shot using form-level validation.
The ErrorProvoider component of the control can be used at run time for
displaying informative error message to the user.
Windows authentication.
Latest answer: If windows authentication mode is selected for an ASP.NET application, then authentication also
needs to be configured within IIS since it is provided by IIS............
Read answer
Passport authentication
Latest answer: Passport authentication provides authentication using Microsofts passport service.
If passport authentication is configured and users login using passport then the authentication duties are off-loaded to
the passport servers.............
Read answer
Forms authentication
Latest answer: Using form authentication, ones own custom logic can be used for authentication. ASP.NET checks
for the presence of a special session cookie when a user requests a page for the application. ............
Read answer
Latest answer: GridLayout provides absolute positioning for controls placed on the page. FlowLayout positions items
down the page like traditional HTML.........
Read answer
Read answer