Escolar Documentos
Profissional Documentos
Cultura Documentos
Contents 1
1.Difference between Framework 2.0, 3.0 and 3.5? 2
2.What is WCF? 2
3.What Contracts are available in WCF? 2
4.What is WPF? 3
5.What is WWF? 3
6.How many states in WWF? 3
7.How to assign the Master page to existing .aspx page? 3
8.How to handle the Browser back button in .aspx page? 3
9.How to assign the User control to existing .aspx page? 4
10.Shall we use WCF in WWF? 4
11.Which Ajax controls you have used in your project? 4
12.What is Configuration management? 4
Software configuration management 5
13.What is Software development life cycle? 6
14.What Phases are available in SDLC? 6
15.Tell me about integration tool which you have used till now? 6
16.What is unit testing? 6
17.What is XAML? 6
18.What is endpoint in WCF? 6
19.What is session management? 7
20.About Master pages 7
21.What are the different bindings we have in wcf? 7
22.What are the contracts in wcf? 7
23.2.0 and 3.0 framework features 7
24.Asp.net 3.5 newly added controls. 8
25.What is entity framework? 8
26.What is session state? 8
27.What are the objects of ado.net? 8
28.What is hibernate? 9
29.What is workflow? 9
30.What is vsts? 9
31.What is code review? 9
32.Explain the page life cycle in asp.net. 9
33.What is the difference between http and https? 10
34.Do querystring/sessions Provide security. 10
35.While consuming wcf from wwf, how can we make wcf methods not accessible from wwf?
10
36.What is the difference between dll and a web service? 10
37.What is .net Framework entity model? 10
38.How can u implement Cross page post back? 10
39.What is wwf? 10
40.For a search criteria you are showing the data in a grid, what are the possible ways u can
minimize the space occupied by grid in aspx page. 11
41.what are the things going to happen when using response object. 11
42.How can u handle the exception? 11
43.What are the different ways of handling exceptions? 11
44. How can u handle particular type of exception? 11
45. What are stored procedures? 11
46. What are different types of contracts in wcf? 11
47.How to use a user control in aspx page? 11
48. What is the order of events fired when user control is used in aspx? 11
49.What is the name to be given for a web service developed so that it can be used by an
application? 12
50.What is User control 12
51.Differences between User control and custom control 12
52.New controls in .net 3.0 12
53.Healthcare system 13
54.How to kill session 13
55.Hibernate 13
56.New controls in .NET 3.5 13
57.Vss 13
58.Connection architectures in ADO.Net, How do you technically define? 14
59.Data reader and dataset differences 14
60..net 2.0 architecture 15
61.I am using a dataset to get some data, I want to bind this dataset to a gridview, Gridview
has button and textboxes, On clicking button, I want to get data in gridview textboxes, How
do you perform this. 15
62.About views sql server 15
63.Difference between session and cookie 15
64.Can I use master page to an existing .aspx with <form><div> tags? 15
65. one user logged into a system, a session has created, the same user logged into another
system, I want to kill session and create new session for that user, How do you do this. 15
66.How to count number of hits to application 15
67.What is Global.asax and what are events? 16
68.Tell about updatepanel 16
69.What is Global.asax and what are events? 16
70.What are the different types of Assemblies? 16
71.About VSTS(Visual Studio Team System) 16
72.Advantage of using Ajax in asp.net? 16
73.New controls in .NET 3.5 17
74.What is User control ? 17
75. New controls in .net 3.0. 17
76.Difference between Framework 2.0, 3.0 and 3.5? 17
77.What is WCF? 17
78.What Contracts are available in WCF? 17
79.What is WPF? 18
80.What is WWF? 18
81.Which Ajax controls are you have used in your project? 18
82.What is unit testing? 19
83.What is XAML? 19
84.What is endpoint in WCF? 19
85.What are asp.net page life cycle events 19
86.What is encapsulation 20
87.What is a sealed class 20
88.What are access specifiers 21
89.What is Virtual Method 21
90.What is a command object 21
91.Can we fire trigger in asp.net instead of a stored procedure 21
92.How to dispose an object from garbage collector? 21
93.What is global.asax? 21
94.What is placed in webpage to work with Ajax controls? 21
95.What is the use of Script Manager? 22
96.In case we disabled pop- ups for a browser does model pop up works. 22
97.What is Copy and Clone in .net 22
98.Difference between Data contract and Service Contract. 22
99.Whether any changes take place when you add wcf service in webconfiguration file. 23
100.Can we assign execute reader to Data Reader while fetching records? 24
101.How do you handle Exceptions in your applications? 24
102.Tell about StateMachine Activity with an Example. 25
103.What is Assembly? 25
104.What is difference between .dll and .exe? 25
105.What are the different types of Assemblies? 25
106.What are the steps to make a assembly as shared? 26
107.What are the classes in Ado.net? 26
108.What are the methods for Command class object? 27
109.What are the return types of Execute Scalar, Execute Non Query and Execute Reader?27
110.What are the differences between Html controls and Web Server Controls? 27
111.Tell me about Views in Sql server. 27
112.What is a trigger? 28
113.What are new features added in Sqlserver2005? 28
114.Tell me About Web parts? 29
115.Validation controls in ASP.Net? 30
116.How to use activities in wwf? 30
117.How to create only one instance of application for each user? 30
118.ASP.NET AJAX Advantage 31
119.What are the classes that are supported by .net for wpf application? 32
120.What are Master Pages and why we use it? 32
121.What is state management? 32
122.How to maintain the state for a particular user? 32
123.How many ways can you maintain information in session? 32
124.Difference between client side state management and server side state management?32
125.What is web service? 32
126.Main difference between web services and WCF? 33
127.What are the classes that are supported by .net for wpf application? 33
128.How many normal forms are there? Explain it? 34
129.Explain about AJAX ?What are Diff B/w AJAX Controls and Normal controls? 35
130.Difference b/w Skins and Style Sheets? 35
131.Explain master page? 36
132.Explain Asp.net page life cycle? 36
133.What is Hidden field? 37
134.Draw the .net Framework architecture? 38
135. What is JIT compiler when it will be called? 38
136.Difference between view state and session.
137.What is inproc session.
138. What are triggers and stored procedures in ADO.Net?
139. What is messagecontract ?why do we use it?
140.Difference between Web services and WCF services.
141.What is Connection Pooling?
142.The most complex control used by you
143.Difference between master page and frames.
144How to pass a view state variable from page1 to page2.
145. What is fault contract?
146.How to insert bulk of records?
148.How to handle, when session time out to redirect a page to login without a user
interaction?
149.How to update multiple tables data modifications in the database from front end?
150.Which dll is used for ajax?
151.What do you know about transactions?
152.User Control scenarios.
153.Diff between Array and Generic List.
154.How do you make transactions using WCF?
155.How can i Expose 4 methods out of 10 methods in WCF service?
156.How do you display standard message across the application?
157.I have 4 websites in a solution where can i place a web.config file i,e website level or
solution level?
158.Which event of gridview fires when we click on gridview row?
159.Is possible tostore the hashtable into session?
160.session capacity of Storing data?
161. crosspaging using view state?
162.web.config uses?
163.Crystal reports?
164.master page advantages?
165. XMLHTTP Request?
166.what is view?why we need view?
167.How you handle exceptions if we have 3 standard errors?
168.which grid event will use when you click on pariticular row?
169.is datacontract compasary in WCF?
170.different contract in wcf? Explain theose?
171.what is camel case?what is pascal case?
172.write a query usin linq?
173.what si var in linq query?
174.why use linq lambdaexpression(Advantage)
175.How to know which datarow was updated in datatable?
176.why we write different bindings in wcf?
177.what is processing of updating Gridview?
178.Crystal reports?
179.Ssrs Reports?
180.What is entity?
Interview Questions with Answers
.NET 3.0
.NET 3.5
2. What is WCF?
WCF stands for Windows Communication Foundations.
WCF combines the functionality from ASP.NET Web Services, .NET Remoting,
Message Queuing and Enterprise Services.
4. What is WPF?
Windows Presentation Foundation
The Windows Presentation Foundation (or WPF), formerly code-named Avalon, is a
graphical subsystem in .NET Framework 3.0 (formerly called WinFX)[1], which uses a
markup language, known as XAML for rich user interface development. [2] WPF is
included with Windows Vista and Windows Server 2008, and is also available for
Windows XP Service Pack 2 or later, and Windows Server 2003. It provides a
consistent programming model for building applications and provides a clear
separation between the user interface and the business logic. A WPF application can
be deployed on the desktop or hosted in a web browser. It also enables rich control,
design, and development of the visual aspects of Windows programs. It aims to unify
a number of application services: user interface, 2D and 3D drawing, fixed and
adaptive documents, advanced typography, vector graphics, raster graphics,
animation, data binding, audio and video. Although WinForms will continue to be
widely used, and Microsoft has created only a few WPF applications, the company
promotes WPF for line-of-business applications
5. What is WWF?
WWF is a programming model for building workflow-enabled applications on windows.
System. Workflow namespace has all the necessary modules to develop any type of workflow.
There are two basics type of workflow Sequential Workflow and State machines workflow.
A sequential workflow has clear start and finish boundaries. Workflow controls execution in
Sequential workflow. In sequential execution, one task is executed after other. Sequential
workflow is more rigid in format and execution path has a determistic nature.
A State machine workflow is more dynamic in nature. Workflow has states and the state waits
for events to help it move to next state. In State machine execution path is undetermestic
nature
* The software concept - identifies and defines a need for the new system
* A requirements analysis - analyzes the information needs of the end users
* The architectural design - creates a blueprint for the design with the necessary
specifications for the hardware, software, people and data resources
* Coding and debugging - creates and programs the final system
* System testing - evaluates the system's actual functionality in relation to expected
or intended functionality.
15. Tell me about integration tool which you have used till now?
SVC tool
Unit testing is done in different ways. Some programmers write simple test applications to
test their own code. Some others simply debug the code and change the values during
debugging to make sure the code works fine for different cases.
- Quality department does different tests, they are not unit tests.
- Every programmer must do unit testing after finishing development or during development
itself.
- Unit testing can be done by writing separate test applications to call your classes and
methods to make sure the classes work as expected. This is called manual unit testing.
- Unit testing can be automated by writing unit test scripts. This is called Automated Unit
Testing.
- In automated Unit Testing, after writing each class/method, you will write several Test
methods to test the actual code. The test method will call your actual class/method with
some sample inouts and compare the result with expected result. If the actual result from
your code is same as the expected result, the Unit Test will record the result as "Success".
Otherwise the test result will be recorded as "Fail". All of the unit test scripts can be
executed together and you can get a summary of all results.
- Automated Unit test scripts can be saved and easily repeated so that everytime someone
make a change in the project, hundreds of automated unit tests can be executed in few
seconds to make sure that every piece of code is still working as expected.
- NUnit is one of the most popular automated unit testing tool for .NET applications
State management is the process by which you maintain state and page information over
multiple requests for the same or different pages.
a. View State – Asp.Net uses View State to track the values in the Controls. You can add
custom values to the view state. It is used by the Asp.net page framework to automatically
save the values of the page and of each control just prior to rendering to the page. When
the page is posted, one of the first tasks performed by page processing is to restore view
state.
b. Control State – If you create a custom control that requires view state to work properly,
you should use control state to ensure other developers don’t break your control by
disabling view state.
c. Hidden fields – Like view state, hidden fields store data in an HTML form without
displaying it in the user's browser. The data is available only when the form is processed.
d. Cookies – Cookies store a value in the user's browser that the browser sends with every
page request to the same server. Cookies are the best way to store state data that must be
available for multiple Web pages on a web site.
e. Query Strings - Query strings store values in the URL that are visible to the user. Use
query strings when you want a user to be able to e-mail or instant message state data with
a URL.
b. Session State – Session State information is available to all pages opened by a user
during a single visit.
Both application state and session state information is lost when the application restarts. To
persist user data between application restarts, you can store it using profile properties.
35.While consuming wcf from wwf, how can we make wcf methods not
accessible from wwf?
Ans: remove operation contract for the methods in wcf which are not to be used in
wwf.
40.For a search criteria you are showing the data in a grid, what are the
possible ways u can minimize the space occupied by grid in aspx page.
Ans: paging and caching can be done for the grid.
41. what are the things going to happen when using response object.
Ans : response object has different methods like redirect,write,write file………
48. What is the order of events fired when user control is used in aspx?
Ans:load and then prerender
49.What is the name to be given for a web service developed so that it can
be used by an application?
Ans:ADD Service reference/or webservice webmethods.
● A TagName attribute, which associates a name with the user control. This
name will be included in the opening tag of the user control element.
● A Src attribute, which defines the virtual path to the user control file that you
are including.
55. Hibernate
Ans: NHibernate is a port of Hibernate Core for Java to the .NET Framework. It
handles persisting plain .NET objects to and from an underlying relational database.
Given an XML description of your entities and relationships, NHibernate
automatically generates SQL for loading and storing the objects. Optionally, you can
describe your mapping metadata with attributes in your source code.
NHibernate supports transparent persistence, your object classes don't have to
follow a restrictive programming model. Persistent classes do not need to implement
any interface or inherit from a special base class. This makes it possible to design
the business logic using plain .NET (CLR) objects and object-oriented idiom.
61.I am using a dataset to get some data, I want to bind this dataset to a
gridview, Gridview has button and textboxes, On clicking button, I want to
get data in gridview textboxes, How do you perform this.
Ans: Through Gridview_RowCommand event
64. Can I use master page to an existing .aspx with <form><div> tags?
Ans:No,you have to remove these tags
65. one user logged into a system, a session has created, the same user
logged into another system, I want to kill session and create new session for
that user, How do you do this.
Ans: By using the session_start event from Global.asax file.
Generics
Anonymous methods
Partial class
Nullable type
The new API gives a fine grain control on the behavior of the runtime with regards to
multithreading, memory allocation, assembly loading and more
Full 64-bit support for both the x64 and the IA64 hardware platforms
New personalization features for ASP.NET, such as support for themes, skins and
webparts.
.NET Micro Framework
81. Which Ajax controls are you have used in your project?
ModalPopUpExtender
DragDropExtender
AlwaysVisibleControlExtender
NumericUpDownExtender
HoverMenuExtender
CollasiblePanelExtender
CalenderExtender
Accordion
TextBoxWaterMarkExtender.
All you can do in XAML can also be done in code. XAML ist just another way to create
and initialize objects. You can use WPF without using XAML. It's up to you if you
want to declare it in XAML or write it in code.
Class parent
{
virtual void hello()
{ Console.WriteLine(“Hello from Parent”); }
}
96. In case we disabled pop- ups for a browser does model pop up works.
Yes
[ServiceContract]
interface IMyContract
[OperationContract]
string MyMethod( );
Data contracts
Define which data types are passed to and from the service. WCF defines implicit
contracts for built-in types such as int and string, but we can easily define explicit
opt-in data contracts for custom types.
[DataContract]
class Contact
[DataMember]
[DataMember]
If DataMember attributes are not specified for a properties in the class, that property
can't be passed to-from web service.
99.Whether any changes take place when you add wcf service in
webconfiguration file.
you can configure the service endpoints in the application configuration file or, in the
case of an ASP.NET hosted service, in the web.config file. To do so, you need a
<system.serviceModel> configuration section with a <services> subsection that
contains a <service> element for each service your application is hosting. The
configured service class is identified by the serviceType attribute.
Each endpoint that the service shall expose is configured with an <endpoint>
element beneath the respective <service> element. The address attribute specifies
the network address of the service, the bindingSectionName refers to the
predefined or custom binding to be used and the contractType points to the
interface class that hold the WCF [ServiceContract] for the endpoint contract. If a
class implements multiple service contracts, you must configure an endpoint for each
contract and all contracts must reside at distinct network addresses. A contract
implementation for which no endpoint is configured is not reachable—everything is
explicit.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.serviceModel>
<services>
<service serviceType="SelfHostedService.People">
<endpoint address="http://localhost:8080/people"
bindingSectionName="basicProfileBinding"
contractType="SelfHostedService.IPeople"/>
</service>
</services>
</system.serviceModel>
</configuration>
100. Can we assign execute reader to Data Reader while fetching records?
You have to close Execute reader as dr.close();
The try and catch block are mandatory for handling exceptions. Finally, the block is
optional.
}
}
The first step is just compile your source code so that you will get .Net Module or DLL
The Second step is to generate a key file, which contains unique Assembly name
How can one create a unique Assembly name? Let us see
Microsoft now uses a public-private key pair to uniquely identify an assembly. These
keys are generated by using a utility called SN.exe (SN stands for shared name).
Issue the following command at the command prompt
sn -k mykeyfile.snk
Now your key file is ready and is stored in the same folder
After generating the strong name key pair file, it is required to associate this file with
our assembly, for doing that you have to add the following lines in the code of your
assembly.
Using System.Reflection;
namespace SampleAssembly
Note here that the information regarding the file containing the strong name key pair
is placed in the code file before the namespace declaration. Also you are required to
import the System.Reflection namespace in order for the statement to work,
otherwise the compiler would be showing you an error stating that it does not
recognize the statement.
csc SampleApplGAC.cs /t:library /a.keyfile:sample.key
After compiling the assembly with the statements, containing the strong name
information being added to it, you now have to place the assembly into the GAC. You
can either do it manually by simply copying and pasting the assembly into the GAC,
which is located at;
c:\winnt\assembly
or you can also use a utility gacutil that is installed with the .NET framework. For
adding an assembly you would write as follows on the command prompt.
gacutil /i sample.dll
Here the /i option is for installation. And for removing an assembly from the GAC,
you can use the same utility as follows.
gacutil /u sample.dll
The /u option here is for uninstalling or removing an assembly from the cache.
109. Whatare the return types of Execute Scalar, Execute Non Query and
Execute Reader?
ExecuteScalar returns object
ExecuteNonQuery returns Integer type
ExecuteReader returns DataReader
110. What are the differences between Html controls and Web Server
Controls?
Web Server Controls are group of controls derived directly from the
System.Web.UI.WebControls base class. They are reusable components that can
perform function as the ordinary HTML controls, the real advantage of web controls
is that they are programmable.. ie they can treated and accessed the same way as
any other .NET classes. They therefore repond to events, have methods /functions
and can basically do all that other .NET classes can do. The main isuue to note is
that the processing of these controls is done on the server. Consider:
<asp:Button id="MyButton" runat="server" Text="This is Zimcoder's button"/>
the key attribute is the "runat" which is set to the value "server" , this is their default value
Web Server Controls are rendered as standard html to client browsers thus abracting the
functionality. They also make it easy to deal with complex controls such as the Calendar
control which would be hell to implement in html!
HTML server controls map directly to html tags. They are defined in
System.Web.UI.HtmlControls namespace. The base class is
System.Web.UI.HtmlControls.HtmlControl. Html tags are converted to Html server controls
by including the runat attribute in their declaration and setting it to server. Consider
te only difference between this tag declaration and that of a normal html button tag is the
runat attribute.
Although these two categories may have overlapping functionality and may be even used
synonymously they have important differences. such as
1)HTMl s conctrols offer one to one mapping with html tags .. no abstraction, Web s
controls do not necessarily map to any html tag .. eg calendar control.
2)Html attributes are not stronly typed to html s controls.. web s controls have strongly
typed attributes making for easier access to methods and properties of the base class.
3)Html s controls do not distinguish between browsers though are not always rendered in a
predictable way across browsers.. Web s controls were designed with this in mind.
Once you have defined a view, you can reference it like any other table in a database. A
view erves as a security mechanism.
Syntax
There are two different types of triggers in SQL Server. They are INSTEAD OF
triggers and AFTER triggers. These triggers differ from each other in terms of their
purpose and when they are fired.
113. What are new features added in Sqlserver2005?
Top 10 Features for Database Administration
Feature Description
Database Mirroring
Extend log shipping capabilities with the database mirroring solution. You will be able to use
database mirroring to enhance availability of your SQL Server systems by setting up
automatic failover to a standby server.
Online Restore
With SQL Server 2005, database administrators are able to perform a restore operation
while an instance of SQL Server is running. Online restore improves the availability of SQL
Server because only the data being restored is unavailable; the rest of the database
remains online and available.
Fast Recovery
A new faster recovery option improves availability of SQL Server databases. Administrators
can reconnect to a recovering database after the transaction log has been rolled forward.
Snapshot Isolation
Snapshot Isolation (SI) level is provided at the database level. With SI, users can access the
last committed row using a transitionally consistent view of the database. This capability
provides greater scalability.
Data Partitioning
Data partitioning is enhanced with native table and index partitioning that enables efficient
manageability of large tables and indexes.
Replication Enhancements
For distributed databases, SQL Server 2005 provides comprehensive schema change (DDL)
replication, next-generation monitoring capabilities, built in replication from Oracle to SQL
Server, merge replication over https, and significant merge replication scalability and
performance improvements. Additionally, the peer-to-peer transactional replication feature
improves support for data scale out using replication.
Type of
validation Control to use Description
Required RequiredFieldValidator Ensures that the user does not skip an
entry entry. For details, see How to: Validate
Required Entries for ASP.NET Server
Controls.
Comparison CompareValidator Compares a user's entry against a
to a value constant value, against the value of
another control (using a comparison
operator such as less than, equal, or
greater than), or for a specific data type.
For details, see How to: Validate Against
a Specific Value for ASP.NET Server
Controls and How to: Validate Against a
Data Type for ASP.NET Server Controls.
Range RangeValidator Checks that a user's entry is between
checking specified lower and upper boundaries.
You can check ranges within pairs of
numbers, alphabetic characters, and
dates. For details, see How to: Validate
Against a Range of Values for ASP.NET
Server Controls.
Pattern RegularExpressionValidato Checks that the entry matches a pattern
matching r defined by a regular expression. This type
of validation enables you to check for
predictable sequences of characters, such
as those in e-mail addresses, telephone
numbers, postal codes, and so on. For
details, see How to: Validate Against
Patterns for ASP.NET Server Controls.
User-defined CustomValidator Checks the user's entry using validation
logic that you write yourself. This type of
validation enables you to check for values
derived at run time. For details, see How
to: Validate with a Custom Function for
ASP.NET Server Controls and How to:
Validate Against Values in a Database for
ASP.NET Server Controls.
You can attach more than one validation control to an input control. For example, you might
specify that a control is required and that it also contains a specific range of values.
A related control, the ValidationSummary control, does not perform validation, but is often
used in conjunction with other validation controls to display the error messages from all the
validation controls on the page together. For more information, see How to: Control
Validation Error Message Display for ASP.NET Server Controls.
117. How to create only one instance of application for each user?
It's usually a good practice to make sure that only one instance of your application can be
run at a time. In order to determine if there are other instances of an application running,
you need to get a list of all the processes running and see if an instance of the application is
there. In the following example, I utilise the System.Diagnostics.Process class for this
purpose:
Private Sub CheckInstanceOfApp()
Dim appProc() As Process
appProc = Process.GetProcessesByName(strProcName)
If appProc.Length > 1 Then
MessageBox.Show("There is an instance of this application running.")
Else
MessageBox.Show("There are no other instances running.")
End If
End Sub
In the example, I define an array, appProc, as a Process. Then I define two string variables:
strModName and strProcName. The value of variable strModName is set to the
Process.GetCurrentProcess.MainModule.ModuleName property, and the value of variable
strProcName is set to the System.IO.Path.GetFileNameWithoutExtension, to which I pass
the name of the module in strModName. I set the value of the array appProc to the value of
Process.GetProcessesByName and pass the strProcName to it. Then, I simply check the
Length property of the array appProc. If the length is more than one, it means that there is
more then one instance of the application running, which is what I use to base the displayed
message box on.
History support for the Safari browser, inclusion of “titles”, encoding and encrypting of
server-side history state and the ability to handle history in the client without a server
requirement.
A script resource extraction tool that allows you to create script files on disk that originate
from embedded resources in assemblies. Important: this version of the browser history
feature is now outdated and should not be used. Instead, please download
119. What are the classes that are supported by .net for wpf application?
Using system.XAML
a. View State – Asp.Net uses View State to track the values in the Controls. You can add
custom values to the view state. It is used by the Asp.net page framework to
automatically save the values of the page and of each control just prior to rendering to
the page. When the page is posted, one of the first tasks performed by page processing
is to restore view state.
b. Control State – If you create a custom control that requires view state to work
properly, you should use control state to ensure other developers don’t break your
control by disabling view state.
c. Hidden fields – Like view state, hidden fields store data in an HTML form without
displaying it in the user's browser. The data is available only when the form is
processed.
d. Cookies – Cookies store a value in the user's browser that the browser sends with
every page request to the same server. Cookies are the best way to store state data
that must be available for multiple Web pages on a web site.
e. Query Strings - Query strings store values in the URL that are visible to the user. Use
query strings when you want a user to be able to e-mail or instant message state data
with a URL.
b. Session State – Session State information is available to all pages opened by a user
during a single visit.
Both application state and session state information is lost when the application restarts.
To persist user data between application restarts, you can store it using profile
properties.
124. Difference between client side state management and server side state
management?
Choose
to clientscalability
get better side for better scalability
by storing state and support
data multiple
in the servers
user's servers.
browser The of
instead client
using side
the helps
web
server's
in the memory.
browser. The
This way client
when side
you support
are multiple
redirected to another because
server all the
you state
don't is located
need to worry
about your state.
Choose
side server
state side for better
management security and The
is Confidential
more secure. to reduce bandwidth
stateshouldn't
is on and
saved be the web
serverpage's size. Server
and therefore
isn't delivered
management. to the
Server client.
side reduce the state data
trafficYou
to and from used
the client with
becauseclient
data side state
isn'tclient
sent
to thestate
side browser and it's saved
management on the
sends data server.
to the should
user's always
browser and remember
that data that
is using
sent back to
the
everyserver
time. This situation increases bandwidth usage and therefore your application will be
less responsive and you'll suffer from performance issues.
125. What is web service?
A Web Service is programmable application logic accessible via standard Web protocols. One
of these Web protocols is the Simple Object Access Protocol (SOAP). SOAP is a W3C
submitted note that uses standards based technologies (XML for data description and HTTP
for transport) to encode and transmit application data.
Consumers of a Web Service do not need to know anything about the platform, object
model, or programming language used to implement the service; they only need to
understand how to send and receive SOAP messages (HTTP and XML).
127. What are the classes that are supported by .net for wpf application?
● System.Threading.DispatcherObject is the class from which each element in the
user element can verify whether code is running on the correct thread and access the
dispatcher to marshal code to the user interface thread.
● System.Windows.DependencyObject is the class from which WPF classes get
support for dependency properties.
● System.Windows.Media.Visual provides the link between managed WPF libraries
and milcore.dll that renders display.
● System.Windows.UIElement adds support for WPF essentials like layout, input,
focus and events.
● System.Windows.FrameworkElement implements some of the members that are
defined by UIElement.
● System.Windows.Shapes.Shape is the class from which basic shapes like
rectangle, polygon, ellipse, line and path derive from.
● System.Windows.Controls.Control is an element that can interact with a user. It
provides template control which allows the user to replace the standard appearance of a
control with a custom appearance.
● System.Windows.Controls.ContentControl is the base class for all controls that
have a single piece of content.
● System.Windows.Controls.ItemsControl is the base class for all controls that
show a collection of items.
● System.Windows.Controls.Panel is the base class for all elements which can
contain one or more children and arrange them according to specific layout rules.
Explain about Web.Config file?
Web.config file, as it sounds like is a configuration file for the Asp .net web application. An
Asp .net application has one web.config file which keeps the configurations required for the
corresponding application. Web.config file is written in XML with specific tags having specific
meanings.
There are number of important settings that can be stored in the configuration file. Here are
some of the most frequently used configurations, stored conveniently inside Web.config
file..
1. Database connections
2. Session States
3. Error Handling
4. Security
129. Explain about AJAX ?What are Diff B/w AJAX Controls and Normal
controls?
AJAX (shorthand for asynchronous JavaScript and XML[1]) is a group of interrelated web
development techniques used on the client-side to create interactive web applications.
With AJAX, web applications can retrieve data from the server asynchronously in the
background without interfering with the display and behavior of the existing page. The
use of AJAX techniques has led to an increase in interactive or dynamic interfaces on
web pages[2][3] and better quality of Web services due to the asynchronous mode. Data is
usually retrieved using the XMLHttpRequest object. Despite the name, the use of
JavaScript and XML is not actually required, nor do the requests need to be
asynchronous.
The server portion of the ASP.NET AJAX framework introduces two categories of ASP.NET
server controls for adding client capabilities to server controls.
An Extender is used to add client functionality to an existing ASP.NET control, without the
need to create a new server control.
A Script Control is a standalone ASP.NET control that offers both server and client
functionality.
Cascading style sheet (CSS)—A standard for defining the appearance and layout
attributes of HTML elements
A theme has, at minimum, a skin file. Some overlap occurs between skins and CSS
because both are used to control appearance. They have some crucial differences,
however:
Skins don't cascade. Unlike with CSS, where you can create a hierarchy of styles, you
define one skin for each type of control you use on your site. See the sidebar "Cascading
styles" for more details on how CSS styles cascade.
Skins define properties for ASP.NET Web server controls. CSS styles apply to HTML
elements.
Skins apply to a single Web server control. Styles can apply to a single HTML element or
to collections of elements.
Unloading: During this phase, all cleanup tasks, such as destroying the instances of server
control are performed. This is the final event in the life cycle of a server control
Life cycle when the page processed during a postback event
The processing sequence in which a page is processed during a postback event is:
Initializing: During this phase, the server creates an instance of the server control
Loading view state: During this phase, the view state of the control posted by the client
is reloaded into the new instance of the control.
Loading: During this phase, the instance of the control is loaded onto the page object in
which it is defined.
Loading the postback data: During this phase, the server searches any data
corresponding to the control that is loaded in the data posted by the client.
PreRendering: During this phase, the control is updated with the changes made to it. This
prepares the control for rendering.
Saving state: During this phase, the change in the state of control between the current
request and the previous request of the page is saved. For each change, the corresponding
event is raised. For example, if the text of a textbox is changed, the new text is saved and
a text_change event is raised.
Rendering: During this phase, the server creates the corresponding HTML tag for the
control.
Disposing: During this phase, all cleanup tasks, such as closing files and database
connections opened by the control are performed.
Unloading: During this phase, all cleanup tasks, such as destroying the instances of server
control are performed. This is the final event in the life cycle of a server control
The events associated with the relevant page cycle phases are:
■ Page Initialization: Page_Init
■ View State Loading:LoadViewState
■ Postback data processing: LoadPostData
■ Page Loading: Page_Load
■ PostBack Change Notification: RaisePostDataChangedEvent
■ PostBack Event Handling: RaisePostBackEvent
■ Page Pre Rendering Phase: Page_PreRender
■ View State Saving: SaveViewState
■ Page Rendering: Page_Render
■ Page Unloading: Page_UnLoad
Ans: Both Session and ViewState are a way of storing data. The following are the
differences.
.1) Session is for per user session. ViewState is for a page. ie. Storing data in a session
variable will last till the session ends. Whereas storing data in ViewState will last only till the
page is in live.
2) Session is server type storage where as ViewState is client side type storage.
3) Session variables are stored in a SessionStateItemCollection object that is exposed
through the HttpContext.Session property. ViewState variables are stored in hidden fields.
4) When using a SessionState Mode other than Inproc, the session variable type must be
either a primitive type or serializable. This is because the session-variable is stored in an
external data store. There is no mode for ViewState. By default, serialization of data will be
taken care by the viewstate.
InProc is the default session mode. It can be very helpful for a small web sites and
where the number of user are very less, We should avoid InProc in case of Web
Garden Scenario .
Advantages :
● It store Session data in memory object of current application domain. So accessing data is
very fast and data is easily available.
● There is not requirements of serialization to store data in InProc Session Mode.
● Implementation is very easy, just similar to using View State.
Disadvantages :
although InProc Session is fastest, common and default mechanism, It has lots of limitation.
● If the worker Process or application domain recycles all session data will be lost.
● Though its fastest, but more session data and more users can affects performance, because of
memory.
● we can't use it in web Garden scenarios .
● This session mode is not suitable for web farm scenarios also.
So as per above discussion, we can conclude InProc is very fast session storing mechanism
but suitable for small web application. InProc Session Data will get lost if we Restart the
server, application domain recycles It is also not suitable for Web Farm and Web Garden
Scenarios.
If you need to interoperate with another non-WCF service, you have to use the MessageContract,
MessageHeader, and MessageBody attributes like the following :
[MessageContract]
public class CustomerMessage
{
[MessageHeader]
public int CustomerId;
[MessageBody]
public CustomerData Customer;
}
This message contract can now be used as a parameter in a service operation. For example:
[ServiceContract()]
interface ICustomerService
{
[OperationContract()]
void SaveCustomer(CustomerMessage customerMsg);
In this case, Windows Communication Foundation takes care of deserializing the body of the
incoming message into a Customer object before invoking AddCustomer.
There is another serialization shortcut, known as message contracts, for automatically adding
headers to a Message object. Message contracts allow you to annotate a class, specifying which
fields map to headers versus the body:
[MessageContract(IsWrapped=false)]
public class AddCustomerRequest
{
[MessageHeader(Name="ContextId",
Namespace="http://example.org/customHeaders"]
public Guid ContextId;
[MessageBodyMember]
public Customer customer;
}
With this message contract class in place, you can define an operation that uses it as the request
type, as shown here:
[ServiceContract]
public interface ICustomer
{
[OperationContract(Action = "urn:add-customer")]
void AddCustomer(AddCustomerRequest request);
}
This tells Windows Communication Foundation to automatically map between the ContextId
field in the object and the ContextId header in the SOAP message, freeing you from having to
manually deal with the Headers collection.
And this extract from an interview with Scott Guthrie Microsoft’s ASP.net Architect discusses
how the new callback manager (ICallBackEventHandler) which is basically a XMLHTTP
wrapper can also help in reducing the amount of visible page refreshes.
“…So, one is to do what we call, out-of-bound call backs, where you can stay on the
same page as an end user, but then through script, you can actually make a call
back to the server and fetch new data that you populate down to the client, without
having to, again, refresh the entire page, without having to lose scroll position, etc.
…
So will out-of-bound callbacks spell the end of the evil IFRAME?
The IFRAME today has a bum wrap in terms of reputation. I think the combination of
out-of-bound callbacks as well as some of the things we're doing in terms of master
pages, to provide much cleaner layout of a page, where you can go ahead and rather
than have to rely on frames in order to cleanly separate, or integrate content into a
site, you can now rely on master pages. I think the combination of those two are
going to put the hurt on the IFRAME out there. It's still fully supported, but the nice
thing is, there's much richer mechanisms you can rely on now. “
http://www.theserverside.net/talks/videos/ScottGuthrie/interview.tss?bandwidth=56k
Well master pages seem a fantastic tool for development. They give you page inheritance,
reusability you can even nest them giving the developer a simple way for you to ensure
consistent look and feel to an entire application. So from a developer’s point of view they
rock.
But what about the user experience well even if a content page “inherits” a master page
each time the page is requested the entire page will refresh whether it is the content part or
the master part of the page. Users hate full page refreshes, developers hate trips to the
server to retrieve redundant html, the menu bar and advertisement is already on the client’s
browser so why go and get it again (even if it is cached on the server).
Can implementing the ICallBackEventHandler help, well yes and no. Use of this technique
can only refresh data. For example, enable the user to page through a grid without
refreshing the entire page. You can’t really use this to redisplay the entire content area of
the page if it contains asp: web controls (well I have done it but using Frames would be
much much easier).
If you haven’t already come across the concept of XML Data Islands it has been around for a
while along with Frames and XMLHTTP (now the ICallBackEventHandler). This technique
requires the use of the DHTML XML tag you use this to build a client side repository of data
in XML. For example if a user is entering data to complete a form over a number of pages, it
would be more beneficial if you stored the data on the client between pages until the user
reaches the final page and presses submit and only then hit the server to update your data
source. This potentially has no effect on the dreaded page refresh it is great for relieving the
pressure on your database server however. Note this is not the only use for XML Data Island
the example is a common one however.
So the only way to stop the entire page refreshing if you are using asp: or user controls on
your page (these need to be rendered by the asp.net runtime) and only refreshing the
content area of a page is still through the use of Frames. Unfortunately in ASP.net Beta 2
unlike ASP.net 1.X it doesn’t ship with a Frameset template although there will be an online
template available and adding the tags yourself won’t cause injury.
So what are the best practices I have come up with many seasoned web developers will
already practice these however for those beginners and intermediates I hope this will be of
some help and relive you of trial and error driven development. Some of you may disagree
with these and I would like to hear back from you guys. Remember it is the users we are
building these web applications for not the developers.
Use master pages when
• Not concerned about a full page refresh
• Development requires a highly modifiable inheritable page standard and users
will live with a page refresh
• Need to be allow the user to bookmark a specific page
Use the ICallBackEventHandler when
• Want to refresh data or images in a control and not refresh the entire page
• Want to refresh part of the page with simple HTML (no asp: controls) and not
refresh the entire page
Use XML Data Islands
• You want to build stores of data on a client and by doing this reduce the
number of hits to update the servers data source
Use Frames when
• Don’t want full page refreshes
• Have complex asp: control driven pages which can’t be refreshed by data only
i.e. the asp: controls need to be generated into html by the web server first
• Need multiple areas of the page to be refreshed at different times by the user
Yes, we can access the viewstate variables across pages. This is only possible if Cross Page
Posting or Server.transfer is used to redirect the user to other page. If Response.redirect
is used, then ViewState cannot be accessed across pages.
Before you continue reading this article, please read these articles on Cross Page Posting and
Server.transfer.
Ok, so all set now... I will demonstrate this using the demo created by me. You can download
the demo from the link at the top of this article.
I have created two *.aspx pages named:
1. ViewStateContainer.aspx: This page sets the ViewState variable and transfers the user to
another page using Server.transfer.
2. AccessViewState.aspx: This page accesses the ViewState variable of
ViewStateContainer.aspx page.
This is the code of ViewStateContainer.aspx page:
Programmers usually need to transfer production data for testing or analyzing. The simplest
way to copy lots of data from any resources to SQL Server is BulkCopying. .NET Framework 2.0
contains a class in ADO.NET "System.Data.SqlClient" namespace: SqlBulkCopy. The
bulk copy operation usually has two separated phases.
In the first phase you get the source data. The source could be various data platforms such as
Access, Excel, SQL.. You must get the source data in your code wrapping it in a DataTable,
or any DataReader class which implements IDataReader. After that, in the second phase,
you must connect the target SQL Database and perform the bulk copy operation.
The bulk copy operation in .Net is a very fast way to copy large amount of data somewhere to
SQL Server. The reason for that is the Bulkcopy Sql Server mechanism. Inserting all data row
by row, one after the other is a very time and system resources consuming. But the bulkcopy
mechanism process all data at once. So the data inserting becomes very fast.
Solution walkthrough
While you are programming for bulk copy, first open a connection for the source data. In this
sample we are connecting a SQL Server named SQLProduction. We are using
SqlConnectionStringBuilder to build our connection string.
// Establishing connection
SqlConnectionStringBuilder cb = new SqlConnectionStringBuilder();
cb.DataSource = "SQLProduction";
cb.InitialCatalog = "Sales";
cb.IntegratedSecurity = true;
SqlConnection cnn = new SqlConnection(cb.ConnectionString);
Then we are retrieving data from the source with SqlCommand and SqlDataReader
classes.
// Establishing connection
SqlConnectionStringBuilder cb = new SqlConnectionStringBuilder();
cb.DataSource = "SQLProduction";
cb.InitialCatalog = "Sales";
cb.IntegratedSecurity = true;
SqlConnection cnn = new SqlConnection(cb.ConnectionString);
148.How to handle, when session time out to redirect a page to login without a
user interaction?
Method 1
This one is great use of the meta tags that is redirection of user to Login Page or Session Timeout
page or Logout page automatically on Session Timeouts. As you will notice below I simply
convert the Timeout to seconds by multiplying by 60 and then setting it in the meta tag. Thus as
soon as timeout occurs user is redirected to the Logout or Login page that you set in the URL
parameter
Method 2
<!--
Session configuration
-->
<!--
-->
<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
path="/"
requireSSL="false"
timeout="45"
name=".ASPXAUTH"
slidingExpiration="true"
defaultUrl="Login.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false" />
</system.web>
Create a page for your users to be taken to when their session expires. I created
SessionExpired.aspx with the following message:
<h2>Session Expired</h2>
<p>
<br />
<br />
</p>
Ensure the Authentication ticket is signed out in your code behind:
FormsAuthentication.SignOut();
In the Page_Load method of your MasterPage (or base page class) add the following code:
script.Append("} \n");
You can add Authentication (using windows credentials) with something like this:
<basicHttpBinding>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</basicHttpBinding>
Could then Authorise by decorating the Interface to your services methods:
<PrincipalPermission(SecurityAction.Demand, Role:="MyAppsUsers")> _
Public Function MyMethod() As String Implements IService.MyMethod
Heres a good link to Security in WCF. It has lots of How To's at the end (the one titled 'How To
- Use basicHttpBinding with Windows Authentication and TransportCreditals' might be of use
to you).
155.How do you display standard message across the application?
By using custom exception handlers by implimenting a class through exception class.
156.I have 4 websites in a solution where can i place a web.config
file i,e website level or solution level?
You can have the config file only for wesite level not for solution level.