QB

Published on July 2016 | Categories: Documents | Downloads: 75 | Comments: 0 | Views: 481
of 18
Download PDF   Embed   Report

Comments

Content


What is the base class of .NET?
Base class provides a base set of methods that all derived classes can use
Explain assemblies.
Answer 1:
Assemblies are similar to dll files. Both has the reusable pieces of code in the
form of classes/ functions. Dll needs to be registered but assemblies have its
own metadata.
Answer 2:
Assembly is a single deployable unit that contains information about the impleme
ntation of classes, structures and interfaces. it also stores the information ab
out itself called metadata and includes name and verison of the assembly, securi
ty information, information about the dependencies and the list of files that co
nstitute the assembly.
Assembly also contains namespaces. In the .Net Framework, applications are deplo
yed in the form of assemblies.
Answer 3:
An assembly is a single deployable unit that contains all the information about
the implementation of :
- classes
- structures and
- interfaces
An assembly stores all the information about itself. This information is called
METADATA and include the name and the verison number of the assembly, security i
nformation, information about the dependencies and a lost of files that constitu
te the assembly.
All the application developed using the .NET framework are made up of assemblies
.
Namespaces are also stored in assemblies
Answer 4:
In the Microsoft .NET framework an assembly is a partially compiled code library
for use in deployment, versioning and security. In the Microsoft Windows implem
entation of .NET, an assembly is a PE (portable executable) file. There are two
types, process assemblies (EXE) and library assemblies (DLL). A process assembly
represents a process which will use classes defined in library assemblies. In v
ersion 1.1 of the CLR classes can only be exported from library assemblies; in v
ersion 2.0 this restriction is relaxed. The compiler will have a switch to deter
mine if the assembly is a process or library and will set a flag in the PE file.
.NET does not use the extension to determine if the file is a process or librar
y. This means that a library may have either .dll or .exe as its extension.
The code in an assembly is partially compiled into CIL, which is then fully comp
iled into machine language at runtime by the CLR.
An assembly can consist of one or more files. Code files are called modules. An
assembly can contain more than one code module and since it is possible to use d
ifferent languages to create code modules this means that it is technically poss
ible to use several different languages to create an assembly. In practice this
rarely happens, principally because Visual Studio only allows developers to crea
te assemblies that consist of a single code module.
Name some of the languages .NET support?
Some of the languages that are supported by .NET
1. Visual Basic.NET
2. Visual C#
3. Visual C++
ADO.NET features? Benefits? Drawbacks?
Answer 1:
1. Data will be retrieved through Datasets
2. Scalability
Answer 2:
1. Disconnected Data Architecture
2. Data cached in Datasets
3. Data transfer in XML format
4. Interaction with the database is done through data commands
How many types of exception handlers are there in .NET?
Answer 1:
From
MSDN>gt; How the Runtime Manages Exceptions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conexceptionsoverview.asp
The exception information table represents four types of exception handlers for
protected blocks:
A finally handler that executes whenever the block exits, whether that occurs by
normal control flow or by an unhandled exception.
A fault handler that must execute if an exception occurs, but does not execute o
n completion of normal control flow.
A type-filtered handler that handles any exception of a specified class or any o
f its derived classes.
A user-filtered handler that runs user-specified code to determine whether the e
xception should be handled by the associated handler or should be passed to the
next protected block.
Answer 2:
1. Unstructured Exception Handling
2. Structured Exception Handling
Difference between Panel and GroupBox classes?
Answer 1:
Panel and Group box both can used as container for other controls like radio but
tons and check box.
the difference in panel and group box are Panel
1) In case of panel captions cannot be displayed
2) Can have scroll bars.
Group box
1) Captions can be displayed.
2) Cannot have a scroll bar
Answer 2:
Panel is scrollable. In panel you cant set caption like Group box.
What is the base class of Button control?
Listing from visual studio .net > Button Class
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ButtonBase
System.Windows.Forms.Button
What is Response object? How is it related to ASPs Response object?
Response object allows the server to communicate with the client(browser). It is
useful for displaying information to the user (or) redirecting the client.
Eg: Response.Write(Hello World)
hat is IIS? Have you used it?
IIS - Internet Information Server
IIS is used to access the ASP.Net web applications
Yes, I used in ASP.NET web applications.
Main differences between ASP and ASP.NET.
Answer 1:
1. ASP: Code is Interpreted
ASP.NET: Code is Compiled
2. ASP: Business Logic and Presentation Logic are in a single file
ASP.NET: Business Logic and Presentation Logic are in separate files (.cs or .vb
) and (.aspx) respectively.
3. ASP: No Web Server Controls
ASP.NET: Web Server Controls supported by strong .NET Framework
4. ASP: No RAD in Classic ASP
ASP.NET: Supports RAD
Answer 2:
1.Asp is interpreted
Asp.net is compiled which is faster than asp.
2 Asp.net maintains its own CLR and is managed as it runs by CLR
Where as asp is unmanaged
3 We can mainatin sessions in state server and sql server which is Outproc,
where in asp sessions will be last if we restart webserver or make changes.
4 In asp.net we can configure each application using web.config file which is av
ailble in application itself and we have machine.config wherer we can configure
all applications.
In asp we cannot configure single aplication
5 Asp.net we have autopostback event which is not in asp
6 In asp.net we have global.asax where can hadle some global things which is not
in asp.
7 We have well built GUI to work in asp.net
8 We have ado.net and as well as disconnected architecture in asp.net
9 We have Xcopy deployment in asp.net
10. We can work with any language as code behind technique in asp.net that suppo
rts .net frame work
Answer 3:
a) asp.net is compiled but ASP is a interpretor or script only.
b) asp.net is supported more control then the asp.
c) asp.net is more supported even control then the asp.
d) In asp.net if update any component then no need to shutdown the computer but
in asp if loaded any component then need tobe shutdown the computer.
d) So lastly an asp.net is faster then asp .

Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
What are the advantages and drawbacks of using ADO.NET?
Pros
====
ADO.NET is rich with plenty of features that are bound to impress even the most
skeptical of programmers. If this werent the case, Microsoft wouldnt even be able
to get anyone to use the Beta. What weve done here is come up with a short list o
f some of the more outstanding benefits to using the ADO.NET architecture and th
e System.Data namespace.
* Performance there is no doubt that ADO.NET is extremely fast. The actual figur
es vary depending on who performed the test and which benchmark was being used,
but ADO.NET performs much, much faster at the same tasks than its predecessor, A
DO. Some of the reasons why ADO.NET is faster than ADO are discussed in the ADO
versus ADO.NET section later in this chapter.
* Optimized SQL Provider in addition to performing well under general circumstan
ces, ADO.NET includes a SQL Server Data Provider that is highly optimized for in
teraction with SQL Server. It uses SQL Servers own TDS (Tabular Data Stream) form
at for exchanging information. Without question, your SQL Server 7 and above dat
a access operations will run blazingly fast utilizing this optimized Data Provid
er.
* XML Support (and Reliance) everything you do in ADO.NET at some point will boi
l down to the use of XML. In fact, many of the classes in ADO.NET, such as the D
ataSet, are so intertwined with XML that they simply cannot exist or function wi
thout utilizing the technology. Youll see later when we compare and contrast the o
ld and the new why the reliance on XML for internal storage provides many, many adv
antages, both to the framework and to the programmer utilizing the class library
.
* Disconnected Operation Model the core ADO.NET class, the DataSet, operates in
an entirely disconnected fashion. This may be new to some programmers, but it is
a remarkably efficient and scalable architecture. Because the disconnected mode
l allows for the DataSet class to be unaware of the origin of its data, an unlim
ited number of supported data sources can be plugged into code without any hassl
e in the future.
* Rich Object Model the entire ADO.NET architecture is built on a hierarchy of c
lass inheritance and interface implementation. Once you start looking for things
you need within this namespace, youll find that the logical inheritance of featu
res and base class support makes the entire system extremely easy to use, and ve
ry customizable to suit your own needs. It is just another example of how everyt
hing in the .NET framework is pushing toward a trend of strong application desig
n and strong OOP implementations.
Cons
====
Hard as it may be to believe, there are a couple of drawbacks or disadvantages t
o using the ADO.NET architecture. Im sure others can find many more faults than w
e list here, but we decided to stick with a short list of some of the more obvio
us and important shortcomings of the technology.
* Managed-Only Access for a few obvious reasons, and some far more technical, yo
u cannot utilize the ADO.NET architecture from anything but managed code. This m
eans that there is no COM interoperability allowed for ADO.NET. Therefore, in or
der to take advantage of the advanced SQL Server Data Provider and any other fea
ture like DataSets, XML internal data storage, etc, your code must be running un
der the CLR.
* Only Three Managed Data Providers (so far) unfortunately, if you need to acces
s any data that requires a driver that cannot be used through either an OLEDB pr
ovider or the SQL Server Data Provider, then you may be out of luck. However, th
e good news is that the OLEDB provider for ODBC is available for download from M
icrosoft. At that point the down-side becomes one of performance, in which you a
re invoking multiple layers of abstraction as well as crossing the COM InterOp g
ap, incurring some initial overhead as well.
* Learning Curve despite the misleading name, ADO.NET is not simply a new versio
n of ADO, nor should it even be considered a direct successor. ADO.NET should be
thought of more as the data access class library for use with the .NET framewor
k. The difficulty in learning to use ADO.NET to its fullest is that a lot of it
does seem familiar. It is this that causes some common pitfalls. Programmers nee
d to learn that even though some syntax may appear the same, there is actually a
considerable amount of difference in the internal workings of many classes. For
example (this will be discussed in far more detail later), an ADO.NET DataSet i
s nothing at all like a disconnected ADO RecordSet. Some may consider a learning
curve a drawback, but I consider learning curves more like scheduling issues. T
heres a learning curve in learning anything new; its just up to you to schedule th
at curve into your time so that you can learn the new technology at a pace that
fits your schedule.
Why The JavaScript Validation Not Run on the Asp.Net Button But Run SuccessFully
On The HTML Button
The Asp.Net Button Is post backed on the server & not yet Submit & when It goes
to the server its states is lost So if we r using javascript in our application
so we always use the Input Button in the asp Button
what is the difference between user control an custom control? advantages/disadv
antages?
Web user controls Vs Web custom controls
Easier to create Vs Harder to create
Limited support for consumers who use a visual design tool Vs Full visual design
tool support for consumers
A separate copy of the control is required in each application Vs Only a single
copy of the control is required, in the global assembly cache
Cannot be added to the Toolbox in Visual Studio Vs Can be added to the Toolbox i
n Visual Studio
Good for static layout Vs Good for dynamic layout
Whats the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output
What is the use of ErrorProvider Control?
The ErrorProvider control is used to indicate invalid data on a data entry form.
Using this control, you can attach error messages that display next to the cont
rol when the data is invalid, as seen in the following image. A red circle with
an exclamation point blinks, and when the user mouses over the icon, the error m
essage is displayed as a tooltip.
What is CLR?
Answer 1:
CLR(Common Language Runtime) is the main resource of .Net Framework. it is colle
ction of services like garbage collector, exception handler, jit compilers etc.
with the CLR cross language integration is possible.
Answer 2:
The .NET Framework provides a runtime environment which runs the code and provid
es services that make the development process easier. This runtime environment i
n .NET Framework is known as Common Language Runtime (CLR). The CLR sits at the
very heart of managed code. Common Language Runtime is the generalized multi-lan
guage, reflective execution engine on which code originally written in various l
anguages runs. At a higher level, CLR is simply an engine that takes in Intermed
iate Language (IL) instructions, translates them into machine instructions, and
executes them. Although the common language runtime provides many standard runti
me services, managed code is never interpreted. A feature called just-in-time (J
IT) compiling enables all managed code to run in the native machine language of
the system on which it is executing. The CLR shares much in common with a tradit
ional operating system.
Quote:
Managed code is the term used for any code that is running on .NET Framework.
The CLR provides the infrastructure that enables managed code to execute as well
provides variety of services during execution. When a method, for which IL has
been generated, is called for the first time the CLR compiles the IL into native
code that is specific to the processor the Environment it is running on (This p
rocess is known as Just in Time Compilation or JIT). If the same method is calle
d next time, the existing JIT compiled code is reused. During execution managed
code receives variety of services from the runtime environment.
Quote:
When compiling to managed code, the compiler translates your source code into Mi
crosoft intermediate language (MSIL), which is a CPU-independent set of instruct
ions that can be efficiently converted to native code. Intermediate Language is
a binary assembly language that is compiled at runtime down to whatever machine
language is appropriate for the host CPU. This runtime compilation is called Jus
t-In-Time Compiling or JIT-compiling.
Advantages of Managed Execution Environments
In unmanaged environments the compiler and linker directly compile the source co
de in to native instructions that are targeted at a specific processor. The disa
dvantage of this process is that each time you want to run your executable on a
different platform you will have to re-compile the code using a compiler and lin
ker that will compile the code that is targeted at the specific hardware. This m
eans that each time you want your application to run on a different platform, yo
u will have to ship the compiled instructions again and again. As this leads to
compiling and maintaining multiple versions of the same application, the compani
es try to create a more generalized compiled version in order to target most of
the environments. This process is known as the Lowest Common Denominator approac
h. This leads to a more generalized program which is not optimized properly and
does not take advantages of the underlying hardware infrastructure (processor, c
ache, etc). Because the CLR supplies one or more Just in Time Compiler for each
computer architecture it supports, the same set of MSIL can be JIT-compiled and
run on any supported architecture. This
CLR provides the following benefits for developers:
Vastly simplified development.
Seamless integration of code written in various languages.
Evidence-based security with code identity.
Assembly-based deployment that eliminates DLL Hell.
Side-by-side versioning of reusable components.
Code reuse through implementation inheritance.
Automatic object lifetime management.
Code access security.
Cross Language Integration.
Self describing objects.
The CLR automatically handles object layout and manages references to objects, r
eleasing them when they are no longer being used. This automatic memory manageme
nt resolves the two most common application errors, memory leaks and invalid mem
ory references. This process is known as Garbage Collection. The CLR also manage
s thread execution, code execution, code safety verification, compilation, and o
ther system services.
The CLR is designed for the software of the future, and it also supports softwar
e of today and yesterday. Interoperability between managed and unmanaged code pr
ovided by CLR helps developers continue to use necessary COM components and DLLs
.
What is Delegate and what is it used for ?
Delegate is kinda like a pointer to a function in C++ or like an event handler i
n Java
You can use it to multicast which means running multiple functions in different in
stances of object already created.
This is useful when you want your objects to register to an event raised by anothe
r object.
The way it works is the object you are registered to listen to recieves the dele
gate of the function it is supposed to run in your object, the delegate is then
run from it. (if you switch the word delegate for pointer, this would be much si
mpler)
How is meant by DLL ?
A DLL (Dynamic Link Library) is a file that can be loaded and executed by progra
ms dynamically. Basically its an external code repository for programs. Since usu
ally several different programs reuse the same DLL instead of having that code i
n their own file, this dramatically reduces required storage space. A synonym fo
r a DLL would be library.
Which DLL translate XML to SQL in IIS?
Sqlisapi.dll
Can anyone tell me about Secure Socket Layer? How to make use of the technology?
Secure Sockets Layer (SSL) and Transport Layer Security (TLS), its successor, ar
e cryptographic protocols which provide secure communications on the Internet. T
here are slight differences between SSL 3.0 and TLS 1.0, but the protocol remain
s substantially the same. The term SSL as used here applies to both protocols unle
ss clarified by context.

Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
What is the Differnce Between Response.write & response.output.Write
In ASP.NET the Response object is of type HttpResponse and when you say Response
.Write youre really saying (basically) HttpContext.Current.Response.Write and cal
ling one of the many overloaded Write methods of HttpResponse.
Response.Write then calls .Write() on its internal TextWriter object:
public void Write(object obj){ this._writer.Write(obj);}
HttpResponse also has a Property called Output that is of type, yes, TextWriter,
so:
public TextWriter get_Output(){ return this._writer; }
Which means you can to the Response whatever a TextWriter will let you. Now, Tex
tWriters support a Write() method ala String.Format, so you can do this:
Response.Output.Write(Scott is {0} at {1:d}, cool,DateTime.Now);
But internally, of course, this this is happening:
public virtual void Write(string format, params object[] arg)
{
this.Write(string.Format(format, arg));
}
Which dll is required to translate XML to SQL in IIS ?
Microsoft.data.sqlxml.dll
What is an interface and what is an abstract class? Please, expand by examples o
f using both. Explain why.
Answers1:
In a interface class, all methods are abstract without implementation where as i
n an abstract class some methods we can define concrete. In interface, no access
ibility modifiers are allowed. An abstract class may have accessibility modifier
s. Interface and abstract class are basically a set of rules which u have to fol
low in case u r using them(inheriting them).
Answers2:
Abstract classes are closely related to interfaces. They are classes that cannot
be instantiated, and are frequently either partially implemented, or not at all
implemented. One key difference between abstract classes and interfaces is that
a class may implement an unlimited number of interfaces, but may inherit from o
nly one abstract (or any other kind of) class. A class that is derived from an a
bstract class may still implement interfaces. Abstract classes are useful when c
reating components because they allow you specify an invariant level of function
ality in some methods, but leave the implementation of other methods until a spe
cific implementation of that class is needed. They also version well, because if
additional functionality is needed in derived classes, it can be added to the b
ase class without breaking code.
Answers3:
Abstract Classes
An abstract class is the one that is not used to create objects. An abstract cla
ss is designed to act as a base class (to be inherited by other classes). Abstra
ct class is a design concept in program development and provides a base upon whi
ch other classes are built. Abstract classes are similar to interfaces. After de
claring an abstract class, it cannot be instantiated on its own, it must be inher
ited. Like interfaces, abstract classes can specify members that must be impleme
nted in inheriting classes. Unlike interfaces, a class can inherit only one abst
ract class. Abstract classes can only specify members that should be implemented
by all inheriting classes.
Answers4:
An interface looks like a class, but has no implementation. Theyre great for putt
ing together plug-n-play like architectures where components can be interchanged
at will. Think Firefox Plug-in extension implementation. If you need to change
your design, make it an interface. However, you may have abstract classes that p
rovide some default behavior. Abstract classes are excellent candidates inside o
f application frameworks.
Answers5:
One additional key difference between interfaces and abstract classes (possibly
the most important one) is that multiple interfaces can be implemented by a clas
s, but only one abstract class can be inherited by any single class.
Some background on this: C++ supports multiple inheritance, but C# does not. Mul
tiple inheritance in C++ has always be controversial, because the resolution of
multiple inherited implementations of the same method from different base classe
s is hard to control and anticipate. C# decided to avoid this problem by allowin
g a class to implement multiple interfaces, which do not contain method implemen
tations, but restricting a class to have at most a single parent class. Although
this can result in redundant implementations of the same method when different
classes implement the same interface, it is still an excellent compromise.
Another difference between interfaces and abstract classes is that an interface
can be implemented by an abstract class, but no class, abstract or otherwise, ca
n be inherited by an interface.
Answers6:
What is an Abstract class?
An abstract class is a special kind of class that cannot be instantiated. So the
question is why we need a class that cannot be instantiated? An abstract class
is only to be sub-classed (inherited from). In other words, it only allows other
classes to inherit from it but cannot be instantiated. The advantage is that it
enforces certain hierarchies for all the subclasses. In simple words, it is a k
ind of contract that forces all the subclasses to carry on the same hierarchies
or standards.
What is an Interface?
An interface is not a class. It is an entity that is defined by the word Interfa
ce. An interface has no implementation; it only has the signature or in other wo
rds, just the definition of the methods without the body. As one of the similari
ties to Abstract class, it is a contract that is used to define hierarchies for
all subclasses or it defines specific set of methods and their arguments. The ma
in difference between them is that a class can implement more than one interface
but can only inherit from one abstract class. Since C# doesnt support multiple i
nheritance, interfaces are used to implement multiple inheritance.
What is serialization, how it works in .NET?
Serialization is when you persist the state of an object to a storage medium so
an exact copy can be re-created at a later stage.
Serialization is used to save session state in ASP.NET.
Serialization is to copy objects to the Clipboard in Windows Forms
Serialization is used by remoting to pass objects by value from one application
domain to another
What should one do to make class serializable?
Answers1:
To make a class serializable is to mark it with the Serializable attribute as fo
llows.
[Serializable]
public class MyObject {
public int n1 = 0;
public int n2 = 0;
public String str = null;
}
What exactly is being serialized when you perform serialization?
The objects state (values)
How does output caching work in ASP.NET?
Output caching is a powerful technique that increases request/response throughpu
t by caching the content generated from dynamic pages. Output caching is enabled
by default, but output from any given response is not cached unless explicit ac
tion is taken to make the response cacheable.
To make a response eligible for output caching, it must have a valid expiration/
validation policy and public cache visibility. This can be done using either the
low-level OutputCache API or the high-level @ OutputCache directive. When outpu
t caching is enabled, an output cache entry is created on the first GET request
to the page. Subsequent GET or HEAD requests are served from the output cache en
try until the cached request expires.
The output cache also supports variations of cached GET or POST name/value pairs
.
The output cache respects the expiration and validation policies for pages. If a
page is in the output cache and has been marked with an expiration policy that
indicates that the page expires 60 minutes from the time it is cached, the page
is removed from the output cache after 60 minutes. If another request is receive
d after that time, the page code is executed and the page can be cached again. T
his type of expiration policy is called absolute expiration - a page is valid un
til a certain time.
What is connection pooling and how do you make your application use it?
Opening database connection is a time consuming operation.
Connection pooling increases the performance of the applications by reusing the
active database connections instead of create new connection for every request.
Connection pooling Behaviour is controlled by the connection string parameters.
Follwing the the 4 parameters that control most of the connection pooling behavi
our.
1. Connect Timeout
2. Max Pool Size
3. Min Pool Size
4. Pooling

Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
What are different methods of session maintenance in ASP.NET?
3 types:
In-process storage.
Session State Service.
Microsoft SQL Server.
In-Process Storage
The default location for session state storage is in the ASP.NET process itself.
Session State Service
As an alternative to using in-process storage for session state, ASP.NET provide
s the ASP.NET State Service. The State Service gives you an out-of-process alter
native for storing session state that is not tied quite so closely to ASP. Net's
own process.
To use the State Service, you need to edit the sessionState element in your ASP.
NET applications web.config file:
Youll also need to start the ASP.NET State Service on the computer that you speci
fied in the stateConnectionString attribute. The .NET Framework installs this se
rvice, but by default its set to manual startup. If youre going to depend on it fo
r storing session state, youll want to change that to automatic startup by using
the Services MMC plug-in in the Administrative Tools group.
If you make these changes, and then repeat the previous set of steps, youll see s
lightly different behavior: session state persists even if you recycle the ASP.N
ET process.
There are two main advantages to using the State Service. First, it is not runni
ng in the same process as ASP.NET, so a crash of ASP.NET will not destroy sessio
n information. Second, the stateConnectionString thats used to locate the State S
ervice includes the TCP/IP address of the service, which need not be running on
the same computer as ASP.NET. This allows you to share state information across
a web garden (multiple processors on the same computer) or even across a web far
m (multiple servers running the application). With the default in-process storag
e, you cant share state information between multiple instances of your applicatio
n.
The major disadvantage of using the State Service is that its an external process
, rather than part of ASP.NET. That means that reading and writing session state
is slower than it would be if you kept the state in-process. And, of course, its
one more process that you need to manage. As an example of the extra effort tha
t this can entail, there is a bug in the initial release of the State Service th
at allows a determined attacker to crash the ASP.NET process remotely. If youre u
sing the State Service to store session state, you should install the patch from
Microsoft Security Bulletin MS02-66, or install SP2 for the .NET Framework.
Microsoft SQL Server
The final choice for storing state information is to save it in a Microsoft SQL
Server database. To use SQL Server for storing session state, you need to perfor
m several setup steps:
Run the InstallSqlState.sql script on the Microsoft SQL Server where you intend
to store session state. This script will create the necessary database and datab
ase objects. The .NET Framework installs this script in the same folder as its c
ompilers and other toolsfor example, C:\WINNT\Microsoft.NET\Framework\v1.0.3705 o
n a Windows 2000 computer with the 1.0 version of the Framework. Edit the sessio
nState element in the web.config file for your ASP.NET application as follows:

Supply the server name, user name, and password for a SQL Server account that ha
s access to the session state database in the sqlConnectionString attribute.
Like the State Service, SQL Server lets you share session state among the proces
sors in a web garden or the servers in a web farm. But you also get the addition
al benefit of persistent storage. Even if the computer hosting SQL Server crashe
s and is restarted, the session state information will still be present in the d
atabase, and will be available as soon as the database is running again. Thats be
cause SQL Server, being an industrial-strength database, is designed to log its
operations and protect your data at (almost) all costs. If youre willing to inves
t in SQL Server clustering, you can keep the session state data available transp
arently to ASP.NET even if the primary SQL Server computer crashes.
Like the State Service, SQL Server is slower than keeping session state in proce
ss. You also need to pay additional licensing fees to use SQL Server for session
state in a production application. And, of course, you need to worry about SQL
Server-specific threats such as the Slammer worm.
What is Viewstate?
A server controls view state is the accumulation of all its property values. In o
rder to preserve these values across HTTP requests, ASP.NET server controls use
this property, which is an instance of the StateBag class, to store the property
values.
Can any object be stored in a Viewstate?
An object that either is serializable or has a TypeConverter defined for it can
be persisted in ViewState
What should you do to store an object in a Viewstate?
Do serialization of convert the object to string
Explain how Viewstate is being formed and how its stored on client.
The type of ViewState is System.Web.UI.StateBag, which is a dictionary that stor
es name/value pairs. ViewState is persisted to a string variable by the ASP.NET
page framework and sent to the client and back as a hidden variable. Upon postba
ck, the page framework parses the input string from the hidden variable and popu
lates the ViewState property of each control. If a control uses ViewState for pr
operty data instead of a private field, that property automatically will be pers
isted across round trips to the client. (If a property is not persisted in ViewS
tate, it is good practice to return its default value on postback.)
What do you know about ADO.NETs objects and methods?
ADO.NET provides consistent access to data sources such as Microsoft SQL Server,
as well as data sources exposed through OLE DB and XML.
Data-sharing consumer applications can use ADO.NET to connect to these different
data sources and retrieve, manipulate, and update data.
ADO.NET provides first-class support for the disconnected, n-tier programming en
vironment for which many new applications are written.
Explain DataSet.AcceptChanges and DataAdapter.Update methods.
DataAdapter.Update method Calls the respective INSERT, UPDATE, or DELETE stateme
nts for each inserted, updated, or deleted row in the DataSet.
DataSet.AcceptChanges method Commits all the changes made to this row since the
last time AcceptChanges was called.
When we go for html server controls and when we go for web server controls?
Server controls are a part of ASP.net. When a server control is used there will
be an extra overhead on the server to create the control at runtime and accordin
gly set the values. HTML controls are static controls and are easy to use. They
are supported is ASP.net.
As a rule, if there is a corresponding HTML control available instead of the ser
ver control, you should always go for the HTML control as it enhances the server
performance and ensures faster response. Server controls should be used when it
is found that the available HTML controls are not sufficient to achieve the tas
k.

Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
How many languages .NET is supporting now?
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and P
erl, etc. 44 languages are supported.
How is .NET able to support multiple languages?
A language should comply with the Common Language Runtime standard to become a .
NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL
for short). This is called as Managed Code. This Managed code is run in .NET en
vironment. So after compilation to this IL the language is not a barrier. A code
can call or use a function written in another language.
How ASP .NET different from ASP?
Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can
be executed on the server.
What is smart navigation?
The cursor position is maintained when the page gets refreshed due to the server
side validation and the page gets refreshed.
What is view state?
The web is stateless. But in ASP.NET, the state of a page is maintained in the i
n the page itself automatically. How? The values are encrypted and saved in hidd
en controls. this is done automatically by the ASP.NET. This can be switched off
/ on for a single control
How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for this. We have Range Validat
or, Email Validator.
Can the validation be done in the server side? Or this can be done only in the C
lient side?
Client side is done by default. Server side validation is also possible. We can
switch off the client side and server side can be done.
How to manage pagination in a page?
Using pagination option in DataGrid control. We have to set the number of record
s for a page, then it takes care of pagination by itself.
What is ADO .NET and what is difference between ADO and ADO.NET?
ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory
database where in I can use relationships between the tables and select insert a
nd updates to the database. I can update the actual database as a batch.
Explain the differences between Server-side and Client-side code?
Server side scripting means that all the script will be executed by the server a
nd interpreted as needed. ASP doesnt have some of the functionality like sockets,
uploading, etc. For these you have to make a custom components usually in VB or
VC++. Client side scripting means that the script will be executed immediately
in the browser such as form field validation, clock, email validation, etc. Clie
nt side scripting is usually done in VBScript or JavaScript. Download time, brow
ser compatibility, and visible code - since JavaScript and VBScript code is incl
uded in the HTML page, then anyone can see the code by viewing the page source.
Also a possible security hazards for the client computer.
What type of code (server or client) is found in a Code-Behind class?
C#
Should validation (did the user enter a real date) occur server-side or client-s
ide? Why?
Client-side validation because there is no need to request a server side date wh
en you could obtain a date from the client machine.
What does the "EnableViewState" property do? Why would I want it on or off?
Enable ViewState turns on the automatic state management feature that enables se
rver controls to re-populate their values on a round trip without requiring you
to write any code. This feature is not free however, since the state of a contro
l is passed to and from the server in a hidden form field. You should be aware o
f when ViewState is helping you and when it is not. For example, if you are bind
ing a control to data on every round trip (as in the datagrid example in tip #4)
, then you do not need the control to maintain its view state, since you will wip
e out any re-populated data in any case. ViewState is enabled for all server con
trols by default. To disable it, set the EnableViewState property of the control
to false.
What is the difference between Server.Transfer and Response.Redirect?
Why would I choose one over the other? Server.Transfer() : client is shown as it
is on the requesting page only, but the all the content is of the requested pag
e. Data can be persist across the pages using Context.Item collection, which is
one of the best way to transfer data from one page to another keeping the page s
tate alive. Response.Dedirect() :client know the physical location (page name an
d query string as well). Context.Items loses the persistence when navigate to de
stination page. In earlier versions of IIS, if we wanted to send a user to a new
Web page, the only option we had was Response.Redirect. While this method does
accomplish our goal, it has several important drawbacks. The biggest problem is
that this method causes each page to be treated as a separate transaction. Besid
es making it difficult to maintain your transactional integrity, Response.Redire
ct introduces some additional headaches. First, it prevents good encapsulation o
f code. Second, you lose access to all of the properties in the Request object.
Sure, there are workarounds, but theyre difficult. Finally, Response.Redirect nec
essitates a round trip to the client, which, on high-volume sites, causes scalab
ility problems. As you might suspect, Server.Transfer fixes all of these problem
s. It does this by performing the transfer on the server without requiring a rou
ndtrip to the client.
Can you give an example of when it would be appropriate to use a web service as
opposed to a non-serviced .NET component?
When to Use Web Services:
* Communicating through a Firewall When building a distributed application with
100s/1000s of users spread over multiple locations, there is always the problem
of communicating between client and server because of firewalls and proxy server
s. Exposing your middle tier components as Web Services and invoking the directl
y from a Windows UI is a very valid option.
* Application Integration When integrating applications written in various langu
ages and running on disparate systems. Or even applications running on the same
platform that have been written by separate vendors.
* Business-to-Business Integration This is an enabler for B2B integration which
allows one to expose vital business processes to authorized supplier and custome
rs. An example would be exposing electronic ordering and invoicing, allowing cus
tomers to send you purchase orders and suppliers to send you invoices electronic
ally.
* Software Reuse This takes place at multiple levels. Code Reuse at the Source c
ode level or binary component-based reuse. The limiting factor here is that you
can reuse the code but not the data behind it. Webservice overcome this limitati
on. A scenario could be when you are building an app that aggregates the functio
nality of several other Applications. Each of these functions could be performed
by individual apps, but there is value in perhaps combining the multiple apps t
o present a unified view in a Portal or Intranet.
* When not to use Web Services: Single machine Applications When the apps are ru
nning on the same machine and need to communicate with each other use a native A
PI. You also have the options of using component technologies such as COM or .NE
T Components as there is very little overhead.
* Homogeneous Applications on a LAN If you have Win32 or Winforms apps that want
to communicate to their server counterpart. It is much more efficient to use DC
OM in the case of Win32 apps and .NET Remoting in the case of .NET Apps.

Author: Amit Shah Member Level: Gold Member Rank: 0 Date: 13/Jan/
2009 Rating: Points: 6
Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
In ADO, the in-memory representation of data is the RecordSet. In ADO.NET, it is
the dataset. There are important differences between them.
* A RecordSet looks like a single table. If a recordset is to contain data from
multiple database tables, it must use a JOIN query, which assembles the data fro
m the various database tables into a single result table. In contrast, a dataset
is a collection of one or more tables. The tables within a dataset are called d
ata tables; specifically, they are DataTable objects. If a dataset contains data
from multiple database tables, it will typically contain multiple DataTable obj
ects. That is, each DataTable object typically corresponds to a single database
table or view. In this way, a dataset can mimic the structure of the underlying
database. A dataset usually also contains relationships. A relationship within a
dataset is analogous to a foreign-key relationship in a database that is, it ass
ociates rows of the tables with each other. For example, if a dataset contains a
table about investors and another table about each investors stock purchases, it
could also contain a relationship connecting each row of the investor table wit
h the corresponding rows of the purchase table. Because the dataset can hold mul
tiple, separate tables and maintain information about relationships between them
, it can hold much richer data structures than a recordset, including self-relat
ing tables and tables with many-to-many relationships.
* In ADO you scan sequentially through the rows of the recordset using the ADO M
oveNext method. In ADO.NET, rows are represented as collections, so you can loop
through a table as you would through any collection, or access particular rows
via ordinal or primary key index. DataRelation objects maintain information abou
t master and detail records and provide a method that allows you to get records
related to the one you are working with. For example, starting from the row of t
he Investor table for "Nate Sun," you can navigate to the set of rows of the Pur
chase table describing his purchases. A cursor is a database element that contro
ls record navigation, the ability to update data, and the visibility of changes
made to the database by other users. ADO.NET does not have an inherent cursor ob
ject, but instead includes data classes that provide the functionality of a trad
itional cursor. For example, the functionality of a forward-only, read-only curs
or is available in the ADO.NET DataReader object. For more information about cur
sor functionality, see Data Access Technologies.
* Minimized Open Connections: In ADO.NET you open connections only long enough t
o perform a database operation, such as a Select or Update. You can read rows in
to a dataset and then work with them without staying connected to the data sourc
e. In ADO the recordset can provide disconnected access, but ADO is designed pri
marily for connected access. There is one significant difference between disconn
ected processing in ADO and ADO.NET. In ADO you communicate with the database by
making calls to an OLE DB provider. In ADO.NET you communicate with the databas
e through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter,
or OracleDataAdapter object), which makes calls to an OLE DB provider or the API
s provided by the underlying data source. The important difference is that in AD
O.NET the data adapter allows you to control how the changes to the dataset are
transmitted to the database by optimizing for performance, performing data valid
ation checks, or adding any other extra processing. Data adapters, data connecti
ons, data commands, and data readers are the components that make up a .NET Fram
ework data provider. Microsoft and third-party providers can make available othe
r .NET Framework data providers that can be integrated into Visual Studio.
* Sharing Data Between Applications. Transmitting an ADO.NET dataset between app
lications is much easier than transmitting an ADO disconnected recordset. To tra
nsmit an ADO disconnected recordset from one component to another, you use COM m
arshalling. To transmit data in ADO.NET, you use a dataset, which can transmit a
n XML stream.
* Richer data types.COM marshalling provides a limited set of data types those d
efined by the COM standard. Because the transmission of datasets in ADO.NET is b
ased on an XML format, there is no restriction on data types. Thus, the componen
ts sharing the dataset can use whatever rich set of data types they would ordina
rily use.
* 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 th
e network also rises. Both ADO and ADO.NET let you minimize which data is transm
itted. But ADO.NET offers another performance advantage, in that ADO.NET does no
t 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.
* Penetrating Firewalls.A firewall can interfere with two components trying to t
ransmit disconnected ADO recordsets. Remember, firewalls are typically configure
d to allow HTML text to pass, but to prevent system-level requests (such as COM
marshalling) from passing.
Can you give an example of what might be best suited to place in the Application
_Start and Session_Start subroutines?
The Application_Start event is guaranteed to occur only once throughout the life
time of the application. Its a good place to initialize global variables. For exa
mple, you might want to retrieve a list of products from a database table and pl
ace the list in application state or the Cache object. SessionStateModule expose
s both Session_Start and Session_End events.
If Im developing an application that must accomodate multiple security levels tho
ugh secure login and my ASP.NET web appplication is spanned across three web-ser
vers (using round-robbin load balancing) what would be the best approach to main
tain login-in state for the users?
What are ASP.NET Web Forms? How is this technology different than what is availa
ble though ASP?
Web Forms are the heart and soul of ASP.NET. Web Forms are the User Interface (U
I) elements that give your Web applications their look and feel. Web Forms are s
imilar to Windows Forms in that they provide properties, methods, and events for
the controls that are placed onto them. However, these UI elements render thems
elves in the appropriate markup language required by the request, e.g. HTML. If
you use Microsoft Visual Studio .NET, you will also get the familiar drag-and-dr
op interface used to create your UI for your Web application.
How does VB.NET/C# achieve polymorphism?
By using Abstract classes/functions.
Can you explain what inheritance is and an example of when you might use it?
Inheritance is a fundamental feature of an object oriented system and it is simp
ly the ability to inherit data and functionality from a parent object. Rather th
an developing new objects from scratch, new code can be based on the work of oth
er programmers, adding only new features that are needed.
How would you implement inheritance using VB.NET/C#?
When we set out to implement a class using inheritance, we must first start with
an existing class from which we will derive our new subclass. This existing cla
ss, or base class, may be part of the .NET system class library framework, it ma
y be part of some other application or .NET assembly, or we may create it as par
t of our existing application. Once we have a base class, we can then implement
one or more subclasses based on that base class. Each of our subclasses will aut
omatically have all of the methods, properties, and events of that base class ?
including the implementation behind each method, property, and event. Our subcla
ss can add new methods, properties, and events of its own - extending the origin
al interface with new functionality. Additionally, a subclass can replace the me
thods and properties of the base class with its own new implementation - effecti
vely overriding the original behavior and replacing it with new behaviors. Essen
tially inheritance is a way of merging functionality from an existing class into
our new subclass. Inheritance also defines rules for how these methods, propert
ies, and events can be merged.
What's 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 a
re 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 o
f type implementations. To the runtime, a type does not exist outside the contex
t of an assembly.
Describe the difference between inline and code behind - which is best in a loos
ely 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 compile
d the first time the page is requested on the server. Page logic code that is wr
itten 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 versio
ns of data elements. The DataSet uses the DiffGram format to load and persist it
s contents, and to serialize its contents for transport across a network connect
ion. 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 s
chema, of the DataSet, including column values from both the Original and Curren
t 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.NETs most useful features is the extensibility of the HTTP pipeline, t
he path that data takes between client and server. You can use them to extend yo
ur ASP.NET applications by adding pre- and post-processing to each HTTP request
coming into your application. For example, if you wanted custom authentication f
acilities for your application, the best technique would be to intercept the req
uest when it comes in and process the request in a custom HTTP module.
In what order do the events of an ASPX page execute. As a developer is it import
ant to understand 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 dat
aset 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);
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 ot
her row (alternating items) in the Repeater control. You can specify a different
appearance for the AlternatingItemTemplate element by setting its style propert
ies.
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 th
e 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 users session?
The Abandon method destroys all the objects stored in a Session object and relea
ses their resources.
If you do not call the Abandon method explicitly, the server destroys these obje
cts 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 s
erver. When true, this property instructs the client application not to save the
Cookie on the users hard disk when a session ends.
Which two properties are on every validation control?
ControlToValidate & ErrorMessage properties
How do you create a permanent cookie?
Setting the Expires property to MinValue means that the Cookie never expires.
Which method do you use to redirect the user to another page without performing
a round trip to the client?
Server.transfer()

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close