Professional Documents
Culture Documents
c ccc
Forms authentication can be easily implemented using login controls without writing any code.
Login control performs functions like prompting for user credentials, validating them and issuing
authentication just as the FormsAuthentication class.
However, all that·s needs to be done is to drag and drop the use control from the tool box to have
these checks performed implicitly.
The FormsAuthentication class is used in the background for the authentication ticket and ASP.NET
membership is used to validate the user credentials.
½c cc
c
ASP works with VB as the language. ASP.NET works with VB.NET & C# as the
languages (Also supported by other languages that run on the .NET Framework).
ASP.NET is the web technology that comes with the Microsoft .NET Framework. The main process in
ASP.NET is called aspnet_wp.exe that accesses system resources. ASP.NET was launched in 2002 with
version 1.0. Subsequent versions are 1.1 and version 2.0. ASP.NET is built up using thousands of
objects, ordered in the System namespace. When an ASP.NET class is compiled, its called an assembly.
In Classic ASP, complex functionalities are achieved using COM components, that are nothing but
component objects created using VB 6, C++ etc, and are usually in a DLL format. These components
provide an exposed interface to methods in them, to the objects that reference these components.
Last version of classic ASP is version 3.0. ASP has 7 main objects - Application, ASPError,
ObjectContext, Request, Response, Server, Session.
!c ccc
The old "G (ActiveX Data Object) has evolved to ADO.NET in the .NET Framework. The ADO.NET
object is a lightweight object. The ADO
was a huge object in ADO. It provided the ability to
support multiple types of cursors. It provided fast lightweight #
# cursor and also supported a
disconnected client-side cursor that supported tracking, optimistic locking, and automatic batch
updates of a central database. However, all of this functionality was difficult to customize.
"G breaks the functionality of the ADO object to multiple classes, thereby allowing a focused
approach to developing code. The ADO.NET " is equivalent to the "firehose" cursor. The
DataSet is a disconnected cache with tracking and control binding functionality. The " $
provides the ability to completely customize how the central data store is updated with the changes
to a DataSet.
Each user control can have independent cache durations and implementations of how the caching
behavior is to be applied.
Fragment caching is useful when you need to cache only a subset of a page.
Navigation bars, header, and footers are good candidates for fragment caching.
When there is a need to keep the business logic separate from the User Interface or when there is
some class which is big enough to have multiple number of developers implement the methods in it,
the class can be separated and written in different files as partial class.
//syntax for C#
//code
http:// localhost/form.aspx?param1=career¶m2=ride
This html addresses use QueryString property to pass values between pages.
The above code is a submit button event handler and it sends the values of the query string to the
second page.
The following code demonstrates how to retrieve these valus on the second page:
private void Page_Load(object sender, System.EventArgs e)
{
this.form2TextField1.Text=Request.QueryString["Param1"];
this.form2TextField2.Text=Request.QueryString["Param2"];
}
You can also use the following method to retrieve the parameters in the string:
c ccc)c
If a site happens to not maintain a ViewState, then if a user has entered some information in a large
form with many input fields and the page is refreshes, then the values filled up in the form are lost.
The same situation can also occur on submitting the form. If the validations return an error, the user
has to refill the form.
Thus, submitting a form clears up all form values as the site does not maintain any state called
ViewState.
In ASP .NET, the ViewState of a form is maintained with a built-in state management technique keeps
the state of the controls during subsequent postbacks by a particular user.
The ViewState indicates the status of the page when submitted to the server. The status is defined
through a hidden field placed on each page with a <form runat="server"> control.
<input type="hidden" name="__VIEWSTATE" value="CareerRide">
The ViewState option can be disabled by including the directive <%@ Page
EnableViewState="false"%> at the top of an .aspx page
Viewstate is used to maintain or retain values on postback. It helps in preserving a page. Viewstate is
internally maintained as a hidden field in encrypted form along with a key.
* c
Mc No server resources.
Mc Viewstate ensures security because it stores the data in encrypted format.
Mc Viewstate are simple. They are used by enabling or disabling the viewstate properties.
Mc It is based on the wish of developer that they want to implement it at the page level
or at control level.
" *
a)c If large amount of data is stored on the page, then page load might cause a problem.
b)c Does not track across pages. Viewstate information does not automatically transfer from
page to page.
ßc "
With the ¶src· attribute, the source code files are deployed and are compiled by the JIT as needed.
Though the code is available to everyone with an access to the server (NOT anyone on the web), this
method is preferred as it does away with the compilation of the DLLs.
¶CodeBehind· attribute just has the VS.NET associate the code file with the aspx file. This is necessary
since VS.NET automates the pre-compiling that is harder by hand.
Due to this the ¶Src· attribute is done away with having only a DLL to be deployed enhancing the
protection level even though it can be decompiled.
-c ccc
A URI is a unique identifier to usually a namespace. Though it looks like a URL but it doesn·t have to
necessarily locate any resource on the web. URI is a generic term. URL is a type of URI.
c c+cccc
. c- Uniform Resource Identifier: it·s a string and its responsibility is to identify a resource by meta-
information. It gives information about only one resource.
. - Uniform Resource Locator: identifies the resource on the net and tells it is obtainable using
what protocols.
Previously, in ASP.NET, the pages and the code used to be compiled dynamically and then cached so
as to make the requests to access the page extremely efficient. In ASP.NET 2.0, the pre-compilation
feature is used with which an entire site is precompiled before it is made available to users.
App_GlobalResources: stores all the resources at global level E.g. resx files, etc
It is a process where things that can be handled before compilation are prepared in order to reduce
the deployment time, response time, increase safety. It·s main aim to boost performance.
During development, it allows you to make changes to the web pages and reuse it using the same
web browser to validate the changes without compiling the entire website.
During deployment, it generates the entire website folder structure in the destination. All the static
files are copied to the folder and bin directory would later on contain the compiled dll.
Copy to the DLL of the control library to the project where this control needs to be used
The custom control can then be registered on the webpage as any user control through the
@Register tag.
It's a way in CLR to maintain a boundary between various applications to ensure that they do not
interfere in working of any other application. CLR acts as a mini operating system where a single
process may have various application domains.
An operating system process can have many ongoing application domains. Application Domains keep
an application separate. All objects created within the same application scope are created within the
same application domain. Multiple application domains can exist in a single operating system process.
Distinct memory address space allocation by the OS is effective but expensive and it does not satisfy
to the numbers required for large web servers. However, the CLR isolates an application by managing
the memory use of code running within the application domain due to which the code cannot access
memory outside the boundaries of the domain.
c($c
cc
c
c ccc
Gc *c
* c G
c /
c 0 lasts the lifetime of the server. They are activated as
SingleCall/Singleton objects. It makes objects stateless. A SingleCall object gets created for each
request by client and a Singleton object is created once on the server and is shared by all the clients.
Gc/c
* cG
0 CAO creates stateful objects. The object creation request is based
on the request by client side. Therefore, the lifetime is based on client and not server. Single instance
of object is created for every call.
±c "
cGc
c
c c
1.c Server
2.c Client: This connects to the hosted remoting object
3.c Common Interface between client and the server .i.e. the channel
a)c When a client object wants to create an instance of the server object, the remoting
system at the client creates a proxy of the server object. The proxy object is at the client
but behaves exactly like the remote object i.e. the server object.
b)c The proxy passes the call information to the remoting system on the client. Client
remoting system then sends the information to the remoting system on the server which
then invokes the actual method on the server object. The remoting system on the server
then passes the result information back to the client remoting system.
c)c The client remoting system returns the results to the client object through the proxy.
Singleton architecture is to be used when all the applications have to use or share same data.
½-c "
c1c$$1c Gc cc
The LeaseTime property protects the object so that the garbage collector does not destroy it as
remoting objects are beyond the scope of the garbage collector. Every object created has a default
leasetime for which it will be activated. Once the leasetime expires, the object is eligible again for
garbage collector and is eventually destroyed. Default value is 5 minutes.
Even though the leasetime of an object has expired, there still may be clients who would still need the
remoting object on the server. In such cases the leasemanager keeps a track of such clients and asks
them if they need the object and are ready to extend or sponsor the object to extend its existence.
This is done through SponsorshipTime property, which is then based on the sponsor.
The RenewOnCallTime property defines the duration for which a remoting object's lease is extended if
a sponsor is found. The default value is 2 minutes.
The LeaseManager class has a property PollTime, which defines the frequency at which the
LeaseManager polls the leases. Default is 10 seconds.
½ c ,
(c&$ccc$
(cc$cc
c
c
The remoting parameters can be specified through both programming and in config files. All the
settings defined in config files are placed under <system.runtime.remoting>
<application> is placed under system.runtime.remoting but the name attribute of application tag
specifies if the parameter is for server or client. RemotingConfiguration.Configure is used to access
the configuration keys for remoting properties.
Marshaling is a process of transforming or serializing data from one application domain and
exporting it to another application domain.
½!c c($c
ccc
ë
a copy of an object is created by the server and is passed and used by the client.
ë
: the client creates a proxy to access the object.
½%c ccG
c
ccc
ObjRef is a searializable object returned by Marshal() that knows about location of the remote object,
host name, port number, and object name.
c
a. Create a new website by selecting "ASP.NET Web Site" and giving it a suitable name.
b. service.cs file appears inside the solution with a default webmethod named as "HelloWorld()"
c. Right click on the webservice project and add a web reference instead of adding a normal
reference.
$cc.
c. Double click the button to see the click event of the button
e. Write code to display the value returned by the webmethod on the label
g. click on the button and the message "Hello World" would be displayed on the label
$$
c G
Application variable/object stores an Object with a scope of availability of the
entire Application unless explicitly destroyed.
cG
The lifetime of cache is throughout the lifetime of an application or is based upon
timeouts
The cache object has dependencies e.g. relationships to the file it stores. Cache items remove the
object when these dependencies change. As a work around we would need to simply execute a
callback method whenever items are removed from the cache to add the items back in cache.
e.g.: We have a string variable string var="hello" and store it in cache. This item would be
removed from the cache if value is changed from "hello" to "bye". In such a case we need to
simply right a callback function which would add updated var back in cache as it·s been
removed as a result of its dependencies changing.
½±c cc
*c
A process where items are removed from cache in order to free the memory based on their priority. A
property called "CacheItemPriority" is used to figure out the priority of each item inside the cache.
This priority property is set when an item is added to the cache.
c$ Is used to fetch information or data at page level. It is best used when the site is mainly
static. Used by declaring the output page directive
c
Is used to cache the structure level information. It is used when parts of pages
change. For example: user control
c c Is used to fetch the information of an application quickly based on the
requirements.
c*c
cc$ccc
c
c
The ways to cache different versions on the same page using ASP.NET cache object is using
OutputCache object.
Fragment cache is to store user controls individually within a web form in cache instead of the whole
webform as such. The idea is to simply have different cache parameters for different user controls.
Types of sessions:
InProc: The default way to use sessions. InProc is the fastest way to store and access sessions.
OutProc:
i. State server: 15% slower than InProc. Session is serialized and stored in aspnet_state.exe process.
Stateserver sessions can be stored on a separate machine too.
ii. SQL Server: 25% slower than InProc. Used when data is to be serialized and stored in SQL Server
database.
c($c
cccc$c*ccc
+ cc
The In-Process type of Session state management stores the session in memory on the web server.
In order to have a user always reconnect to the same web-server, a sticky server is needed.
G+
+
cc
The external data source may be a SQL Server or a State Server service.
Querystring is way to transfer information from one page to another through the URL. QueryString is
attached to the URL with "?".
* c
" * c
All the attributes and values are visible to the end user. Therefore, they are
not secure.
b. There is a limit to URL length of 255 characters.
Sliding Expiration: the cache duration increases in this case by the specified sliding expiration value
every time the page is requested. More a page is requested it will remain in cache, whereas a less
requested page will not remain in cache.
cc: It refers to the scenario where on event of some controls posts from one page
to another instead of a normal postback. Normal postback is when for e.g. a button (or any control
that postbacks) is clicked and web page is submits the page back to itself which means a return trip.
In Cross page posting, on click of a button there would be no return trip.
Cross-page posting is done at the control level. It is possible to create a page that posts to different
pages depending on what button the user clicks on. It is handled by done by changing the
postbackurl property of the controls.
PreviousPage property is set to the page property of the nest page to access the viewstate value of
the page in the next page. Page poster = this.PreviousPage;
Once that is done, a control can be found from the previous page and its state can be read.
Label posterLabel = poster.findControl("myLabel");
string lbl = posterLabel.Text;
SQL Cache Dependency in ASP.NET: It is the mechanism where the cache object gets invalidated when
the related data or the related resource is modified. It is a feature in SQL Server 2005 and SQL Server
2000.
Files/folders.
c
c It works opposite to fragment caching. The entire page is cached, except
what is to be kept dynamic. When [OutputCache] attribute is used, the page is cached on both the
server and the client. Whereas, you use in case of post cache substitution the page is cached on the
server only. HttpResponse.WriteSubstitution method is a way to implement it.
Users of different countries, use different languages and others settings like currency, and dates.
Therefore, applications are needed to be configurable as per the required settings based on cultures,
regions, countries.
Globalization: Is a way of writing the executables in a way that they are culture or language neutral.
The culture and language details specific details should be kept configurable. The main part of
Globalization is to find out the locale-sensitive resources that are needed to be kept configurable and
to segregate these resources from the executable code.
Localization: Is the task to customize the application. The main part of localization is the translation of
resources found in globalization.
Code Page was used before Unicode came into existence. It was a technique to represent characters
in different languages. It was a different interpretation of ASCII set which means it kept 128 characters
for English and rest 128 were specifically tailored for other languages.
" * c
a.c Languages like Japanese and Chinese having more than 5000 characters
were difficult to represent n 128 character set.
b.c Clients also need to have a support for code page.
c.c It¶s representation is done on the basis of operating system.
%*c cc
c
c c&$cc ccc
c
c
Resource files are files in XML format. They contain all the resources needed by an application. These
files can be used to store string, bitmaps, icons, fonts.
Satellite Assemblies are language-specific assemblies and are used for language-specific resources for
an application. Each assembly of this kind has a separate language specific ID and is installed in a
language-specific subdirectory for each language.
%±c "
c6c c 56c
Al.exe: It embeds the resources into a satellite assembly. It takes the resources in .resources binary
format.
resgen.exe:The input for Al.exe is generally plain text or XML-based resource files i.e. in .resx format.
resgen.exe is used to convert such resources to the .resource in binary format which makes then
compatible with al.exe.
ResourceManager class: It provides convenient access to resources that are culture-correct. The access
is provided at run time.
This class provides resource withdrawal when a localized resource does not exist. It helps in resource
serialization, and provides access to resources that are not packaged in your assembly. It is very much
possible to derive classes from ResourceManager class and create our own custom resource solutions.
WCF is a framework that builds applications that can inter-communicate based on service oriented
architecture consuming secure and reliable web services. This also helps in Distributed computing.
The WCF also brings together the various communication models into a single model.
A service-oriented architecture is collection of services which communicate with one another other.
The communication can range from simple data passing to two or more services organizing some
activity.
*½c &$cc
$c
cc+c*
c
1cc*1c"c$c
$ are the connection points for the clients to connect to the service. Clients find the end
points through three components like service contract, binding, and address.
*!c "
WCF can create services similar in concept to ASMX, but has much more capabilities. WCF is much
more efficient than ASP.Net coz it is implemented on pipeline. WCF is more secure, reliable. As WCF is
implemented on a different pipeline it does not have all Http capabilities (Http session, cache etc).
*%c cc
Duplex contract: It enables clients and servers to communicate with each other. The calls can be
initiated independently of the other one. The duplex contract is one the message patterns available to
Windows Communication Foundation (WCF) services. It comprises of two one-way contracts.
*-c "
Read Uncommitted: - Also known as Dirty isolation level. It makes sure that corrupt Data cannot be
read. This is the lowest isolation level
Read Committed: - It ensures not to read the data that has been changed by any other application
and is not yet committed. It is the default level.
Repeatable Read: - It stops the usage of dirt read and non-repeatable read. It states that data fetched
through a query will be locked and will not be updated by any other transaction.
Serializable: - It does not allow any modification and addition of new data till the transaction is
completed. This is considered to be a very restrictive level.
Snapshot: - It raises error on modifying a data that has already been changed by any transaction.
)c3 There are scenarios in the project when you want the message to deliver in proper
time. The timely delivery of message is very more important and to ensure they are not lost is
important too. Volatile queues are used for such purposes.
" +c 3 Queues are needed so that client and server are not required to run at the
same time when the message is sent. When a message lies inside a queue for a long time on the
server and becomes invalid after some time period, then such messages are not to be sent to the
client. All these messages are sent to dead-letter queue. Therefore, dead-letter queues are
responsible for storing messages that fail timely delivery.
c 2
c c /0 c It is a platform for building, managing and executing
workflow-enabled applications, for designing and implementing a programming model for
controlling and communicating with workflows, a workflow execution engine and more.
'c2
The sequential workflow style executes a set of contained activities in order,
one by one and does not provide an option to go back to any step.
c
c2
It represents the workflow in the form of a state machine containing set of
states, each of them receiving events. These events lead to transition from one state to another one.
XOML is an acronym for Extensible Object Markup Language. XOML files are the markup files. They
are used to declare the workflow and are then compiled with the file containing the implementation
logic. XOML file is used separately to ensure code-separation workflow authoring
ccc½-c
Microsoft's Internet Information Services web server software is used to make an application offline.
The IIS is instructed to route all incoming requests for the web site to another URL automatically.
In the properties of IIS manager, choose Virtual Directory tab and indicate that the content for this
application should come from "A redirection to a URL."
Script injection attacks called Cross-site scripting (XSS) attacks exploit vulnerabilities in Web page
validation by injecting client-side script code.
This code executes on the user·s browser after the browser downloads the script code from a trusted
site and then the browser has no way of determining the legitimacy code.
Authentication is the process of verifying user·s details and find if the user is a valid user to the system
or not. This process of authentication is needed to provide authority to the user. ASP.NET implements
authentication through authentication providers. Each provider has OnAuthenticate event. It allows
building a custom authorization scheme.
Authorization is a process that takes place based on the authentication of the user. Once
authenticated, based on user·s credentials, it is determined what rights des a user have. In ASP.NET,
there are two ways to authorize access to a given resource:
a. File authorization
b. URL authorization
-*c "
c
c
ccc
System.Web.UI.Page
-c c
System.Web.UI.Page.Culture
*
" *
Code writing, debugging, managing concurrency, testing, porting existing code is difficult in
multithreading and multicontexting.
Programmers need to remove static variables and replace any code that is not thread-safe to
introduce threading into a previously non threaded application.
To start your own threads with ThreadStart delegates, you should create a new thread "manually" for
long-running tasks.
Using the ThreadPool class either directly (using ThreadPool.QueueUserWorkItem) or indirectly using
asynchronous methods (such as Stream.BeginRead, or calling BeginInvoke on any delegate).
c ,
c
ccc cccc
A thread pool executes on a single processor. But they are theoretically associated to server farms in
which a master process distributes tasks to worker processes on different computers to increase the
overall throughput.
!c &$c c c
c c c c c c
c c c ( c
$
ccccc
using System.Threading;
int x;
int val;
while(true)
x=this.progressBar1.Step*r.Next(-1,2);
val = this.progressBar1.Value + x;
val = this.progressBar1.Maximum;
val = this.progressBar1.Minimum;
this.progressBar1.Value = val;
Thread.Sleep(100);
t1.IsBackground = true;
t1.Start();
System uses synchronization mechanism to make sure that a resource is used by only one thread at a
time when more than one thread needs to access a shared resource at the same time.
A second thread that needs to acquire a particular mutex is suspended until the first thread releases
the mutex.
Access to objects by is controlled by the Monitor class. It grants a lock for an object to a single thread.
Critical sections can be access restricted by using object locks.
While a thread owns the lock for an object, no other thread can acquire that lock.
Interlocked class provides atomic operations for variables that are shared by multiple threads.
When two threads are executing concurrently on separate processors error protection is done.
The methods of this class help protect against errors that can occur when the scheduler switches
contexts while a thread is updating a variable that can be accessed by other threads.
ReaderWriterLock synchronizes access to a resource. It allows either concurrent read access for
multiple threads, or write access for a single thread.
A ReaderWriterLock provides better throughput than a simple one lock a time like Monitor.
-c &$cc4ccc&$c(c4c c6c4ccc
System.Runtime.Serialization namespace provides Serialization in .NET.
The IFormatter interface in the namespace contains Serialize and De-serialize methods that save and
load data of a stream.
So we need stream as a container for the serialized object(s) and a formatter that serializes these
objects onto the stream to implement serialization in .net.
Binary serialization is a mechanism that creates exact binary copy of the object onto the storage
media by writing the data to the output stream such that it can be used to re-construct the object
automatically.
XML serialization results in strongly typed classes with public properties and fields that are converted
to a serial format for storage or transport. This XML stream conforms to a specific XML Schema
definition language (XSD) document.
An object is stored in a file, a database or even in the memory. However, data to be transferred over a
network needs to be in a linear form for which serialization and deserialization are used.
c &$cc $cc $cc(c4c c
And
BinaryFormatter
Constructor: binaryFormatter.Serialize(fileStreamObject, object1);
.NET framework provides Binary formatter and SOAP formatter which inherit from the IFormatter
interface
It provides binary encoding for compact serialization for storage or socket-based network streams.
It is not appropriate for data to be passed through a firewall.
cGc
It provides formatting that can be used to enable objects to be serialized using the SOAP protocol.
The class is used for serialization through firewalls or diverse systems.
An object is stored in a file, a database or even in the memory. However, data to be transferred over a
network needs to be in a linear form for which serialization and deserialization are used.
Also Binary Serialization is faster, supports complex objects too with read only properties and even
circular references.
fmt.Serialize(fs, o);
*
c c $
.
Server.Transfer
Transfers page processing from one page directly to the next page.
Server.Transfer does not update the clients url history list or current url.
Response.Redirect
Performs a trip back to the client where the client's browser is redirected to the new page.
The user's browser history list is updated to reflect the new address.
±!c "
c"Gc"ccc
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.
You can use For Each loops to move through the data in the dataset.
±%c "
c&ccccc
You can implement application and session level events using global.asax.
±*c ccc$$
7c c7cc c
ccc
These subroutines set the variables for the Application and Session objects.
±-c "
cc
c c
c ccc
Code-behind is code written in a separate file and referenced by the .aspx page.
±c ccccc
MSIL is the Microsoft Intermediate Language. .NET compatible application will get converted to MSIL
on compilation. MSIL gets converted into machine language or native code by JIT compiler.
±ßc &$c
c c c *c c +c c /c $
c 01c c / 01c
c/ 0ccc
Low (IIS Process):
This is the fastest and the default IIS4 setting. ASP pages run in INetInfo.exe and so they are executed
in-process. If ASP crashes, IIS too does and must be restarted.
Medium (Pooled):
This IIS setting is more reliable. In this if ASP crashes, IIS does not. In this, the ASP applications share
the same process, so a web site can run with just IIS and ASP process. IIS5 supports this setting and is
the default setting.
High (Isolated):
This setting runs in MTS.EXE in IIS4 and in DLLHOST.EXE in IIS5. If one ASP application crashes, IIS or
other ASP applications don·t crash. Each ASP application runs out-process in its own space.
It can be accessed using the type name instead of the instance name.
Option Strict On enables type checking at design time andprevents type mismatch bugs.
Boxing allows you to treat a value type the same as a reference type.
ß*c "
c)cccc
It allows the state of objects (serializable) to be stored in a hidden field on the page. It is transported
to the client and back to the server, and is not stored on the server or any other external source. It is
used to retain the state of server-side objects between postbacks.
ß-c ccc
$c
cc cc)cc
Items stored in the ViewState exist for the life of the current page. This includes postbacks (to the
same page).
It allows the page to save the users input on a form across postbacks.
It saves the server-side values for a given control into ViewState, which is stored as a hidden value on
the page before sending the page to the clients browser.
When the page is posted back to the server, the server control is recreated with the state stored in
viewstate.
Delegates provide the functionality behind events. A delegate is a strongly typed function pointer.
Invoke a method without making an explicit call to that method. In Visual Basic .NET, the role of the
delegate is largely behind the scenes .
Classes are the blueprints for objects. A class acts as a template for any number of distinct objects.
- c c c c
c ($c
c c c c $c *c c
c&$ccc
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.
PreRender() - the brief moment before the page is displayed to the user as HTML
It is data-access technology, primarily disconnected and designed to provide efficient, scalable data
access.
A data provider is a set of classes that provide access to databases. The main components of data
provider are:
Connection
Command
DataReader
DataAdapter
Two additional data providers are included in Visual Studio .NET 2003:
-%c "
c*+ c c+ c
ccccc
<asp:HyperLinkColumn>
--c c c)ccc$$
c$
cc
Web application projects create a virtual folder for each project where all the files of the projects are
stored. The virtual folder can be viewed in IIS and property of that folder determines where the files
are physically stored.
-±c "
c
c c cc
c c
-ßc $cc&
cc c$
c
cc$$
cc
Set the object·s CommandText property to the name of the stored procedure.
Exception handling correct unusual occurrences and prevent application from getting terminated. You
can use Try(try) block and Error event procedures to handle exceptions.
Exceptions or errors are unusual occurrences that happen within the logic of an application. The CLR
has provided structured way to deal with exceptions using Try/Catch block. ASP.NET also
supports exception handling through server events such as Page_Error and Application_Error events.
c ccc(c
c c&
$ccccc
There are three ways to handle exceptions in ASP.NET
Try/catch/finally block.
Using Events like Page_Error and Application_Error
Using Custom error page
Error pages are used when exceptions are outside the scope of the application and the application
can·t respond directly to these exceptions. These types of exceptions are identified by HTTP response
codes, which IIS can respond to by displaying custom error pages listed in your application·s
Web.config file.
Tracing records unusual events while an application is running. It helps in observing problems during
testing and after deployment. An application can write a message in case of unusual events to the
trace log using Trace class.
%c cccc
c)cccc
ComVisible attribute is used to select which public .NET classes and members are visible to COM.
*c "
c c cc
ccc
Windows authentication is the default authentication method of the ASP.NET application. It uses
security scheme of windows operating system of corporate network. Windows authentication uses
user names, passwords, and permissions of network resources and Web applications. User lists for
Windows authentication are included in the element of Web.config.
Form authentication allows creating own database of users in the application·s Web.config file or in a
separate user database and validate the identity of the users when they visit Web site. Users do not
have to be member of a domain-based network to have access to your application.
SSL protects data exchanged between a client and an ASP.NET application by encrypting the data
before it is sent across the internet.
c c
" cc
c
cc# #c6cc
Standard EXE's are run by users that are logged onto the system. This is accomplished by either
navigating to the shortcut associated with the application (either on the programs menu or the desktop)
or clicking on the icon. This will run that application using the rights of the currently logged on user. You
can also run as another user by right-clicking on the icon and selecting run-as from the context menu, but
you get the picture. Standard EXE's are associated with the current user and their desktop.
Windows Services, on the other hand, are processes that can exist and run without a user/desktop. The
windows service runs in its own windows session without the need for any particular user to be logged
onto the system. They are initiated when the system boots up. As opposed to a Standard EXE, they have
no user interface as they run in the background of your computer by using the Computer Management
Console.
So the lifecycle of a Windows Service is different from the lifecycle of a Standard EXE because a Windows
Service is associated with the system (but can use any account) and begins its "life" when the system
boots up. A Standard EXE needs a signed on user(manually or programmaticlly)to initiate its instantiation.
c c (c
cc
NT-based OSs split memory into user and kernel space. The amount of memory usable is dependent on
the exact flavor of the OS and whether the processor is 32-bit or 64-bit.
So yes, a process's max memory is different than the system's total virtual memory.
System design is impacted if you're trying to create a system using very large data structures, particularly
if your software's running on a system with other apps. Your design needs to make careful use of memory
to make sure you're not going to run out of virtual memory. Furthermore, since virtual memory is a
combination of physical memory and swap file space, you need to take care to avoid paging -- or at least
minimize it as much as possible. This means you should have an understanding of the environment your
software's going to run in. At the minimum, you should have good documentation explaining your
assumptions, estimated system requirements and projected system impacts.
c
ccc
An ActiveX Dll runs is an in process server running in the same memory space as the client process. It is an
in-process component shares its client·s address space, so property and method calls don·t have to be
marshaled. This results in much faster performance. If an unhandled error occurs it will cause the client
process to stop operating.c
An ActiveX Exe is an out of process server which runs in it's own separate memory space. The component
can run as a standalone desktop application, like Microsoft Excel or Microsoft Word, in addition to
providing objects.c
The component can process requests on an independent thread of execution, notifying the client of task
completion using events or asynchronous call-backs. This frees the client to respond to the user.
If an error occurs the client processes can continue to operate. It is generally slower than an ActiveX dll
alternative.c
In strongly-typed programming languages you usually have to declare variables prior to using them.
Strong-typing is the strict enforcement of [type] rules. All types (int, short, long, string) are know at
compile time and are statically bound. So C# is a strongly-typed language because variables must be
assigned a type before you use them. If you came from the ASP world then you will remember having to
use either Javascript or VBScript. Variables that you declare in either of those languages can hold any data
type which makes it weakly-typed. strong-typing means a strict enforcement of type rules with no
exceptions as opposed to weak-typing which allows well defined exceptions (such as assigning an int to a
float in C++).
While strong-typing can prevent many type errors, weak-typing is much more developer ´friendlyµ.
I assumed the preffered enforcement mechanism depends on the application at hand
But lets take this up a level. Instead to talking about programming languages, lets talk about strongly-
typed/weakly-typed objects. The DataSet object is a great example. If we use a weakly-typed dataset, the
developer needs to know the name of the table and the name of the field being requested. Since we are
just passing strings, this code will compile and will not show any possible problems (like typing the name
of the table wrong) until run time.
If our Dataset is Strongly-Typed, we are able to access the names of the tables and columns directly. Any
errors are caught at compile time.
string s = myDataSet.Customers[0].CustomerID;
I am not really going to argue which is better, I will leave that up to you. I will leave you with this question
though; would you rather catch your errors at compile time, or run-time?
c
9c $
c c c #$c #c c c c !c
$c
c c $c
ccc c*c(cc
What is a '.NET component'? Arguably, almost any .NET class file is a component, in that it can easily be
compiled to a DLL, it benefits from .NET versioning, and it can be reused. If you narrow the definition to
components that are 'designable', in other words you can drop instances onto a Visual Studio .NET design
surface and set their properties or create event handlers visually, then you need a class that directly or
indirectly implements IComponent. Designable objects do not necessarily have a user interface. Those
that do are controls as well as components, and inherit from System.Windows.Forms.Control or
System.Web.UI.Control.
The existence of components also implies the existence of containers, which again may be visual or non-
visual. In the .NET Framework both ASP.NET Web Forms and rich client Windows Forms are visual
component containers. The container plays an important role in component management. In particular, all
containers implement IDisposable, which means they have a Dispose method for releasing unmanaged
resources such as window handles or open files. In their Dispose method, containers must also call
Dispose on all the components they host.
ccc"cccc
cccc(cc
The PID is an integer that is assigned to each process in your operating system.It is usefull when you need
to diagnose problems with your application since it allows you to uniquely identify each process.
cIn the .Net framework, you can access this information by using the System.Diagnostics namespace.
Only one.c
GAC=Global Assembly Cache, solves dll versioning(hell) problem. It's interesting to know how it solves the
problem, each assembly is uniquely identified by 4 'things' major version number,minor version, build and
revision numbers.For each differing version, the GAC silently creates a subfolder based on a hash of these
and places the assembly in it.From a user perspective it seems as if, we are moving the same file in one
directory and it doesn't ask if it should overwrite the file !
Unlike earlier situations, GAC can hold two assemblies of the same name but different version. This
ensures that the applications which access a particular assembly continue to access the same assembly
even if another version of that assembly is installed on that machine
+*cc"*$c
c c
+ 1c G
+ c c $
+ c
$cc
Interface oriented programming defines a contract between two parties - a rule that both stick to and
neither care how the other is providing the functionality. Classic example would be COM.
Object Oriented Programming: A programming methodology which models software in the natural way
as they are represented in the real world objects. The core tenets are Abstraction, Encapsulation,
Polymorphism and Inheritance. This took reuse to a newer level. Object oriented programming is looking
at things behavioraly - in what they do(methods) and what identifes them(properties).
"
ccc
cc cc8c
c
cccc
An interface defines a contract. It doesn't provide an implementation. A class can and usually provides an
implementation.c
cc
c
contain modules, modules contain types, and types contain members. Reflection provides
objects that encapsulate assemblies, modules, and types. You can use reflection to dynamically create an
instance of a type, bind the type to an existing object, or get the type from an existing object. You can
then invoke the type's methods or access its fields and properties. Typical uses of reflection include the
following:
Use ( to define and load assemblies, load modules that are listed in the assembly manifest, and
locate a type from this assembly and create an instance of it.
Use to discover information such as the assembly that contains the module and the classes in the
module. You can also get all global methods or other specific, nonglobal methods defined on the module.
Use
to discover information such as the name, parameters, access modifiers (such as
public or private), and implementation details (such as abstract or virtual) of a constructor. Use the
5
or 5
method of a ($ to invoke a specific constructor.
Use
to discover information such as the name, return type, parameters, access modifiers
(such as public or private), and implementation details (such as abstract or virtual) of a method. Use the
5 or 5 method of a ($ to invoke a specific method.
Use
to discover information such as the name, access modifiers (such as public or private) and
implementation details (such as static) of a field, and to get or set field values.
Use *
to discover information such as the name, event-handler data type, custom attributes,
declaring type, and reflected type of an event, and to add or remove event handlers.
Use
to discover information such as a parameter's name, data type, whether a parameter
is an input or output parameter, and the position of the parameter in a method signature.
Use " to discover information about custom attributes when you are working in the
reflection-only context of an application domain. CustomAttributeData allows you to examine attributes
without creating instances of them.
Reflection is the feature in .Net, which enables us to get some information about object in runtime. That
information contains data of the class. Also it can get the names of the methods that are inside the class
and constructors of that object.
To write a C# .Net program which uses reflection, the program should use the namespace
System.Reflection. To get type of the object, the typeof operator can be used. There is one more method
GetType(). This also can be used for retrieving the type information of a class. The Operator typeof allow
us to get class name of our object and GetType() method uses to get data about object?s type. This C#
tutorial on reflection explains this feature with a sample class.
c
d cc
dc
c
d c
d
c
c
ccc cc
cc
c
c
d c
d
cc
c
ccc ccc
c
c
d c c c
c
d c c
c
c
ccc c c
c
d c c
c
c
ccc c c
c
cc
c
At first we should get type of object that was created. The following C# .Net code snippet shows how to
do it.
dc ccc
d
c
dc dcc d
c
Now objectType has all the required information about class TestDataType. We can check if our class is
abstract or if it is a class. The System.Type contains a few properties to retrieve the type of the class:
IsAbstract, IsClass. These functions return a Boolean value if the object is abstract or of class type. Also
there are some methods that return information about constructors and methods that belong to the
current type (class). It can be done in a way as it was done in next example:
c
Now, the above program returns a list of methods and constructors of TestDataType class.
Reflection is a very powerful feature that any programming language would like to provide,
because it allows us to get some information about objects in runtime. It can be used in the
applications normally but this is provided for doing some advanced programming. This might be
for runtime code generation (It goes through creating, compilation and execution of source code
in runtime).
ccc
$(1cccc
ccc(c3
ccccc
cccc
cc
cc* c( /#
#0;cc
c
ccc8c(+ cc
c"cccc
c cccc
cccc cc
c
ccc+
c
4cc
ccc
4cc
c cc
c
cc c2c:c#
=#cc
ccc
cc+$
c c+
+$
cc
c(8ccc
$cc1cc$
cccccc c
6c c½---c c½--!c
c"*$:
c
cc c 2/0c$c> c 2?cc cc c c cc*c cc
c
c c(c
c
*c
c(c
cccc c$
c
(c
$cc
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
How does the XmlSerializer work? What ACL permissions does a process using it require?
What is the difference between Debug.Write and Trace.Write? When should each be used?
What is the difference between a Debug and Release build? Is there a significant speed difference? Why
or why not?
Does JITting occur per-assembly or per-method? How does this affect the working set?
What is boxing?
C# Component Developers
Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0,
Culture=neutral, PublicKeyToken=593777ae2d274679d
What benefit do you get from using a Primary Interop Assembly (PIA)?
What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
Explain what·s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} }
How is this construct useful?
Describe how a browser-based Form POST becomes a Server-Side event like Button1_OnClick.
What is a PostBack?
What is the <machinekey> element and what two ASP.NET technologies is it used for?
What three Session State providers are available in ASP.NET 1.1? What are the pros and cons of each?
Given one ASP.NET application, how many application objects does it have on a single proc box? A dual?
A dual with Web Gardening enabled? How would this affect a design?
Are threads reused in ASP.NET between reqeusts? Does every HttpRequest get its own thread? Should
you use Thread Local storage with ASP.NET?
Is the [ThreadStatic] attribute useful in ASP.NET? Are there side effects? Good or bad?
Give an example of how using an HttpHandler could simplify an existing design that serves Check Images
from an .aspx page.
What kinds of events can an HttpModule subscribe to? What influence can they have on an
implementation? What can be done without recompiling the ASP.NET Application?
Describe ways to present an arbitrary endpoint (URL) and route requests to that endpoint to ASP.NET.
Name and describe at least a half dozen HTTP Status Codes and what they express to the requesting
client.
How does if-not-modified-since work? How can it be programmatically implemented with ASP.NET?
Explain <@OutputCache%> and the usage of VaryByParam, VaryByHeader.
How would one implement ASP.NET HTML output caching, caching outgoing versions of pages generated
via all values of q= except where q=5 (as in $ ::
:$$&'A*)?
When is the DOM appropriate for use? When is it not? Are there size limitations?
Write a small XML document that uses a default namespace and a qualified (prefixed) namespace. Include
elements from both namespace.
Why is this almost always a bad idea? When is it a good idea? myXmlDocument.SelectNodes("//mynode");
Describe the difference between pull-style parsers (XmlReader) and eventing-readers (Sax)
What is the difference between XPathDocument and XmlDocument? Describe situations where one
should be used over the other.
Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to
solve?
Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why?