Tuesday, June 10, 2008
List of .net questions asked in MNC'S
Wipro Questions:
Write 5 best test cases like any password? Password should be mixed case with at least one
number or special characters?
Check for empty password it should fail.
Check for all alphabetic password it should fail
Check for all numeric password it should fail
Check for all special character password it should fail
Check for all mixed password it should succeed.
How can we convert XML data into Database table IN .Net?
dSet.ReadXml (Server.MapPath ("Forms.xml"))
What is the Difference between direct cast and ctype?
The difference between the two keywords is that CType succeeds as long as there is a valid conversion defined between the expression and the type, whereas Direct Cast requires the run-time type of an object variable to be the same as the specified type. If the specified type and the run-time type of the expression are the same, however, the run-time performance of DirectCast is better than that of CType. DirectCast throws an InvalidCastException error if the argument types do not match.
Dim t As String = "5"
Dim s As Integer = CType(t, Integer)
Dim t As String = "5"
Dim w As String = DirectCast(t, String)
What is the Difference between a sub and a function?
Sub keyword is used for the procedures and procedures never return a value where function key word is used for function and function returns a value that can be assigning to any
Variable.
What are the two kinds of properties?
Get and Set are the two kinds of properties..
What is the raise event used for?
It is used for raising the error from sql statement
Explain constructor.
Constructor is like a method with a same name as of ur class name ,no return type.It is used to initialize the memebr variables of the class.If there is no contructor provided compiler invokes the default constructor. the Moment there is contructor is provided to the class it can be any either default or parameterized the compiler stops invoking it own default
constructor
What is a system lock?
System Lock locks the desktop until correct password is being given
Can i have both C# and vb.net code in same assembly?how?
Yes you can add C# and VB.Net code in the same asssembly. For that add a new item to the project. Give the name of the file as Class1.vb if you want to add a vb code and Class1.cs if you want to add C# code.
When you compile the project it will compile to a single assembly. The language does not matter in the end since everthing
will be compile to MSIL.
Webconfig file is cofiguration of server or browser?
Server
Suppose, I have 3 pages, Page1.aspx, Page2.aspx, Page3.aspx. All pages are in diff. server. When user req. for a page, Page1.aspx opens Ist & a session established. If user req. for IIn page, second session established. Similarly, 3rd session established if user req. 3rd page. In this scenario, tot. 03 sessions are established. How we can minimize it so that it will work with only one session?
OUT PROC : Maintain the session in the SQL server.
can we transfer data from one page to another page using viewstate if so how?if not y?
By using viewstate it is not possible.sure it is not possible.bcoz its comes under the pagelevel state manage ment.to maintaning the state in page it self we are using the view state.
so viewstate object is available only after page_init() and
before page_load().
what are Httpmodule and HttpHandler?
http handler is a information between the web browser and web server
The HTTP handler is used in web services
An HttpModule is an assembly that implements the IHttpModule interface and handles events. ASP.NET includes a set of HttpModules that can be used by your application. For example, the SessionStateModule is provided by ASP.NET to supply session state services to an application. Custom HttpModules can be created to respond to either ASP.NET events or user events.
Suppose you display a data having 200 records in a datagrid. Then you
edit 100 records of them. Now when you will press update button,all
100 records should be updated in single shot rather than reading
every record and updating. How to do it?
Here, bind primary key of database to datagrid column make it visible false.and travel loop as
foreach(DataGridItem dataItem in DataGrid1.Items)
{
priceText = (TextBox)dataItem.FindControl("txtBookPrice");
bookIdText = (TextBox)dataItem.FindControl("txtBookId");
Updatecode_for_perticular_row ();
}
txtBookPrice= textbox from witch u would like to update
txtBookId= test i.e. unique id comming from database
With help of unique id in for loop find perticular text in texbox and update.
This code you will write on update button click.
Write a code for "RequiredFieldValidator" in java script
suppose the id of the field required to be validated is NameId
Thus:-
function validate()
{
if(document.getElementById("NameId").value == null)
alert("Please enter the name");
}
How to set/get parent page values in child page in asp.net?
get= var uid=document.getElementById('txtUserId').value;
set= document.getElementById('txtUserId').innerText=uid;
What is web.config. How many web.config files can be allowed to use in
an application ?
The web.config file is the configuration file of the web application. This means that the configuration settings of the application [such as authentication, authorisation, tracing, debugging, connectionstrings, ...] can be changed through the web.config file.
The main advantage is that that the changes made in the web.config file will be applicable to the web application without having to change the code of the application and without recompiling the application.
The root folder of a web application can have only one web.config file. But any inner/ sub folders can have a web.config file. It web.config file in the sub folders will override the one in the root folder of the application.
Can you explain the difference between an ADO.NET Dataset and an ADO
Recordset?
In ADO recordset(in memory representation of data) looks like single
table
where as
in ADO.NET dataset(in-memory representation of data) is a collection of one or more tables(use JOIN Query).
In ADO you communicate with the database by making the calls to an
OLEDB Provider
where as
in ADO.NET you communicate with the database through a Data Adapter(an OledbDataAdapter,SQLDataAdapter,OdbcDataAdapter or OracleDataAdapter object) which make calls to an OLEDB Provider or the API's provided by the underlying datasource.
In ADO recordset objects operate in a fully connected state
where as
in ADO.NET dataset operate in disconnected state.
ADO requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.
where as
ADO.NET does not require data-type conversions.
In ADO it is sometime sproblematic firewalls( firewalls are typically configured to allow HTML text to pass, but to prevent system-level requests (such as COM marshalling)from passing) prevent many types of requets
where as
in ADO.NET datasets using XML, firewalls can allow datasets to pass.
how validation controls will be executed on client and server?
Validation controls are execute on clien-side.They contains isValid property which is used to valid the control.Then it executes on the server.
What Name space does the web page belon in the .net framework class
hierarchy?
System.web.UI.Page
What is the difference between java and java script?
Java Script is object based language it is used for front end validations.java is object oriented language.object oriented language
supports OOP's,Object based not suppoted inheritence.
why you used Java Script? Can it use for both client side and server
side validation purpose?
Mainly used for client side scripting purpose.JavaScript is a platform-independent,event-driven, interpreted client-side scripting and programming language.
javascript cannot be used as server side scripting.
Does c++ support multilevel and multiple inheritance?
Yes ,c++ supports multilevel and multiple inheritance
Accenture :
What is Reflection in .NET?
It is used to get Class info. at the runtime.
The Class info. defines::no. of
constructors,methods,isobject,isvalue,issealed,ispublic,...
This can be achieve through Reflection.
How many .rpt files are be there in a main report having 2 sub
reports?
there are 3 .rpt files including the main and 2 sub report.but when the subreports are inserted into main it will behave like one only.
If you are calling three SPs from a window application how do u check
for the performance of the SPS ?
We can check the performance of SP's with SQL Profiler
What provider ADO.net use by default?(check)
no default provider
sql provider
Which is better in performance - CONSTRAINT or TRIGGER over a column
which restricts say an input of particular value in a column of a
table?
Constraint is better in terms of performance for same operation.
Which databases are part of SQL server default installation? Explain
the usage of each?
key default dbs :-
Master db : Holds info of all dbs located on SQL Server insytance.
Main db (else SQL Server won't work !)
MSdb : Stores info regarding Backups, SQL Agent info, DTS packages,
SQL Server jobs, replication info for log shipping.
Tempdb : To hold temp objects like global & local temp tables, sps
Model db: Used in creation of any new database within the SQL Server
instance of which it(model) is a part.
how do u achieve multilevel inheritance in .NET ?
by uing interfaces we can implement multiple inheritance
What is gacutil.exe. Where do we store assemblies ?
gacutil is a tool that will list, install, and uninstall assemblies in the GAC.
Where does web.config info stored? Will this be stored in the registry?
web.config contains authorization/authentication session related information.It is stored in the root directory of your application.Optionalyy you individual web.config can be created in each sub directory of your project if required.
How do you do role based security ?
Create a principle object which contains users identity (login name) and array of roles and pass this object to HttpContext.Current.User
The roles supplied to this object will be checked against
roles specified in the web.config file,if they matched then
they are allowed access to the page otherwise not.
allowed roles can be specified like this in web.config
How do you register the dotnet component or assembly ?
The steps to register a dot net component is:
The command line instruction to create a strong name.
sn -k ComInterOp.snk.
Strong name is a unique name created by hashing a 128-bit encryption key against the name of the Assembly (ComInterOp in our case). The strong name is created using SN.exe,that would create ComInterOp.snk file, which we would use while
creating the DotNet Assembly.
The command line instruction to create an assembly using the strong name
vbc /out:ComInterOp.dll /t:library /keyfile:ComInterOp.snk
Assembly Registration Tool.
The Assembly Registration Tool (Regasm.exe), reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create DotNet Framework classes transparently. The Assembly Registration tool can generate and register a type library when you apply the /tlb: option. COM clients require that type libraries be installed in the Windows registry. Without this option, Regasm.exe only registers the types in an assembly, not the type library. Registering the types in an assembly and registering the type library are distinct activities.The command line instruction to create and register ComINterOp.tlb(Type Library) is
regasm ComInterOp.dll /tlb:ComInterOp.tlb.
The DotNet Services Installation Tool (Regsvcs.exe)
The command line instruction to install ComINterOp.dll in GAC is
Gacutil -i ComInterOp.dll.
About DTS package ?
It is Sql server object used to transfer data from Database into Execel, Notepad etc.
What does assemblyinfo.cs file consists of ?
AssemblyInfo.cs file contains details about the assembly name,version info.,security info. and various details including company,description and trademark etc.
What is strong name and which tool is used for this ?
Strong Name is to be assigned to shared assembly. when more then one application is going to use that dll/assembly,that assembly has to assign a strong name and has to be place in GAC(Global Assembly Cache).
sn.exe is used to generate a strong name.
What is shared and private assembly ?
Shared assemblies are accessed by more than one application and they are stored in GAC. private assemblies are accessed by only one application and they are stored in application directory and one of its subdirectory.
What are the types of assemblies and where can u store them and how ?
Please note there are three types of Assemblies.
Private - Assembly available only to clients in the same
directory.
Shared - Assemblies in GAC
Satelite - Assembly in the specific directory of the locale.
If you are using components in your application, how can you handle exceptions raised in a component ?
I think for simple Handling of Exceptions, we keep TRY,Catch Block and catch the exception and handle those ones.
Types of optimization and name a few ?
For SQL --
Heuristic Optimization
Syntactical Optimization
Cost-Based Optimization
Semantic Optimization
What are Authentication mechanisms in .Net?
there are 3 types of authentication mechanisams in .net.there are
1)forms authentication
2)windows authentication
3)passport authentication
What are the differences between Trace and Debug?
trace allows us to view how the code executed in details.
Debug allows line by line exection..
What is Boxing and Unboxing?
Boxing is to implicitly converting value type to refrence type,
int x = 10;
y = x;
Unboxing is to explicitly converting refrence type to value type
double y = 10.234;
int x = (int)y;
How to write unmanaged code and how to identify whether the code is
managed /unmanaged?
unmanaged code is not varify by clr,and clr is not varify third party
control and pointer.
Unmanaged code use like using dll or any other com object in
application then it is unmanaged code ,we cannot change the code.
How do you relate an aspx page with its code behind Page?
Inherits page.aspx.cs.
Can we throw exception from catch Block?
we can throw the exception in catch block by using throw New Exception("Exception Message")
How do you do exception management?
using try catch bolcks
How does Garbage collector(GC) works in .net?
In .net the garbage collection is called by the class
system.gc.collect
It manages the unused objects and releases the memory.
can sn.exe can be used before gacutil.exe
yes , sn.exe is an commandline tool which we asign a strong name sn -k and it can be placed into GAC(Global Assembly Catch)
About DataAdapters ?
Data Adapters provide interaction between DataBase and Dataset.It provide the functionalities like reading the data from database,update the data,filter the data and write the data to Database
About duration in caching technique ?
Duration will specify life time of caching content. 20 minitues
Types of object in asp ?
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
Difference between Response.Expires and Expires.Absolute ?
Response.Expires specifies the lenght of the time ie 20 seconds
Response.ExpiresAbsolute specifies the time ie 12:12:10
What is stateless asp or asp.net ?
Both ASP and ASP.NET are stateless. Because both ASP and ASP.NET uses HTTP protocol which is stateless.
What are asynchronous callbacks ?
call multiple threads at a time
What is a transaction and what are ACID properties?
A transaction is a sequence of sql Operations(commands),work as single atomic unit of work. To be qualify as "Transaction" , this sequence of operations must satisfy 4 properties , which is knwon as ACID test.
A(Atomicity):-The sequence of operations must be atomic,either all or no operations are performed.
C(Consistency):- When completed, the sequence of operations must leave data in consistent mode. All the defined relations/constraints must me Maintained.
I(Isolation): A Transaction must be isolated from all other transactions. A transaction sees the data defore the operations are performed , or after all the operations has performed, it can't see the data in between.
D(Durability): All oprtaions must be permanently placed on the system. Even in the event of system failure , all the operations must be exhibit.
What is the difference between managed and unmanaged code?
A code that executed under the instructions of CLR is called managed code.
A code that execute without the instruction of CLR is called
unmanaged code.
How do you merge two datasets into the third dataset in a simple
manner?
ds1.Merge(ds2,true)
When is an object created and what is its lifetime?
whenever developer is required, and the life-time is when we assinging null or close the program(application).
How many sub-reports can report can have?
0-256(maximum 256)
What is the difference between User Controls and Master Pages ?
Both are code reduce features and reusability Purpose.When we create
Masterpage that is common to overall project,whereas user controls
these r used when we have requirement on specific criteria.
Master pages are used to provide the consistent layout and common
behaviour for multiple pages in your applications.then u can add the
contenetplaceholder to add child pages custom content.
User Controls:Sometimes u need the functionality in ur web pages which
is not possible using the Built-In Web server controls then user can
create his own controls called user controls using asp.net builtin
controls.User controlsn are those with .aspx extensions and u can
share it in the application.
where we use javascript and for which purpose we use javascript how?
Javascript is a clint side scripting. Mostly used for validations.
Satyam
IS MS.Net platform independent or dependent?
.Net is not platform independent , it's only language independent
What is the main Difference Between .Net 2003 and .Net 2005.and also
Asp1.1,Asp2.0 and Asp3.0
Difference b/w .net 2003 & .net 2005
vs.net2003 doesn’t carry personal webserver.whereas vs2005 will
carrying personal web server called asp.net development server
Vs.net2003 will create set of different files for asp.net
applications. this makes development complex.Whereas in vs.net2005
will support project less appln developement.for asp.net this will
create only required files for asp.net appln. This makes development
easier.
2003 will support only code-behind tech.whereas 2005 will support in-
page tech and code behind tech.
2003 only support one language for WebPages with in asp.net appln,
whereas 2005 will support different languages for WebPages with in
asp.net appln.
Which is the best way for keeping the data in XML or SQL server..and
why?
To store the data, the best and appropriate way is SQL SERVER as it is more compatible with any language and gud database.i think for a short term XML also plays vital role in storing the data.
What does the term immutable mean?
it means that this object can't be changed.but if you want another value to the same object another instance of the object is created and leave the current instance unchanged.an example of immutable is STRING.
What does the keyword virtual mean in the method definition?
The method can be over-ridden.
What are advantages of Stored Procedures?
Stored Procedure's are precomplied one. When ever you call a stored procedure it generate the result faster than ordinay coding. The improve the performance of the application i.e to reduce the time stored procedure's are used
Explain the usage of WHERE CURRENT OF clause in cursors ?
WHERE CURRENT OF clause in an UPDATE,DELETE statement refers to the latest row fetched from a cursor.
how to implement locking in sql server?
no need to impliment locks sql server automatically holds locks.
Difference between Cluster and Non-cluster index?
clustered index is physically stored a table can have 1 clustered
index
non clustered index is logically stored a table can have 249 non
clustred index
what is web server?
web server is a software which is responsible to execute server side script such as asp,php and etc.and send a html page to client.so finally we can say that web server is use for execute script(server side) and response send to client.
How to refresh the crystal report from the application ?
calling crystalreportcontrolname.reset (by selecting Report menu under
Refresh the report menuitem at design time)will refresh the report.
crystalreport1.DiscardSavedData=True
can i use two web.config files of ConnectionString in One Default.aspx
page?
we can have more than one web.config file in an application. We can have web.config file for every folder in application.but not 2 web.cofig in one place.
What is the difference between Server.Transfer and Response.Redirect?
Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server, Server.Transfer does not update the clients url history list or current url.
Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.
Dategrid filtering and sorting How can we sort all the fields at once?
Undoubtedly u need to write a sql query for this with the order by (or) sort by.And also call the subroutine that fills the datagrid after each insert or delete so that u can see the changes at the runtime with the new alignment(i mean sorting)...
What are generics? why it is used? architecture of ASP.NET?
Generics are new in .NET 2.0.It is used to define a type while leaving some details unspecified.Generics are the replacement of "Objects" in .NET1.1 Generics reduces the run-time error and increases the performance.
what are the attributes of sitemapnode?
Title,url,description
How do you make your site SSL enabled ?
ssl-secure sockets layer:
If you want user certificate authentication enabled, figure out who should have access to your site, and how to distinguish this group from all other users. Some examples of groupings:
Fermi people (i.e., FNAL.GOV Kerberos domain users eligible for KCA certificates) DOE-affiliated people (i.e., anyone who has DOEGrids certificate) Specific individuals with certificates from a known set of CAs
Anyone with a certificate issued by a particular CA and connecting from a particular domain (e.g., fnal.gov)Some combination of the above.
What is CTS, CLS and CLR ?
Common Type System(CTS) :A fundamental part of the .NET Framework's Common Language Runtime (CLR),the CTS specifies no particular syntax or keywords, but instead defines a common set of types that can be used with many different language syntaxes.
Common Language Specification(CLS):The Common Language Specification (CLS) describes a set of features that different languages have in common.The CLS includes a subset of the Common Type System (CTS).
The CLR is a multi-language execution environment
If cookies is disabled in client browser will session work ?
Sessions are normally tracked with cookies. However, clients are not required to accept cookies. Furthermore, you can turn off the use of cookies for session tracking altogether in the Web Application Server Control Panel.However when cookies are turned off or cookies are not enabled on a specific client computer, the server must work harder to track the session state, which has a performance impact. The recommendation is to leave cookies on and let the server automatically fall back to the cookieless operation only when required by a specific client connection.
When a session is created by the server, some information is automatically stored in it - the session ID and a timestamp. as an application developer, you can also store other information in the session in order to make it available to subsequent requests without explicitly passing it to that request.
About Global.asax ?
Global.asax is a file that resides in the root directory of your application. It is inaccessible over the web but is used by the ASP.NET application if it is there. It is a collection of event handlers that you can use to change and set settings in your site. The events can come from one of two places - The HTTPApplication object and any HTTPModule object that is specified in web.confg or machine.config. We will be covering both here.
it contains 7 events....
1.Application start
2.Application End
3.Session on start
4.Session on end
5.Session on Request
6.Application on Begining request
7.Application on Error
About writing a query and SP which is better ?
sp is the better one...
Its compile and inside that we can write any number of Query Statement , finally for the whole thing it will create only one object as a reference .
But in Query Statement Each query be an Objects ...
Difference between Active Exe and Dll ?
EXE is ae executable file, while Dll is not. Dll cannot be used independantly.
The Dll is a reusable component which can be referred by a EXE.
Can two web application share a session and application variable ?
No, can't share. Becoz. both web application session's are different and also for application variables.
What is web application virtual directory ?
Web applications and vitual directories to share the inforamation over an internet , an intranet or an extranet.web sites , web applications and virtual directories are work together in a hirarichacal relationship as the basic building blocks for hosting online content.
web sites containes one or more web applications, web application containes on or more virtual directories.and virtual directory map to physical directory of web server.
Difference between application and session ?
session object is used to store information between http request for a particular user. Application are globally across users.
How to find the client browser type ?
Request.UserAgent
Response.Write(Request.Browser.Type);
Request.ServerVariables("http_user_agent")
we can identify the browser name using javascript
var brw = new navigator();
alert(brw.appname);
alert(brw.appversion);
Microsoft
What is the difference between temp table and table variable?
SYNTAX
Temporary Tables: CREATE table #T (…)
Table Variables: DECLARE @T table (…)
Table Variables are out of scope of the transaction mechanism.If you make changes to a Temp Table inside a Transaction and Rollback the Transaction those changes will be lost.Changes made to Table Variable inside a Transaction will remain even if you Rollback the Transaction
Any procedure with a temporary table cannot be pre-compiled An execution plan of procedures with table variables can be statically compiled in advance
Table Variables exist only in the same scope as variables.They are not visible in inner stored procedures and in exec(string) statements
Table variables are in-memory structures that may work from 2-100 times faster than temp tables.
Access to table variables gets slower as the volume of data they contain grows.
At some point, table variables will overflow the available memory and that kills the performance.
Use table variables only when their data content is guaranteed not to grow unpredictably; the breaking size is around several thousand records.
For larger data volumes, use temp tables with clustered indexes.
What is boxing and how it is done internally?
Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
In case of value type ,value is stored in the stack but after boxing process value is stored in to heap.
What is ODP.NET?
Orcle9i Data Provider for DotNet using this provider we can connect to Orcle DB.
About remoting and web services.Difference between them?
Remoting is a technology used to communicate between applications of same platform and encoding will be in the form of binary.
In the case of web service applications in different platforms can communicate and data will get transferred as xml files
What are the security issues if we send a query from the application?
Third party can able to see your query and also there can be SQL Injection if the query is SQL statement.
Query should be encrypted before sending from application.
Difference between Htttppost and Httpget Methods?
HTTP Get is a protocol is used to get the data from the server side.While coming to the HTTP post to append the data to the client side to server side which can given by the user on URL
what is caching?
Caching is one of the statemanagement technics as well as the optimization. It's small memory location at the server side that will retain the user data for the purpose of subsequent requessts.
what is managed and unmanaged code?
Managed code: A code that is managed by CLR is know as Manged code for example C#,j#,Vb.Net etc
Unmanged code: A code that is not managed by CLR is known as Unmanaged by unmanaged code. for example c++, java, c etc
Have u used webcontrols?Tell me something about these?
Yes, webcontrols are represented in the form of dll.they are compiled content and the controls will appear in the toolbox. cathing is not supported.
Can you store dataset in viewstate?
No, You cant directly store Dataset in ViewState. You can get XML from dataset store that Xml in ViewState. While getting From ViewState convert to xml and then from xml to dataset.
what is Disco?what it will do?
DISCO is the discovery file which gives path to the Webservices
It contains WSDL(Web Service Description Language)When one searches for the Web Services, it will go to the DISCO whcih gives actual info. about the particular Webservices
what is soap?
Soap is a formatting protocal.
When we send data to the webservice the data will be passed in network wire.That data has to formatted by SOAP. and sends to the service.
then the service will give response to that request.This data is also formatted by Soap and give it to the client.
SOAP--> HTTP + XML
The format is XML because it is platform dependent.this service is used by other applications.
can we call webservice in Html form?
yes we can call a webservice from html form.Your web page directory should include the 'webservice.htc'file. This file adds a behavior to html files for calling web services.
How can you assign styles to webforms?
by using cascading style sheets.
what is manifest?
Assembly manifest is a data structure which stores information about an assembly .The information includes version information, list of onstituent files etc.
How can you get public key information?
Using ILDASM-Intermediate Language Disassembler which will open the manifest of that particualar assembly.
what is generics?
Generics are the most powerful feature of C# 2.0. Generics allow you to define type-safe data structures, without committing to actual data types.
what are Httpmodule and HttpHandler?
http handler is a information between the web browser and web server
About Garbage Collector?
garbage collection is a form of automatic memory management.The garbage collector attempts to reclaim garbage or memory used by objects that will never be accessed or mutated again by the application.
Singleton Design pattern? How do you achieve it?
Singleton design pattern we can implement using Static key word that means only one instance.All the instances are coming from the same memory location.
what are webservices?In which circumstances we can go for
webservices?
Web service is a reusable component which resides in the web server.
It is language independant and platform independant. This means that any application written in any language can use the service of a web service. It uses the SOAP protocal and communicates using XML.
what are partial classes and their use?
“partial” keyword can be used to split a single class, interface, or struct into multiple, separate files in ASP.NET (using C# as the language). This permits multiple developers to works on these files, which can later be treated as a single unit by the compiler at the time of compilation and compiled into MSIL code.
Partial classes can improve code readability and maintainability by
providing a powerful way to extend the behavior of a class and attach
functionality to it.
The partial modifier can only appear immediately before the keywords
class, struct, or interface.
Nested partial types are allowed in partial-type definitions.
Using partial classes helps to split your class definition into
multiple physical files.
Note that the partial keyword applies to classes,structs, and
interfaces, but not enums
Difference between .NET components and COM components?
.net component.....>these dlls can be used by any application (platform independant)these components are resolved from dll hell problem
com components.......>platform dependent components
What is an application domain?
Application domain is something that isolates the application from interupting each other.
What are runtime hosts?
Runhosts is a special type where CLR is executed and managed.
How do you do validations. Whether client-side or server-side
validations are better?
Asp.Net has few validation control like compare,requirefield,range ,regulor-expression and custom
u can use any validation control with html ,asp control
Asp.net validation control are by default cilde side validation
and the client side validation is better bcoz it's reduse the burdon to the server.
Features in ASP.NET?
It has Comman Language Runtime execution Engine which translate the source code into Microsoft Intermediate Language (MSIL) .It is called Managed code.
Types of caching. How to implement caching?
there are 3 types of caches is there they are
1)page caching
2)page fragmentaion caching
3)data caching
in case of the page caching the total page will be cached for certain amount of time(i.e the time will declared by ourself)
and in case of page fragmentation caching only a part of the data will be cached for some amount of time
Data caching, which allows developers to programmatically retain arbitrary data across requests
Difference between .NET and previous version?
previous version is the com based which was does not support inheritance, it was object based and it is completley binary standed code.
.NET is the fully object oriented language.
Is overloading possible in web services?
Yes,its possible
Types of session management in ASP.NET?
There are two types of session management in ASP.NET namely, Client side and Server side.
Client side: Hidden forms, Hiddenfields,query strings,Cookies, View
state
Sever side: Application object, Session State, Caching.Each type has
its own advantages and preferences.
What is reflection and disadvantages of reflection?
Reflection is used for accessing assembly related information ie, methods ,properties etc we can dynamically invoke methods using reflection.reflection can use for latebinding of an object.
What is the difference between and ActiveX dll and control?
Activex dll is created any language and use in application.by using javascript .Activex dll use only as client side control.Control is created in same language of application and use as like drag and drop on page.you can use controls server side as well as client side.
What is custom control. What is the difference between custom control and user control?
Both the custom control and the user control will be developed by the user, the only difference is user control is application specific where are custom control can be used in any application. We can create a dll for the custom control and can place it in the toolbox where are for user control it's not possible it's just an .ascx file as .aspx.
KeaneIndia
How do you set language in web.cofig ?
To set the UI culture and culture for all pages, add a globalization
section to the Web.config file, and then set the uiculture and
culture attributes, as shown in the following example:
To set the UI culture and culture for an individual page,set the
Culture and UICulture attributes of the @ Page directive, as shown in
the following example:
How many web.config a application can have ?
Tell About Web.config ?
What is application variable and when it is initialized ?
it is the process of client side state managment
we can specify like
application["str"]="Value for ref";
like the above in global.asax
this is for global purpose
we can use this value in any where of our application
Tell About Global.asax ?
Global.asax is a file that resides in the root directory of your application. It is inaccessible over the web but is used by the ASP.NET application if it is there. It is a collection of event handlers that you can use to change and set settings in your site. The events can come from one of two places - The HTTPApplication object and any HTTPModule object that is specified in web.confg or machine.config
What is Response.Flush method ?
It sends all buffered data to client immediately
Difference between server.Execute and response.redirect ?
Server.execute combines the results of 2 pages into 1 page.It is normally used when the second page does not have controls which trigger postback events.
Response.redirect is used to redirect to another page from the first page
What is the need of client side and server side validation ?
client side validation are used to reduce the burden on server because if you write server side validation each and every request is send to server and server gives the response each and every time so burden on server. to avoid this problem by using client side validations.we can write some of validations at server side regarding security.
Write steps of retrieving data using ado.net ?
we can use two ways to retrieve the data from database
1 -> data reader
2 -> data adapter
when you use datareader
create connection object and open the connection
SqlCommand cmd = new SqlCommand(sql,con);
cmd.CommandType = CommandType.Text;
SqlDataReader sread = cmd.ExecuteReader();
while(sread.Read())
{
String data1 = sread.GetString(0);
int data2 = sread.GetValue(1);
String data3 = sread.GetString(2);
}
when u use the dataadapter
create the connection and open
SqlDataAdapter sda = new SqlDataAdapter(sql,con);
DataSet ds = new DataSet();
sda.Fill(ds,"customer");
then use can get the data in row wise or directly assign the data to the controls through datasource.
Call a stored procedure from ado.net and pass parameter to it ?
create a connection object
create a command object like so
SqlCommand comm=new SqlCommand("storedprocname",conn)
comm.commandtype=cmmandtype.storedprocedure
and then add parameters like:
comm.parameters.addwithvale("@userid",textbox1.text)
comm.parameters.addwithvalue(@username",textbox2.text)
When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
Using SqlException handlers.
Infosys
can we have multiple datatables in a datareader ?
Yes, we can have multiple result set means multiple datatable data in one datareader..., code as below
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["con"]);
SqlCommand cmd = new SqlCommand("SELECT SiteName FROM
Sites;SELECT SiteCode FROM Sites", con);
cmd.Connection.Open();
SqlDataReader r = cmd.ExecuteReader();
do {
while(r.Read()) {
Response.Write(r.GetString(0) + "
");
}
} while (r.NextResult());
r.Close();
con.Close();
cmd = null;
r = null;
con = null;
How do you ensure quality of code ?
We ensure quality of code by doing
1)Self code review
2)Peer to peer code review.
3)Adher to different coding standards
4)Follow best coding practices.
5)Ensure right code version by making CM audit check list.
What are sequence diagrams, collaboration diagrams and difference between them ?
Sequence diagram is basically a flow chart w.r.t time.
However, a collabration diagram is very much the sequence diagram without any time.
Collaboration diagrams basically shows the interaction of the various objects.
what are all the test scenarios for login passwords?(user authentication)
* Ensure that total number of chrecters are with in the range.
* The copy option should not be provided.
* ensure that not to accept white spaces.
* spelcial cheractor are alowed.
what is SDLC? what are the different stages in SDLC?
Acronym for system development life cycle. SDLC is the process of
developing information systems through investigation, analysis,
design, implementation and maintenance.
SDLC is also known as information systems development or application
development.
SDLC is a systems approach to problem solving and is made up of
several
phases, each comprised of multiple steps:
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.
What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
What does VS.NET contains ?
VS.NET contains .NET FRAMEWORK includes Window form, Web Form, Base Class Libraries and CLR.
Is VB.NET object oriented? What are the inheritances does VB.NET support ?
vb.net is object oriented concept.it is supports to inheritence but it donot support to multiple inheritance.
what are the advantage in vb.net and different between vb and vb.net ?
Adv of VB.NET:
vb is object based. vb.net is object oriented.
vb use record set for database connection
vb.net use dataset for database connection
Write a query to delete duplicate records in SQL SERVER
DELETE FROM A WHERE(id NOT IN
(SELECT MAX(ID) FROM A GROUP BY name))
suppose i have table called A. A has two coloumn id
(identity) as int and Name as nvarchar. I have data like
this.
id Name
1 C
2 D
3 C
4 E
5 D
6 D
In performance wise distinct is good or group by is good? eg:select name from emp group by name; select distinct name from emp;
This question is asked many times to me. What is difference between DISTINCT and GROUP BY?
A DISTINCT and GROUP BY usually generate the same query plan, so performance should be the same across both query constructs.
GROUP BY should be used to apply aggregate operators to each group. If all you need is to remove duplicates then use DISTINCT. If you are using sub-queries execution plan for that query varies so in that case you need to check the execution plan before making decision of which is faster.
Example of DISTINCT:
SELECT DISTINCT Employee, Rank FROM Employees
Example of GROUP BY:
SELECT Employee, Rank FROM Employees GROUP BY Employee, Rank
Can you create UNIQUE and PRIMARY KEY constraints on computed columns in SQL Server 2000?
Because SQL Server 2000 supports indexes on computed columns, you can create UNIQUE and PRIMARY KEY constraints on computed columns.
What is JIT, what are types of JITS and their purpose ?
JIT is Just in Time compiler which compiles the MSIL into NAtive code.
There are three types of JIT copilers.
Pre-JIT. Pre-JIT compiles complete source code into native code in a
single compilation cycle. This is done at the time of deployment of
the application.
Econo-JIT. Econo-JIT compiles only those methods that are called at
runtime.However, these compiled methods are removed when they are not
required.
Normal-JIT. Normal-JIT compiles only those methods that are called at
runtime.These methods are compiled the first time they are called,
and then they are stored in cache. When the same methods are called
again, the compiledcode from cache is used for execution.
What is SOAP, UDDI and WSDL ?
SOAP (Simple Object Access Protocol): is a simple protocol for exchange of information. It is based on XML and consists of three parts: a SOAP envelope (describing what's in the message and how to process it); a set of encoding rules, and a convention for representing RPCs (Remote Procedure Calls) and responses.
UDDI (Universal Description, Discovery, and Integration): is a specification designed to allow businesses of all sizes to benefit in the new digital economy. There is a UDDI registry, which is open to everybody. Membership is free and members can enter details about themselves and the services they provide. Searches can be performed by company name, specific service, or types of service. This allows companies providing or needing web services to discover each other, define how they interact over the Internet and share such information in a truly global and standardized fashion.
WSDL (Web Services Description Language) defines the XML grammar for describing services as collections of communication endpoints capable of exchanging messages. Companies can publish WSDLs for services they provide and others can access those services using the information in the WSDL. Links to WSDLs are usually offered in a company?s profile in the UDDI registry.
What is caching and types of caching ?
To Imporve the performance of Web Pages, we use Caching.
Caching is a used for persisting data in memory for immediate acces to the program calls. It has three types :
1. Output Caching - to fetch page level information and data
2. Fragment Caching - to cache the information of a structure level.
3. Application Caching - to fetch the information of an application.
what is virtual function?
virtual function can be used to override the propertis of a function.
it is normaly used in inheritance. it is part of polymorphism.
HOW TO FIND THE EMPLOYEE DETAILS WHO ARE GETTING SAME SALARY IN EMP TABLE?
SELECT * FROM EMP WHERE (SAL = (SELECT sal FROM emp GROUP BY sal HAVING COUNT(sal) > 1))
IBM
exe abrevation
Executable (File Name Extension)
(or)
Execute.
what is .net?
What is the difference between managed and unmanaged code?
What are the types of assemblies and where can u store them and how ?
what is data Adapter?
what is the syntax code for oldb to connect oracle?
using System.Data.Oledb;
Oledbconnection cn=new OleDbConnection("Provider=Msdaora.1;uid=;pwd=;server=
");
cn.open();
How do you merge two datasets into the third dataset in a simple manner?
ds1.Merge(ds2,true)
How many sub-reports can report can have?
maximum 256
What is the difference between User Controls and Master Pages
Ans : Q.No: 63
What is boxing?
converting value type to reference type is called boxing.
where we use javascript and for which purpose we use javascript how?
Ans: Q.No: 64
GE
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 server. When true, this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.
I have to send data throug querystring from one page to another. But it should not be displayed in URL. How it is possible?
using hidden feilds
By URL rewriting
How many .rpt files are be there in a main report having 2 sub reports?
there are 3 .rpt files including the main and 2 sub report.but when the subreports are inserted into main it will behave like one only.
Does Crystal Report support all the functions that we have in Oracle?
No, Crystal report does not support all the functions. Like Decode function is there in SQL but not there is crystal report. You need to convert that in crystal report format (in if and else etc.).
What is command routing in MFC
Check the Command pattern in Gof books, MFC almost use it in the same way:SubWidget in the dialog will catch it firstly, it will forward it to Parent window(the dialog) if *request is not for it or no handler defined.
This procedure runs recursively, until one handle it or pass it to application object. Application will omit unknown command by default
Birlasoft
Write a simple program on cursors?
Find out the 3rd highest salary?
select a.sal from emp a where 3=(select distinct(count(b.sal))
from emp b where a.sal<=b.sal) What are user defined stored procedures ? Stroed procedures are basically set of sql statements.User defined stored procedures are created by users in which they can use functions,procedures to get the desired result from database. Difference between views and materialized views? VIEWS: Takes the output of a query M.VIEWS: Stores the output of a query,Views can't store the results of a query. What is a self join ? A table is joined itself is called self join or Self referential integrity. What are different types of joins ? 1.Equi join 2.Non-equi join 3.cartegian join 4.outer join(+) >> a)left outer join
b)right outer join
5.self join
What is a trigger ?
Triggers are basically PL/SQL procedures that are associated with tables, and are fired whenever a certain modification (event) occurs. The modification statements may include INSERT, UPDATE, and DELETE.
The general structure of triggers is:
CREATE [OR REPLACE]TRIGGER trigger_name
BEFORE/AFTER
INSERT/UPDATE/DELETE ON tablename
[FOR EACH ROW [WHEN (condition)]]
BEGIN
...
END;
What is referential integrity ?
A rule defined on a column (or set of columns) in one table that allows the insert or update of a row only if the value for the column or set of columns (the dependent value) matches a value in a column of a related table (the
referenced value). It also specifies the type of data manipulation allowed on referenced data and the action to
be performed on dependent data as a result of any action on
referenced data.
What is a constraint. Types of constraints ?
Constraint means it is rule which you want to apply on the table. There are two types of constraints.
1. Column Constraints: Applicable for that column only.
2. Table Constraints: Applicable for more than one column.
Column Constraints:
unique
not null
primary key
foreign key
default
check
Table constraints:
unique
primary key
foreign key
check
What is an index and types of indexes. How many number of indexes can be used per table ?
Index is a method used for faster retrieval of records.different types of indexes are
1.primary key index
2.unique index
3.bitmap index
4.hash index
5.function based index
6.B-tree index(default index created) on table.
7.Virtual index(which do not show entry in DBA_segment).
Indexs are used for the faster retrivel of data.
two types of indexes
Cluster index,unclustered index
we can have one cluster index and upto 249 uncluster indexes for a table
What is normalization ?
Normalization is the process of organizing the table to remove redundancy.
What is @@rowcount and with small code snippet explain the usage?
@@rowcount gives the number of rows given as an result of previous query ran.
Create procedure get_emp_count ( @emp_id int)
As
Select * from emp where emp_id =@emp_id
If @@rowcount = 0
Begin
Select 'no rows with emp_id= '
Select @emp_id
End
(OR)
UPDATE authors SET au_lname = 'Jones'
WHERE au_id = '999-888-7777'
IF @@ROWCOUNT = 0
print 'Warning: No rows were updated'
CSC
What is the basic functions for master, msdb, tempdb databases?
Master , MSDB and TempDB these are the inbuild Database which r provided by SQL SERVER.
All have their own functinality & responsbility like.
Master : Master DB is responsible for Storing all information at
system level.
MSDB : it is Microsoft DB, it creates a Copy of whole Database in it
TempDB : it stores all the log information of Server,it will initilize
automatically whenever Server will start,the max. size alloted from
TempDB is 10MB.
Honeywell
If we want to construct our own Garbage collector what are the steps things we have to do?
If you want to implement your own GC, you need to define you own memory cleaning by implementing destructors.
Also you have configure your GC in a separate long running thread which should be of Daemon Thread. (Background thread).
If we want to call the Garbage collector,use this command
system.gc.collect()
How Garbage Collector identifies the objects which are not in use?
Garbage Collector identifies a unused object using "referce counting"
reference countiing: how many times the object is used if the count is zero..its is unuesd....now the gc will release the resources..
C# makes use of the Finilize() destructor for this purpose.The CLR periodically checks the entire program for unused objects using the refrence tracing garbage collector which in turn invokes he Finilze() destructor to relese the memory of such objects.
Tell me about the internal working of Garbage collector?
The main objective of GC is Memory Management...Gc wil take initiative when ever the application meemory is low...we hav Finalize() method which runs implicitly...and Dispose() method which we hav to kal Explicity....
Gc identifies the unused objects with reference counting concept.Finalize() method runs implicitly and free the resources if the object having no references...in the case of Dispose() method it wont mind if the reference r ther.....
Gc maintain 4 Generation...start with 0 ..ends with 3 if GC released the resources using Finalize method() still u can get the object..coz dis method havin backup...it stores in generation0-3.
what is data access layer?
Data Access Layer which is receive a request from buisness object layer and speaks to database , get the result and return to buisness object.All sqls and Stored procedure execution will be placed.
Data access layer is nothing but EIS(Enterprise Information Server)which can store the databse objects associated to the webapplication.
If there is a Model class,View class,Controller class then How these are internally related? Which layer objects instantiated in which
layer? How they communicates?
If we will take in DotNet technology. Web based applications has implemented MVC Pattern.
ASPX is the View Class
ASPX.CS is the controller class
If we are using any Application Blocks / DLL Components that are model class.
What are actually Model,view,Controller in MVC Pattern?
MODEL:Model is nothing but storing the databse objects.
VIEW: View is nothing but userinterface
CONTROLLER: Controller is nothing but handling the requests and sending the response.
Which Design Patterns you know?
For this question u can answer like Singleton design pattern ,DAO and DTO,MVC.
The design pattern is broadly classified into
1. Creational (Factory, Abstract Factory, Singleton Prototype, and Builder)
2. Structural (Composite)
3. Behavioural (Observer)
what is MVC Pattern?
MVC is the one of the design pattern which enables you to de-coupling the modules.
MODEL:It cane be used to store the database objects.
VIEW: It can be used to view purpose,to giving the user input.
CONTROLLER:It is the main component in the MVC pattern,which can handle request and response mechanism.
If we want to connect to many databases in dataaccess layer such as MSAccess,Sql server,oracle means not to a particular database depends on condition we have to connect to appropriate database in this scenario if we without changing code Ho do you handle thissituation?
and use this Key name where it is needed
If you need SqlServer DataBase
using System.Data.SqlClient;
in DataAcess Layer
public SqlConnection Connection()
{
try
{
con = new SqlConnection (ConfigurationManager.AppSettings["SqlServerDatabase"].ToString().Trim());
return con
}
catch (Exception exp)
{
throw exp;
}
}
What is the difference between NOROW and LOCKROW?
When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory?
before invoking derived class constructor base-class constructor should be called.
first base-class object will be created then derived-class object will
be created.
here the base class constructor is private, so derived-class cannot
invoke it.
No object is created in derived-class.
Tech Mahindra
In which conditions do you opt for Remoting services?
Remoting can be prefered
Both server and Client sit in different machine.
Both server and client are .NET applications
The state of the objects transfered accross the network
should be maintained.
The objects of the IDictionary interface should be transfered accross
the network.
we are working in .net namespaces like using system.io,system.text.
these namespace before we use "using " keyword what means of using?
using keyword is used to intimate the compiler to load supported name spaces for our program.
Is it possible to use two versions of assembly at the same time?If possible explain with code?
First u have to create Windows Service..
For install Windows Service , u have to use one Command
first Build Windows Service..then use this command..
installutil.exe
installutil.exe/u-->For uninstall
u have to use this command in visual studio 2005 -> visual studio command Prompt -> write this above command..
Go in Particular path where u create Windows Service then go to Bin -->Debug --> then implement this above Command..
what are the differences between windows services and web services?
An XML Web service is a component that implements program logic and provides functionality for diseparate applications. These applications use standard protocols, such as HTTP, XML, and SOAP, to access the functionality. XML Web services use XML-based messaging to send and
receive data, which enables heterogeneous applications to interoperate with each other. You can use XML Web services to integrate applications that are written in different programming languages and deployed on different platforms. In addition, you can deploy XML Web services within an intranet as well as on the Internet. While the Internet brings users closer to organizations, XML Web services allow organizations to integrate their applications.
A Windows service starts much before any user logs in to the system (if it has been setup to start at boot up process). A Windows service can also be setup in such a way that it requires a user to start it manually ? the ultimate customization!Windows services run as background processes. These applications do not have a user interface, which makes them ideal for tasks that do not require any user interaction. You can install a Windows service on any server or computer that is running Windows 2000, Windows XP, or Windows NT. You can also specify a Windows service to run in the security context of a specific user account that is different from the logged on user account or the default computer account. For example, you can create a Windows service to monitor performance counter data and react to threshold values in a database.
what is the difference between trigger and storedprocedures
procedure is invoked explicitly by the user and trigger is executed
implicitly.
procedure cannot have the same name as table name,funtion name or
package name but trigger can have same name as table name or
procedure name.
Trigger is compiled code where as stroed procedure is not.
triger in action which is performed automatically before or after a
event occur and stored procedure is a procedure which is executed
when the it is called.
Is it possible to use two versions of assembly at the same time?If possible explain with code?
It is possible. I think it is called as side by side execution.
CapGemini
what is a virtual class?
In multiple inheritance when a class D is derived by two base classes B and C and both base class is also inherite by same class A then then class D will get duplicate copy of uppper most base class A.In this case class A will declare as virtual class
What is the difference between ExecuteReader,ExecuteNonQuery
and ExecuteScalar.
ExecuteReader - This method returns a DataReader which is filled with the data that is retrieved using the command object.
ExecuteNonQuery - This method returns no data at all. It is used majorly with Inserts and Updates of tables.
ExecuteScalar - Returns only one value after execution of the query. It returns the first field in the first row.
can i use store procedure in disconnected mode?
Store procedure is used in disconnected mode because procedure are compiled only once and it is used in dataset also
difference between
in Web.Config can be used to store Settings which are applicable for the whole Application
is a node within in the Web.config
it can be used to store the Connection String
How to handle error while project running on live
Only using application error log file and to show internal server error
can we add connection string in global.asax?????????? 2.what are the default files included when we create new web application????
We can't add connection string in global.asax file. we can create
connection string in web.config file only.
global.asax,web.config,Default.aspx files and
app_code,app_data,app_themes folders.
What is the difference between Remoting & Web Servcies?
Web Services:
- accessed only over HTTP
- work in a stateless environment
- support only datatypes defined in the XSD type system
- support interoperability across platforms
- highly reliable
- easy to create and deploy
Remoting:
- can be accessed over any protocol
- support for both stateful and stateless environment
- support for rich type system
- homogenous environment
- if IIS is not used, application needs to provide plumbing for
ensuring the reliability
- complex to program
What is the roll of JIT in asp.net?
JIT allows parts of your application to execute when they are needed.
JIT convert Intermediate languge(IL) to machine code at run time or at
the point where the software is installed.
Suggest 3 best practices in detail for for Developing High
Performance Web and Enterprise Applications
Used Disconnected architecture like dataset
Used as possible as All HTML controls
Used all client side validations only
Used cursors for more than one rows
Used Cache for maintain state which is came from database
Developing Applications using Classes.[It means 3tire architecture]
Using JavaScript and XML when the designing and implementing webpages.
Using Stored Procedures to generate a call to DataBase.
My website has around 100 aspx. Out of this, a certain 20 aspx
files should be made available to the users only if they are
logged in. How can I achieve this with the web.config file?
what is purpose of xml control in standard controls of asp.net
Actually all data is transfer from place to other place in the form of xml formate so it is very easy to transfer
What Are The Difference Between AutoEventWireup="true" and
AutoEventWireup="False"
if the AutoEventWireup="true" propety in dropdown when index changed automatically post back to the server.
if the AutoEventWireup=" False" propety in dropdown when index changed will not post back to the server.
How many Controls present in Asp dot net?
There are three types of control in ASP.NET
1.- USER CONTROL (.ASCX)
2.- CUSTOM CONTROL (.DLL)
3.- WEB CONTROL
If Asp Dot Application is stateless what happened? during designing
asp.net is stateless Both ASP and ASP.NET are stateless. Because both ASP and ASP.NET uses HTTP protocol which is stateless
how can i am search the data from database? just like google
SELECT * FROM EMPLOYE WHERE DETAILS LIKE '%%'
This is the simplest query for that...
what istag?
It allows you to specify configuration details for particular folder or file in the Web.config file.
What is Active Directory? What is the namespace for that?
Active Directory Service Interfaces (ADSI) is a programmatic interface for the Microsoft Windows Active Directory. It enables your applications to interact with different directories on a network using a single interface.
Namespace:
-----------
System.DirectoryServices
Explain Generics?
The most common use of generics is to create collection classes.
Generics does not require boxing and unboxing while inserting and
retrieving elements.
By Performane wise Generics were fast
Generics are type safety.
With out Web.config can we executes the application?
Yes, application will inherit cofiguration setting from machine.config
file
if our web.config does not contain any connectionStrings then we can
run the application with out web.confing file
What is the Impersonation?and what is the importence of that?
Impersonation is nothing but applying different themes and skins to a particular web page or website.
Can we use the java script code in .Net Code behind?
yes we can use javascript in code behind.
Define the script block that contains the JavaScript function. You can add this directly to the HTML of the page.
Insert the script block by the
Page.RegisterStartupScript() or the
Page.RegisterClientScriptBlock() method.
or by using updatepanel by raising an async postback using JavaScript code
What is Runtime callable wrapper?
A Runtime Callable Wrapper (RCW) is a proxy object generated by the .NET Common Language Runtime (CLR) in order to allow a Component Object Model (COM) object to be accessed from managed code. Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.
For example, a managed application written in C# might make use of an existing COM library written in C++ or Visual Basic 6, via RCWs.
what is COM Object in Dot net?
Component Object Model is a method to facilitate communication between different applications and languages.
The following steps explain the way to create the COM server in C#:
Create a new Class Library project.
Create a new interface, say IManagedInterface, and declare the methods
required. Then provide the Guid (this is the IID) for the interface
using the GuidAttribute defined in System.Runtime.InteropServices.
The Guid can be created using the Guidgen.exe. [Guid("3B515E51-0860-
48ae-B49C-05DF356CDF4B")]
Define a class that implements this interface. Again provide the Guid
(this is the CLSID) for this class also. Mark the assembly as
ComVisible. For this go to AssemblyInfo.cs file and add the following
statement [assembly: ComVisible (true)]. This gives the accessibility
of all types within the assembly to COM.Build the project. This will
generate an assembly in the output path. Now register the assembly
using regasm.exe (a tool provided with the .NET Framework)- regasm
\bin\debug\ComInDotNet.dll \tlb:ComInDotNet.tlb This will create a
TLB file after registration.Alternatively this can be done in the
Project properties -> Build -> check the Register for COM interop.
The COM server is ready. Now a client has to be created. It can be in
any language. If the client is .NET, just add the above created COM
assembly as reference and use it.
What command line used to generate Runtime callable wrapper.
tlbimp.exe,
for example:
tlbimp
InteropExample.dll /output:InteropExampleRCW.dll /verbose
What is the difference between Postback and Ispostback Property?
PostBack: Postback is the event which sends the form data to the server. The server processes the data & sends it back to the browser. The page goes through its full life cycle & is rendered on the browser. It can be triggered by using the server controls.
And the IsPostBack property of the page object may be used to check whether the page request is a postback or not. IsPostBack property is of the type Boolean.
What is CTE in sql server 2005?
Common Table Expressions, It is return temporary result set from inside a statement.
which one is faster execute reader, scalar, execute non query ?
can machine.config file orverrides web.config. For example: if u set
session timeout as 30 mins in web.config file to a particular
application and if u set session timeout as 10 mins in machin.config.
what will happen and which session is set to the appliction?
As the Web.Config file defines application level settings.It'll override the settings of the machine.config file.So the session timeout as 30 mins defined in web.config file is set to the application.
Is There any Third party tools are using in .Net Technologies? Can u Explain?
The name of the Third Party Tool is Telerik Controls.
How to refresh a page in asp.net
by using ispostback property or by using ajax controls
by calling javascript function in asp.net you can also refresh page
How can i include both C# and vb.net classes in same solution?
Step 1:
It is possible,In app-Code folder create sub folders named VB,CS(as you like) and create .vb class files in the folder named VB and .cs class files in the CS folder.
Step 2:
Go to web.config file and mention the following
Difference between Stored procedures and User Defined functions[UDF]
Stored procedureA stored procedure is a program (or procedure) which is physically stored within a database. They are usually written in a proprietary database language like PL/SQL for Oracle database or PL/PgSQL for PostgreSQL. The advantage of a stored procedure is that when it is run, in response to a user request, it is run directly by the database engine, which usually runs on a separate database server.
User-defined functionA user-defined function is a routine that encapsulates useful logic for use in other queries. While views are limited to a single SELECT statement, user-defined functions can have multiple SELECT statements and provide more powerful logic than is possible with views.In SQL Server 2000User defined functions have 3 main categories
Scalar-valued function - returns a scalar value such as an integer or a timestamp. Can be used as column name in queries
Inline function - can contain a single SELECT statement.
Table-valued function - can contain any number of statements that populate the table variable to be returned. They become handy when you need to return a set of rows, but you can't enclose the logic for getting this rowset in a single SELECT statement.
Differences between Stored procedure and User defined functions
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
Inline UDF's can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
Of course there will be Syntax differences and here is a sample of that
Stored procedure Code: SQL
CREATE PROCEDURE dbo.StoredProcedure1
/*
(
@parameter1 datatype = default value,
@parameter2 datatype OUTPUT
)
*/
AS
/* SET NOCOUNT ON */
RETURN
User defined functions Code: SQL
CREATE FUNCTION dbo.Function1
(
/*
@parameter1 datatype = default value,
@parameter2 datatype
*/
)
RETURNS /* datatype */
AS
BEGIN
/* sql statement ... */
RETURN /* value */
END
Can we change the session timeout in ASP.NET, if yes then how and from where?
By default session time out is 20 minutes but one can change it. there are two ways to change the sessiontime out in asp.net that is:-
1) from web config. file by setting the session timot element eg.
or
2) by doing programtically eg.
session.timeout=60
What is three major points in WCF?
1) Address --- Specifies the location of the service which will be like http://Myserver/MyService.Clients will use this location to communicate with our service.
2)Contract --- Specifies the interface between client and the server.It's a simple interface with some attribute.
3)Binding --- Specifies how the two paries will communicate in term of transport and encoding and protocols.
Write 5 best test cases like any password? Password should be mixed case with at least one
number or special characters?
Check for empty password it should fail.
Check for all alphabetic password it should fail
Check for all numeric password it should fail
Check for all special character password it should fail
Check for all mixed password it should succeed.
How can we convert XML data into Database table IN .Net?
dSet.ReadXml (Server.MapPath ("Forms.xml"))
What is the Difference between direct cast and ctype?
The difference between the two keywords is that CType succeeds as long as there is a valid conversion defined between the expression and the type, whereas Direct Cast requires the run-time type of an object variable to be the same as the specified type. If the specified type and the run-time type of the expression are the same, however, the run-time performance of DirectCast is better than that of CType. DirectCast throws an InvalidCastException error if the argument types do not match.
Dim t As String = "5"
Dim s As Integer = CType(t, Integer)
Dim t As String = "5"
Dim w As String = DirectCast(t, String)
What is the Difference between a sub and a function?
Sub keyword is used for the procedures and procedures never return a value where function key word is used for function and function returns a value that can be assigning to any
Variable.
What are the two kinds of properties?
Get and Set are the two kinds of properties..
What is the raise event used for?
It is used for raising the error from sql statement
Explain constructor.
Constructor is like a method with a same name as of ur class name ,no return type.It is used to initialize the memebr variables of the class.If there is no contructor provided compiler invokes the default constructor. the Moment there is contructor is provided to the class it can be any either default or parameterized the compiler stops invoking it own default
constructor
What is a system lock?
System Lock locks the desktop until correct password is being given
Can i have both C# and vb.net code in same assembly?how?
Yes you can add C# and VB.Net code in the same asssembly. For that add a new item to the project. Give the name of the file as Class1.vb if you want to add a vb code and Class1.cs if you want to add C# code.
When you compile the project it will compile to a single assembly. The language does not matter in the end since everthing
will be compile to MSIL.
Webconfig file is cofiguration of server or browser?
Server
Suppose, I have 3 pages, Page1.aspx, Page2.aspx, Page3.aspx. All pages are in diff. server. When user req. for a page, Page1.aspx opens Ist & a session established. If user req. for IIn page, second session established. Similarly, 3rd session established if user req. 3rd page. In this scenario, tot. 03 sessions are established. How we can minimize it so that it will work with only one session?
OUT PROC : Maintain the session in the SQL server.
can we transfer data from one page to another page using viewstate if so how?if not y?
By using viewstate it is not possible.sure it is not possible.bcoz its comes under the pagelevel state manage ment.to maintaning the state in page it self we are using the view state.
so viewstate object is available only after page_init() and
before page_load().
what are Httpmodule and HttpHandler?
http handler is a information between the web browser and web server
The HTTP handler is used in web services
An HttpModule is an assembly that implements the IHttpModule interface and handles events. ASP.NET includes a set of HttpModules that can be used by your application. For example, the SessionStateModule is provided by ASP.NET to supply session state services to an application. Custom HttpModules can be created to respond to either ASP.NET events or user events.
Suppose you display a data having 200 records in a datagrid. Then you
edit 100 records of them. Now when you will press update button,all
100 records should be updated in single shot rather than reading
every record and updating. How to do it?
Here, bind primary key of database to datagrid column make it visible false.and travel loop as
foreach(DataGridItem dataItem in DataGrid1.Items)
{
priceText = (TextBox)dataItem.FindControl("txtBookPrice");
bookIdText = (TextBox)dataItem.FindControl("txtBookId");
Updatecode_for_perticular_row ();
}
txtBookPrice= textbox from witch u would like to update
txtBookId= test i.e. unique id comming from database
With help of unique id in for loop find perticular text in texbox and update.
This code you will write on update button click.
Write a code for "RequiredFieldValidator" in java script
suppose the id of the field required to be validated is NameId
Thus:-
function validate()
{
if(document.getElementById("NameId").value == null)
alert("Please enter the name");
}
How to set/get parent page values in child page in asp.net?
get= var uid=document.getElementById('txtUserId').value;
set= document.getElementById('txtUserId').innerText=uid;
What is web.config. How many web.config files can be allowed to use in
an application ?
The web.config file is the configuration file of the web application. This means that the configuration settings of the application [such as authentication, authorisation, tracing, debugging, connectionstrings, ...] can be changed through the web.config file.
The main advantage is that that the changes made in the web.config file will be applicable to the web application without having to change the code of the application and without recompiling the application.
The root folder of a web application can have only one web.config file. But any inner/ sub folders can have a web.config file. It web.config file in the sub folders will override the one in the root folder of the application.
Can you explain the difference between an ADO.NET Dataset and an ADO
Recordset?
In ADO recordset(in memory representation of data) looks like single
table
where as
in ADO.NET dataset(in-memory representation of data) is a collection of one or more tables(use JOIN Query).
In ADO you communicate with the database by making the calls to an
OLEDB Provider
where as
in ADO.NET you communicate with the database through a Data Adapter(an OledbDataAdapter,SQLDataAdapter,OdbcDataAdapter or OracleDataAdapter object) which make calls to an OLEDB Provider or the API's provided by the underlying datasource.
In ADO recordset objects operate in a fully connected state
where as
in ADO.NET dataset operate in disconnected state.
ADO requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.
where as
ADO.NET does not require data-type conversions.
In ADO it is sometime sproblematic firewalls( firewalls are typically configured to allow HTML text to pass, but to prevent system-level requests (such as COM marshalling)from passing) prevent many types of requets
where as
in ADO.NET datasets using XML, firewalls can allow datasets to pass.
how validation controls will be executed on client and server?
Validation controls are execute on clien-side.They contains isValid property which is used to valid the control.Then it executes on the server.
What Name space does the web page belon in the .net framework class
hierarchy?
System.web.UI.Page
What is the difference between java and java script?
Java Script is object based language it is used for front end validations.java is object oriented language.object oriented language
supports OOP's,Object based not suppoted inheritence.
why you used Java Script? Can it use for both client side and server
side validation purpose?
Mainly used for client side scripting purpose.JavaScript is a platform-independent,event-driven, interpreted client-side scripting and programming language.
javascript cannot be used as server side scripting.
Does c++ support multilevel and multiple inheritance?
Yes ,c++ supports multilevel and multiple inheritance
Accenture :
What is Reflection in .NET?
It is used to get Class info. at the runtime.
The Class info. defines::no. of
constructors,methods,isobject,isvalue,issealed,ispublic,...
This can be achieve through Reflection.
How many .rpt files are be there in a main report having 2 sub
reports?
there are 3 .rpt files including the main and 2 sub report.but when the subreports are inserted into main it will behave like one only.
If you are calling three SPs from a window application how do u check
for the performance of the SPS ?
We can check the performance of SP's with SQL Profiler
What provider ADO.net use by default?(check)
no default provider
sql provider
Which is better in performance - CONSTRAINT or TRIGGER over a column
which restricts say an input of particular value in a column of a
table?
Constraint is better in terms of performance for same operation.
Which databases are part of SQL server default installation? Explain
the usage of each?
key default dbs :-
Master db : Holds info of all dbs located on SQL Server insytance.
Main db (else SQL Server won't work !)
MSdb : Stores info regarding Backups, SQL Agent info, DTS packages,
SQL Server jobs, replication info for log shipping.
Tempdb : To hold temp objects like global & local temp tables, sps
Model db: Used in creation of any new database within the SQL Server
instance of which it(model) is a part.
how do u achieve multilevel inheritance in .NET ?
by uing interfaces we can implement multiple inheritance
What is gacutil.exe. Where do we store assemblies ?
gacutil is a tool that will list, install, and uninstall assemblies in the GAC.
Where does web.config info stored? Will this be stored in the registry?
web.config contains authorization/authentication session related information.It is stored in the root directory of your application.Optionalyy you individual web.config can be created in each sub directory of your project if required.
How do you do role based security ?
Create a principle object which contains users identity (login name) and array of roles and pass this object to HttpContext.Current.User
The roles supplied to this object will be checked against
roles specified in the web.config file,if they matched then
they are allowed access to the page otherwise not.
allowed roles can be specified like this in web.config
How do you register the dotnet component or assembly ?
The steps to register a dot net component is:
The command line instruction to create a strong name.
sn -k ComInterOp.snk.
Strong name is a unique name created by hashing a 128-bit encryption key against the name of the Assembly (ComInterOp in our case). The strong name is created using SN.exe,that would create ComInterOp.snk file, which we would use while
creating the DotNet Assembly.
The command line instruction to create an assembly using the strong name
vbc /out:ComInterOp.dll /t:library /keyfile:ComInterOp.snk
Assembly Registration Tool.
The Assembly Registration Tool (Regasm.exe), reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create DotNet Framework classes transparently. The Assembly Registration tool can generate and register a type library when you apply the /tlb: option. COM clients require that type libraries be installed in the Windows registry. Without this option, Regasm.exe only registers the types in an assembly, not the type library. Registering the types in an assembly and registering the type library are distinct activities.The command line instruction to create and register ComINterOp.tlb(Type Library) is
regasm ComInterOp.dll /tlb:ComInterOp.tlb.
The DotNet Services Installation Tool (Regsvcs.exe)
The command line instruction to install ComINterOp.dll in GAC is
Gacutil -i ComInterOp.dll.
About DTS package ?
It is Sql server object used to transfer data from Database into Execel, Notepad etc.
What does assemblyinfo.cs file consists of ?
AssemblyInfo.cs file contains details about the assembly name,version info.,security info. and various details including company,description and trademark etc.
What is strong name and which tool is used for this ?
Strong Name is to be assigned to shared assembly. when more then one application is going to use that dll/assembly,that assembly has to assign a strong name and has to be place in GAC(Global Assembly Cache).
sn.exe is used to generate a strong name.
What is shared and private assembly ?
Shared assemblies are accessed by more than one application and they are stored in GAC. private assemblies are accessed by only one application and they are stored in application directory and one of its subdirectory.
What are the types of assemblies and where can u store them and how ?
Please note there are three types of Assemblies.
Private - Assembly available only to clients in the same
directory.
Shared - Assemblies in GAC
Satelite - Assembly in the specific directory of the locale.
If you are using components in your application, how can you handle exceptions raised in a component ?
I think for simple Handling of Exceptions, we keep TRY,Catch Block and catch the exception and handle those ones.
Types of optimization and name a few ?
For SQL --
Heuristic Optimization
Syntactical Optimization
Cost-Based Optimization
Semantic Optimization
What are Authentication mechanisms in .Net?
there are 3 types of authentication mechanisams in .net.there are
1)forms authentication
2)windows authentication
3)passport authentication
What are the differences between Trace and Debug?
trace allows us to view how the code executed in details.
Debug allows line by line exection..
What is Boxing and Unboxing?
Boxing is to implicitly converting value type to refrence type,
int x = 10;
y = x;
Unboxing is to explicitly converting refrence type to value type
double y = 10.234;
int x = (int)y;
How to write unmanaged code and how to identify whether the code is
managed /unmanaged?
unmanaged code is not varify by clr,and clr is not varify third party
control and pointer.
Unmanaged code use like using dll or any other com object in
application then it is unmanaged code ,we cannot change the code.
How do you relate an aspx page with its code behind Page?
Inherits page.aspx.cs.
Can we throw exception from catch Block?
we can throw the exception in catch block by using throw New Exception("Exception Message")
How do you do exception management?
using try catch bolcks
How does Garbage collector(GC) works in .net?
In .net the garbage collection is called by the class
system.gc.collect
It manages the unused objects and releases the memory.
can sn.exe can be used before gacutil.exe
yes , sn.exe is an commandline tool which we asign a strong name sn -k and it can be placed into GAC(Global Assembly Catch)
About DataAdapters ?
Data Adapters provide interaction between DataBase and Dataset.It provide the functionalities like reading the data from database,update the data,filter the data and write the data to Database
About duration in caching technique ?
Duration will specify life time of caching content. 20 minitues
Types of object in asp ?
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
Difference between Response.Expires and Expires.Absolute ?
Response.Expires specifies the lenght of the time ie 20 seconds
Response.ExpiresAbsolute specifies the time ie 12:12:10
What is stateless asp or asp.net ?
Both ASP and ASP.NET are stateless. Because both ASP and ASP.NET uses HTTP protocol which is stateless.
What are asynchronous callbacks ?
call multiple threads at a time
What is a transaction and what are ACID properties?
A transaction is a sequence of sql Operations(commands),work as single atomic unit of work. To be qualify as "Transaction" , this sequence of operations must satisfy 4 properties , which is knwon as ACID test.
A(Atomicity):-The sequence of operations must be atomic,either all or no operations are performed.
C(Consistency):- When completed, the sequence of operations must leave data in consistent mode. All the defined relations/constraints must me Maintained.
I(Isolation): A Transaction must be isolated from all other transactions. A transaction sees the data defore the operations are performed , or after all the operations has performed, it can't see the data in between.
D(Durability): All oprtaions must be permanently placed on the system. Even in the event of system failure , all the operations must be exhibit.
What is the difference between managed and unmanaged code?
A code that executed under the instructions of CLR is called managed code.
A code that execute without the instruction of CLR is called
unmanaged code.
How do you merge two datasets into the third dataset in a simple
manner?
ds1.Merge(ds2,true)
When is an object created and what is its lifetime?
whenever developer is required, and the life-time is when we assinging null or close the program(application).
How many sub-reports can report can have?
0-256(maximum 256)
What is the difference between User Controls and Master Pages ?
Both are code reduce features and reusability Purpose.When we create
Masterpage that is common to overall project,whereas user controls
these r used when we have requirement on specific criteria.
Master pages are used to provide the consistent layout and common
behaviour for multiple pages in your applications.then u can add the
contenetplaceholder to add child pages custom content.
User Controls:Sometimes u need the functionality in ur web pages which
is not possible using the Built-In Web server controls then user can
create his own controls called user controls using asp.net builtin
controls.User controlsn are those with .aspx extensions and u can
share it in the application.
where we use javascript and for which purpose we use javascript how?
Javascript is a clint side scripting. Mostly used for validations.
Satyam
IS MS.Net platform independent or dependent?
.Net is not platform independent , it's only language independent
What is the main Difference Between .Net 2003 and .Net 2005.and also
Asp1.1,Asp2.0 and Asp3.0
Difference b/w .net 2003 & .net 2005
vs.net2003 doesn’t carry personal webserver.whereas vs2005 will
carrying personal web server called asp.net development server
Vs.net2003 will create set of different files for asp.net
applications. this makes development complex.Whereas in vs.net2005
will support project less appln developement.for asp.net this will
create only required files for asp.net appln. This makes development
easier.
2003 will support only code-behind tech.whereas 2005 will support in-
page tech and code behind tech.
2003 only support one language for WebPages with in asp.net appln,
whereas 2005 will support different languages for WebPages with in
asp.net appln.
Which is the best way for keeping the data in XML or SQL server..and
why?
To store the data, the best and appropriate way is SQL SERVER as it is more compatible with any language and gud database.i think for a short term XML also plays vital role in storing the data.
What does the term immutable mean?
it means that this object can't be changed.but if you want another value to the same object another instance of the object is created and leave the current instance unchanged.an example of immutable is STRING.
What does the keyword virtual mean in the method definition?
The method can be over-ridden.
What are advantages of Stored Procedures?
Stored Procedure's are precomplied one. When ever you call a stored procedure it generate the result faster than ordinay coding. The improve the performance of the application i.e to reduce the time stored procedure's are used
Explain the usage of WHERE CURRENT OF clause in cursors ?
WHERE CURRENT OF clause in an UPDATE,DELETE statement refers to the latest row fetched from a cursor.
how to implement locking in sql server?
no need to impliment locks sql server automatically holds locks.
Difference between Cluster and Non-cluster index?
clustered index is physically stored a table can have 1 clustered
index
non clustered index is logically stored a table can have 249 non
clustred index
what is web server?
web server is a software which is responsible to execute server side script such as asp,php and etc.and send a html page to client.so finally we can say that web server is use for execute script(server side) and response send to client.
How to refresh the crystal report from the application ?
calling crystalreportcontrolname.reset (by selecting Report menu under
Refresh the report menuitem at design time)will refresh the report.
crystalreport1.DiscardSavedData=True
can i use two web.config files of ConnectionString in One Default.aspx
page?
we can have more than one web.config file in an application. We can have web.config file for every folder in application.but not 2 web.cofig in one place.
What is the difference between Server.Transfer and Response.Redirect?
Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server, Server.Transfer does not update the clients url history list or current url.
Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.
Dategrid filtering and sorting How can we sort all the fields at once?
Undoubtedly u need to write a sql query for this with the order by (or) sort by.And also call the subroutine that fills the datagrid after each insert or delete so that u can see the changes at the runtime with the new alignment(i mean sorting)...
What are generics? why it is used? architecture of ASP.NET?
Generics are new in .NET 2.0.It is used to define a type while leaving some details unspecified.Generics are the replacement of "Objects" in .NET1.1 Generics reduces the run-time error and increases the performance.
what are the attributes of sitemapnode?
Title,url,description
How do you make your site SSL enabled ?
ssl-secure sockets layer:
If you want user certificate authentication enabled, figure out who should have access to your site, and how to distinguish this group from all other users. Some examples of groupings:
Fermi people (i.e., FNAL.GOV Kerberos domain users eligible for KCA certificates) DOE-affiliated people (i.e., anyone who has DOEGrids certificate) Specific individuals with certificates from a known set of CAs
Anyone with a certificate issued by a particular CA and connecting from a particular domain (e.g., fnal.gov)Some combination of the above.
What is CTS, CLS and CLR ?
Common Type System(CTS) :A fundamental part of the .NET Framework's Common Language Runtime (CLR),the CTS specifies no particular syntax or keywords, but instead defines a common set of types that can be used with many different language syntaxes.
Common Language Specification(CLS):The Common Language Specification (CLS) describes a set of features that different languages have in common.The CLS includes a subset of the Common Type System (CTS).
The CLR is a multi-language execution environment
If cookies is disabled in client browser will session work ?
Sessions are normally tracked with cookies. However, clients are not required to accept cookies. Furthermore, you can turn off the use of cookies for session tracking altogether in the Web Application Server Control Panel.However when cookies are turned off or cookies are not enabled on a specific client computer, the server must work harder to track the session state, which has a performance impact. The recommendation is to leave cookies on and let the server automatically fall back to the cookieless operation only when required by a specific client connection.
When a session is created by the server, some information is automatically stored in it - the session ID and a timestamp. as an application developer, you can also store other information in the session in order to make it available to subsequent requests without explicitly passing it to that request.
About Global.asax ?
Global.asax is a file that resides in the root directory of your application. It is inaccessible over the web but is used by the ASP.NET application if it is there. It is a collection of event handlers that you can use to change and set settings in your site. The events can come from one of two places - The HTTPApplication object and any HTTPModule object that is specified in web.confg or machine.config. We will be covering both here.
it contains 7 events....
1.Application start
2.Application End
3.Session on start
4.Session on end
5.Session on Request
6.Application on Begining request
7.Application on Error
About writing a query and SP which is better ?
sp is the better one...
Its compile and inside that we can write any number of Query Statement , finally for the whole thing it will create only one object as a reference .
But in Query Statement Each query be an Objects ...
Difference between Active Exe and Dll ?
EXE is ae executable file, while Dll is not. Dll cannot be used independantly.
The Dll is a reusable component which can be referred by a EXE.
Can two web application share a session and application variable ?
No, can't share. Becoz. both web application session's are different and also for application variables.
What is web application virtual directory ?
Web applications and vitual directories to share the inforamation over an internet , an intranet or an extranet.web sites , web applications and virtual directories are work together in a hirarichacal relationship as the basic building blocks for hosting online content.
web sites containes one or more web applications, web application containes on or more virtual directories.and virtual directory map to physical directory of web server.
Difference between application and session ?
session object is used to store information between http request for a particular user. Application are globally across users.
How to find the client browser type ?
Request.UserAgent
Response.Write(Request.Browser.Type);
Request.ServerVariables("http_user_agent")
we can identify the browser name using javascript
var brw = new navigator();
alert(brw.appname);
alert(brw.appversion);
Microsoft
What is the difference between temp table and table variable?
SYNTAX
Temporary Tables: CREATE table #T (…)
Table Variables: DECLARE @T table (…)
Table Variables are out of scope of the transaction mechanism.If you make changes to a Temp Table inside a Transaction and Rollback the Transaction those changes will be lost.Changes made to Table Variable inside a Transaction will remain even if you Rollback the Transaction
Any procedure with a temporary table cannot be pre-compiled An execution plan of procedures with table variables can be statically compiled in advance
Table Variables exist only in the same scope as variables.They are not visible in inner stored procedures and in exec(string) statements
Table variables are in-memory structures that may work from 2-100 times faster than temp tables.
Access to table variables gets slower as the volume of data they contain grows.
At some point, table variables will overflow the available memory and that kills the performance.
Use table variables only when their data content is guaranteed not to grow unpredictably; the breaking size is around several thousand records.
For larger data volumes, use temp tables with clustered indexes.
What is boxing and how it is done internally?
Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
In case of value type ,value is stored in the stack but after boxing process value is stored in to heap.
What is ODP.NET?
Orcle9i Data Provider for DotNet using this provider we can connect to Orcle DB.
About remoting and web services.Difference between them?
Remoting is a technology used to communicate between applications of same platform and encoding will be in the form of binary.
In the case of web service applications in different platforms can communicate and data will get transferred as xml files
What are the security issues if we send a query from the application?
Third party can able to see your query and also there can be SQL Injection if the query is SQL statement.
Query should be encrypted before sending from application.
Difference between Htttppost and Httpget Methods?
HTTP Get is a protocol is used to get the data from the server side.While coming to the HTTP post to append the data to the client side to server side which can given by the user on URL
what is caching?
Caching is one of the statemanagement technics as well as the optimization. It's small memory location at the server side that will retain the user data for the purpose of subsequent requessts.
what is managed and unmanaged code?
Managed code: A code that is managed by CLR is know as Manged code for example C#,j#,Vb.Net etc
Unmanged code: A code that is not managed by CLR is known as Unmanaged by unmanaged code. for example c++, java, c etc
Have u used webcontrols?Tell me something about these?
Yes, webcontrols are represented in the form of dll.they are compiled content and the controls will appear in the toolbox. cathing is not supported.
Can you store dataset in viewstate?
No, You cant directly store Dataset in ViewState. You can get XML from dataset store that Xml in ViewState. While getting From ViewState convert to xml and then from xml to dataset.
what is Disco?what it will do?
DISCO is the discovery file which gives path to the Webservices
It contains WSDL(Web Service Description Language)When one searches for the Web Services, it will go to the DISCO whcih gives actual info. about the particular Webservices
what is soap?
Soap is a formatting protocal.
When we send data to the webservice the data will be passed in network wire.That data has to formatted by SOAP. and sends to the service.
then the service will give response to that request.This data is also formatted by Soap and give it to the client.
SOAP--> HTTP + XML
The format is XML because it is platform dependent.this service is used by other applications.
can we call webservice in Html form?
yes we can call a webservice from html form.Your web page directory should include the 'webservice.htc'file. This file adds a behavior to html files for calling web services.
How can you assign styles to webforms?
by using cascading style sheets.
what is manifest?
Assembly manifest is a data structure which stores information about an assembly .The information includes version information, list of onstituent files etc.
How can you get public key information?
Using ILDASM-Intermediate Language Disassembler which will open the manifest of that particualar assembly.
what is generics?
Generics are the most powerful feature of C# 2.0. Generics allow you to define type-safe data structures, without committing to actual data types.
what are Httpmodule and HttpHandler?
http handler is a information between the web browser and web server
About Garbage Collector?
garbage collection is a form of automatic memory management.The garbage collector attempts to reclaim garbage or memory used by objects that will never be accessed or mutated again by the application.
Singleton Design pattern? How do you achieve it?
Singleton design pattern we can implement using Static key word that means only one instance.All the instances are coming from the same memory location.
what are webservices?In which circumstances we can go for
webservices?
Web service is a reusable component which resides in the web server.
It is language independant and platform independant. This means that any application written in any language can use the service of a web service. It uses the SOAP protocal and communicates using XML.
what are partial classes and their use?
“partial” keyword can be used to split a single class, interface, or struct into multiple, separate files in ASP.NET (using C# as the language). This permits multiple developers to works on these files, which can later be treated as a single unit by the compiler at the time of compilation and compiled into MSIL code.
Partial classes can improve code readability and maintainability by
providing a powerful way to extend the behavior of a class and attach
functionality to it.
The partial modifier can only appear immediately before the keywords
class, struct, or interface.
Nested partial types are allowed in partial-type definitions.
Using partial classes helps to split your class definition into
multiple physical files.
Note that the partial keyword applies to classes,structs, and
interfaces, but not enums
Difference between .NET components and COM components?
.net component.....>these dlls can be used by any application (platform independant)these components are resolved from dll hell problem
com components.......>platform dependent components
What is an application domain?
Application domain is something that isolates the application from interupting each other.
What are runtime hosts?
Runhosts is a special type where CLR is executed and managed.
How do you do validations. Whether client-side or server-side
validations are better?
Asp.Net has few validation control like compare,requirefield,range ,regulor-expression and custom
u can use any validation control with html ,asp control
Asp.net validation control are by default cilde side validation
and the client side validation is better bcoz it's reduse the burdon to the server.
Features in ASP.NET?
It has Comman Language Runtime execution Engine which translate the source code into Microsoft Intermediate Language (MSIL) .It is called Managed code.
Types of caching. How to implement caching?
there are 3 types of caches is there they are
1)page caching
2)page fragmentaion caching
3)data caching
in case of the page caching the total page will be cached for certain amount of time(i.e the time will declared by ourself)
and in case of page fragmentation caching only a part of the data will be cached for some amount of time
Data caching, which allows developers to programmatically retain arbitrary data across requests
Difference between .NET and previous version?
previous version is the com based which was does not support inheritance, it was object based and it is completley binary standed code.
.NET is the fully object oriented language.
Is overloading possible in web services?
Yes,its possible
Types of session management in ASP.NET?
There are two types of session management in ASP.NET namely, Client side and Server side.
Client side: Hidden forms, Hiddenfields,query strings,Cookies, View
state
Sever side: Application object, Session State, Caching.Each type has
its own advantages and preferences.
What is reflection and disadvantages of reflection?
Reflection is used for accessing assembly related information ie, methods ,properties etc we can dynamically invoke methods using reflection.reflection can use for latebinding of an object.
What is the difference between and ActiveX dll and control?
Activex dll is created any language and use in application.by using javascript .Activex dll use only as client side control.Control is created in same language of application and use as like drag and drop on page.you can use controls server side as well as client side.
What is custom control. What is the difference between custom control and user control?
Both the custom control and the user control will be developed by the user, the only difference is user control is application specific where are custom control can be used in any application. We can create a dll for the custom control and can place it in the toolbox where are for user control it's not possible it's just an .ascx file as .aspx.
KeaneIndia
How do you set language in web.cofig ?
To set the UI culture and culture for all pages, add a globalization
section to the Web.config file, and then set the uiculture and
culture attributes, as shown in the following example:
To set the UI culture and culture for an individual page,set the
Culture and UICulture attributes of the @ Page directive, as shown in
the following example:
How many web.config a application can have ?
Tell About Web.config ?
What is application variable and when it is initialized ?
it is the process of client side state managment
we can specify like
application["str"]="Value for ref";
like the above in global.asax
this is for global purpose
we can use this value in any where of our application
Tell About Global.asax ?
Global.asax is a file that resides in the root directory of your application. It is inaccessible over the web but is used by the ASP.NET application if it is there. It is a collection of event handlers that you can use to change and set settings in your site. The events can come from one of two places - The HTTPApplication object and any HTTPModule object that is specified in web.confg or machine.config
What is Response.Flush method ?
It sends all buffered data to client immediately
Difference between server.Execute and response.redirect ?
Server.execute combines the results of 2 pages into 1 page.It is normally used when the second page does not have controls which trigger postback events.
Response.redirect is used to redirect to another page from the first page
What is the need of client side and server side validation ?
client side validation are used to reduce the burden on server because if you write server side validation each and every request is send to server and server gives the response each and every time so burden on server. to avoid this problem by using client side validations.we can write some of validations at server side regarding security.
Write steps of retrieving data using ado.net ?
we can use two ways to retrieve the data from database
1 -> data reader
2 -> data adapter
when you use datareader
create connection object and open the connection
SqlCommand cmd = new SqlCommand(sql,con);
cmd.CommandType = CommandType.Text;
SqlDataReader sread = cmd.ExecuteReader();
while(sread.Read())
{
String data1 = sread.GetString(0);
int data2 = sread.GetValue(1);
String data3 = sread.GetString(2);
}
when u use the dataadapter
create the connection and open
SqlDataAdapter sda = new SqlDataAdapter(sql,con);
DataSet ds = new DataSet();
sda.Fill(ds,"customer");
then use can get the data in row wise or directly assign the data to the controls through datasource.
Call a stored procedure from ado.net and pass parameter to it ?
create a connection object
create a command object like so
SqlCommand comm=new SqlCommand("storedprocname",conn)
comm.commandtype=cmmandtype.storedprocedure
and then add parameters like:
comm.parameters.addwithvale("@userid",textbox1.text)
comm.parameters.addwithvalue(@username",textbox2.text)
When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
Using SqlException handlers.
Infosys
can we have multiple datatables in a datareader ?
Yes, we can have multiple result set means multiple datatable data in one datareader..., code as below
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["con"]);
SqlCommand cmd = new SqlCommand("SELECT SiteName FROM
Sites;SELECT SiteCode FROM Sites", con);
cmd.Connection.Open();
SqlDataReader r = cmd.ExecuteReader();
do {
while(r.Read()) {
Response.Write(r.GetString(0) + "
");
}
} while (r.NextResult());
r.Close();
con.Close();
cmd = null;
r = null;
con = null;
How do you ensure quality of code ?
We ensure quality of code by doing
1)Self code review
2)Peer to peer code review.
3)Adher to different coding standards
4)Follow best coding practices.
5)Ensure right code version by making CM audit check list.
What are sequence diagrams, collaboration diagrams and difference between them ?
Sequence diagram is basically a flow chart w.r.t time.
However, a collabration diagram is very much the sequence diagram without any time.
Collaboration diagrams basically shows the interaction of the various objects.
what are all the test scenarios for login passwords?(user authentication)
* Ensure that total number of chrecters are with in the range.
* The copy option should not be provided.
* ensure that not to accept white spaces.
* spelcial cheractor are alowed.
what is SDLC? what are the different stages in SDLC?
Acronym for system development life cycle. SDLC is the process of
developing information systems through investigation, analysis,
design, implementation and maintenance.
SDLC is also known as information systems development or application
development.
SDLC is a systems approach to problem solving and is made up of
several
phases, each comprised of multiple steps:
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.
What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
What does VS.NET contains ?
VS.NET contains .NET FRAMEWORK includes Window form, Web Form, Base Class Libraries and CLR.
Is VB.NET object oriented? What are the inheritances does VB.NET support ?
vb.net is object oriented concept.it is supports to inheritence but it donot support to multiple inheritance.
what are the advantage in vb.net and different between vb and vb.net ?
Adv of VB.NET:
vb is object based. vb.net is object oriented.
vb use record set for database connection
vb.net use dataset for database connection
Write a query to delete duplicate records in SQL SERVER
DELETE FROM A WHERE(id NOT IN
(SELECT MAX(ID) FROM A GROUP BY name))
suppose i have table called A. A has two coloumn id
(identity) as int and Name as nvarchar. I have data like
this.
id Name
1 C
2 D
3 C
4 E
5 D
6 D
In performance wise distinct is good or group by is good? eg:select name from emp group by name; select distinct name from emp;
This question is asked many times to me. What is difference between DISTINCT and GROUP BY?
A DISTINCT and GROUP BY usually generate the same query plan, so performance should be the same across both query constructs.
GROUP BY should be used to apply aggregate operators to each group. If all you need is to remove duplicates then use DISTINCT. If you are using sub-queries execution plan for that query varies so in that case you need to check the execution plan before making decision of which is faster.
Example of DISTINCT:
SELECT DISTINCT Employee, Rank FROM Employees
Example of GROUP BY:
SELECT Employee, Rank FROM Employees GROUP BY Employee, Rank
Can you create UNIQUE and PRIMARY KEY constraints on computed columns in SQL Server 2000?
Because SQL Server 2000 supports indexes on computed columns, you can create UNIQUE and PRIMARY KEY constraints on computed columns.
What is JIT, what are types of JITS and their purpose ?
JIT is Just in Time compiler which compiles the MSIL into NAtive code.
There are three types of JIT copilers.
Pre-JIT. Pre-JIT compiles complete source code into native code in a
single compilation cycle. This is done at the time of deployment of
the application.
Econo-JIT. Econo-JIT compiles only those methods that are called at
runtime.However, these compiled methods are removed when they are not
required.
Normal-JIT. Normal-JIT compiles only those methods that are called at
runtime.These methods are compiled the first time they are called,
and then they are stored in cache. When the same methods are called
again, the compiledcode from cache is used for execution.
What is SOAP, UDDI and WSDL ?
SOAP (Simple Object Access Protocol): is a simple protocol for exchange of information. It is based on XML and consists of three parts: a SOAP envelope (describing what's in the message and how to process it); a set of encoding rules, and a convention for representing RPCs (Remote Procedure Calls) and responses.
UDDI (Universal Description, Discovery, and Integration): is a specification designed to allow businesses of all sizes to benefit in the new digital economy. There is a UDDI registry, which is open to everybody. Membership is free and members can enter details about themselves and the services they provide. Searches can be performed by company name, specific service, or types of service. This allows companies providing or needing web services to discover each other, define how they interact over the Internet and share such information in a truly global and standardized fashion.
WSDL (Web Services Description Language) defines the XML grammar for describing services as collections of communication endpoints capable of exchanging messages. Companies can publish WSDLs for services they provide and others can access those services using the information in the WSDL. Links to WSDLs are usually offered in a company?s profile in the UDDI registry.
What is caching and types of caching ?
To Imporve the performance of Web Pages, we use Caching.
Caching is a used for persisting data in memory for immediate acces to the program calls. It has three types :
1. Output Caching - to fetch page level information and data
2. Fragment Caching - to cache the information of a structure level.
3. Application Caching - to fetch the information of an application.
what is virtual function?
virtual function can be used to override the propertis of a function.
it is normaly used in inheritance. it is part of polymorphism.
HOW TO FIND THE EMPLOYEE DETAILS WHO ARE GETTING SAME SALARY IN EMP TABLE?
SELECT * FROM EMP WHERE (SAL = (SELECT sal FROM emp GROUP BY sal HAVING COUNT(sal) > 1))
IBM
exe abrevation
Executable (File Name Extension)
(or)
Execute.
what is .net?
What is the difference between managed and unmanaged code?
What are the types of assemblies and where can u store them and how ?
what is data Adapter?
what is the syntax code for oldb to connect oracle?
using System.Data.Oledb;
Oledbconnection cn=new OleDbConnection("Provider=Msdaora.1;uid=
cn.open();
How do you merge two datasets into the third dataset in a simple manner?
ds1.Merge(ds2,true)
How many sub-reports can report can have?
maximum 256
What is the difference between User Controls and Master Pages
Ans : Q.No: 63
What is boxing?
converting value type to reference type is called boxing.
where we use javascript and for which purpose we use javascript how?
Ans: Q.No: 64
GE
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 server. When true, this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.
I have to send data throug querystring from one page to another. But it should not be displayed in URL. How it is possible?
using hidden feilds
By URL rewriting
How many .rpt files are be there in a main report having 2 sub reports?
there are 3 .rpt files including the main and 2 sub report.but when the subreports are inserted into main it will behave like one only.
Does Crystal Report support all the functions that we have in Oracle?
No, Crystal report does not support all the functions. Like Decode function is there in SQL but not there is crystal report. You need to convert that in crystal report format (in if and else etc.).
What is command routing in MFC
Check the Command pattern in Gof books, MFC almost use it in the same way:SubWidget in the dialog will catch it firstly, it will forward it to Parent window(the dialog) if *request is not for it or no handler defined.
This procedure runs recursively, until one handle it or pass it to application object. Application will omit unknown command by default
Birlasoft
Write a simple program on cursors?
Find out the 3rd highest salary?
select a.sal from emp a where 3=(select distinct(count(b.sal))
from emp b where a.sal<=b.sal) What are user defined stored procedures ? Stroed procedures are basically set of sql statements.User defined stored procedures are created by users in which they can use functions,procedures to get the desired result from database. Difference between views and materialized views? VIEWS: Takes the output of a query M.VIEWS: Stores the output of a query,Views can't store the results of a query. What is a self join ? A table is joined itself is called self join or Self referential integrity. What are different types of joins ? 1.Equi join 2.Non-equi join 3.cartegian join 4.outer join(+) >> a)left outer join
b)right outer join
5.self join
What is a trigger ?
Triggers are basically PL/SQL procedures that are associated with tables, and are fired whenever a certain modification (event) occurs. The modification statements may include INSERT, UPDATE, and DELETE.
The general structure of triggers is:
CREATE [OR REPLACE]TRIGGER trigger_name
BEFORE/AFTER
INSERT/UPDATE/DELETE ON tablename
[FOR EACH ROW [WHEN (condition)]]
BEGIN
...
END;
What is referential integrity ?
A rule defined on a column (or set of columns) in one table that allows the insert or update of a row only if the value for the column or set of columns (the dependent value) matches a value in a column of a related table (the
referenced value). It also specifies the type of data manipulation allowed on referenced data and the action to
be performed on dependent data as a result of any action on
referenced data.
What is a constraint. Types of constraints ?
Constraint means it is rule which you want to apply on the table. There are two types of constraints.
1. Column Constraints: Applicable for that column only.
2. Table Constraints: Applicable for more than one column.
Column Constraints:
unique
not null
primary key
foreign key
default
check
Table constraints:
unique
primary key
foreign key
check
What is an index and types of indexes. How many number of indexes can be used per table ?
Index is a method used for faster retrieval of records.different types of indexes are
1.primary key index
2.unique index
3.bitmap index
4.hash index
5.function based index
6.B-tree index(default index created) on table.
7.Virtual index(which do not show entry in DBA_segment).
Indexs are used for the faster retrivel of data.
two types of indexes
Cluster index,unclustered index
we can have one cluster index and upto 249 uncluster indexes for a table
What is normalization ?
Normalization is the process of organizing the table to remove redundancy.
What is @@rowcount and with small code snippet explain the usage?
@@rowcount gives the number of rows given as an result of previous query ran.
Create procedure get_emp_count ( @emp_id int)
As
Select * from emp where emp_id =@emp_id
If @@rowcount = 0
Begin
Select 'no rows with emp_id= '
Select @emp_id
End
(OR)
UPDATE authors SET au_lname = 'Jones'
WHERE au_id = '999-888-7777'
IF @@ROWCOUNT = 0
print 'Warning: No rows were updated'
CSC
What is the basic functions for master, msdb, tempdb databases?
Master , MSDB and TempDB these are the inbuild Database which r provided by SQL SERVER.
All have their own functinality & responsbility like.
Master : Master DB is responsible for Storing all information at
system level.
MSDB : it is Microsoft DB, it creates a Copy of whole Database in it
TempDB : it stores all the log information of Server,it will initilize
automatically whenever Server will start,the max. size alloted from
TempDB is 10MB.
Honeywell
If we want to construct our own Garbage collector what are the steps things we have to do?
If you want to implement your own GC, you need to define you own memory cleaning by implementing destructors.
Also you have configure your GC in a separate long running thread which should be of Daemon Thread. (Background thread).
If we want to call the Garbage collector,use this command
system.gc.collect()
How Garbage Collector identifies the objects which are not in use?
Garbage Collector identifies a unused object using "referce counting"
reference countiing: how many times the object is used if the count is zero..its is unuesd....now the gc will release the resources..
C# makes use of the Finilize() destructor for this purpose.The CLR periodically checks the entire program for unused objects using the refrence tracing garbage collector which in turn invokes he Finilze() destructor to relese the memory of such objects.
Tell me about the internal working of Garbage collector?
The main objective of GC is Memory Management...Gc wil take initiative when ever the application meemory is low...we hav Finalize() method which runs implicitly...and Dispose() method which we hav to kal Explicity....
Gc identifies the unused objects with reference counting concept.Finalize() method runs implicitly and free the resources if the object having no references...in the case of Dispose() method it wont mind if the reference r ther.....
Gc maintain 4 Generation...start with 0 ..ends with 3 if GC released the resources using Finalize method() still u can get the object..coz dis method havin backup...it stores in generation0-3.
what is data access layer?
Data Access Layer which is receive a request from buisness object layer and speaks to database , get the result and return to buisness object.All sqls and Stored procedure execution will be placed.
Data access layer is nothing but EIS(Enterprise Information Server)which can store the databse objects associated to the webapplication.
If there is a Model class,View class,Controller class then How these are internally related? Which layer objects instantiated in which
layer? How they communicates?
If we will take in DotNet technology. Web based applications has implemented MVC Pattern.
ASPX is the View Class
ASPX.CS is the controller class
If we are using any Application Blocks / DLL Components that are model class.
What are actually Model,view,Controller in MVC Pattern?
MODEL:Model is nothing but storing the databse objects.
VIEW: View is nothing but userinterface
CONTROLLER: Controller is nothing but handling the requests and sending the response.
Which Design Patterns you know?
For this question u can answer like Singleton design pattern ,DAO and DTO,MVC.
The design pattern is broadly classified into
1. Creational (Factory, Abstract Factory, Singleton Prototype, and Builder)
2. Structural (Composite)
3. Behavioural (Observer)
what is MVC Pattern?
MVC is the one of the design pattern which enables you to de-coupling the modules.
MODEL:It cane be used to store the database objects.
VIEW: It can be used to view purpose,to giving the user input.
CONTROLLER:It is the main component in the MVC pattern,which can handle request and response mechanism.
If we want to connect to many databases in dataaccess layer such as MSAccess,Sql server,oracle means not to a particular database depends on condition we have to connect to appropriate database in this scenario if we without changing code Ho do you handle thissituation?
and use this Key name where it is needed
If you need SqlServer DataBase
using System.Data.SqlClient;
in DataAcess Layer
public SqlConnection Connection()
{
try
{
con = new SqlConnection (ConfigurationManager.AppSettings["SqlServerDatabase"].ToString().Trim());
return con
}
catch (Exception exp)
{
throw exp;
}
}
What is the difference between NOROW and LOCKROW?
When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory?
before invoking derived class constructor base-class constructor should be called.
first base-class object will be created then derived-class object will
be created.
here the base class constructor is private, so derived-class cannot
invoke it.
No object is created in derived-class.
Tech Mahindra
In which conditions do you opt for Remoting services?
Remoting can be prefered
Both server and Client sit in different machine.
Both server and client are .NET applications
The state of the objects transfered accross the network
should be maintained.
The objects of the IDictionary interface should be transfered accross
the network.
we are working in .net namespaces like using system.io,system.text.
these namespace before we use "using " keyword what means of using?
using keyword is used to intimate the compiler to load supported name spaces for our program.
Is it possible to use two versions of assembly at the same time?If possible explain with code?
First u have to create Windows Service..
For install Windows Service , u have to use one Command
first Build Windows Service..then use this command..
installutil.exe
installutil.exe/u
u have to use this command in visual studio 2005 -> visual studio command Prompt -> write this above command..
Go in Particular path where u create Windows Service then go to Bin -->Debug --> then implement this above Command..
what are the differences between windows services and web services?
An XML Web service is a component that implements program logic and provides functionality for diseparate applications. These applications use standard protocols, such as HTTP, XML, and SOAP, to access the functionality. XML Web services use XML-based messaging to send and
receive data, which enables heterogeneous applications to interoperate with each other. You can use XML Web services to integrate applications that are written in different programming languages and deployed on different platforms. In addition, you can deploy XML Web services within an intranet as well as on the Internet. While the Internet brings users closer to organizations, XML Web services allow organizations to integrate their applications.
A Windows service starts much before any user logs in to the system (if it has been setup to start at boot up process). A Windows service can also be setup in such a way that it requires a user to start it manually ? the ultimate customization!Windows services run as background processes. These applications do not have a user interface, which makes them ideal for tasks that do not require any user interaction. You can install a Windows service on any server or computer that is running Windows 2000, Windows XP, or Windows NT. You can also specify a Windows service to run in the security context of a specific user account that is different from the logged on user account or the default computer account. For example, you can create a Windows service to monitor performance counter data and react to threshold values in a database.
what is the difference between trigger and storedprocedures
procedure is invoked explicitly by the user and trigger is executed
implicitly.
procedure cannot have the same name as table name,funtion name or
package name but trigger can have same name as table name or
procedure name.
Trigger is compiled code where as stroed procedure is not.
triger in action which is performed automatically before or after a
event occur and stored procedure is a procedure which is executed
when the it is called.
Is it possible to use two versions of assembly at the same time?If possible explain with code?
It is possible. I think it is called as side by side execution.
CapGemini
what is a virtual class?
In multiple inheritance when a class D is derived by two base classes B and C and both base class is also inherite by same class A then then class D will get duplicate copy of uppper most base class A.In this case class A will declare as virtual class
What is the difference between ExecuteReader,ExecuteNonQuery
and ExecuteScalar.
ExecuteReader - This method returns a DataReader which is filled with the data that is retrieved using the command object.
ExecuteNonQuery - This method returns no data at all. It is used majorly with Inserts and Updates of tables.
ExecuteScalar - Returns only one value after execution of the query. It returns the first field in the first row.
can i use store procedure in disconnected mode?
Store procedure is used in disconnected mode because procedure are compiled only once and it is used in dataset also
difference between
it can be used to store the Connection String
How to handle error while project running on live
Only using application error log file and to show internal server error
can we add connection string in global.asax?????????? 2.what are the default files included when we create new web application????
We can't add connection string in global.asax file. we can create
connection string in web.config file only.
global.asax,web.config,Default.aspx files and
app_code,app_data,app_themes folders.
What is the difference between Remoting & Web Servcies?
Web Services:
- accessed only over HTTP
- work in a stateless environment
- support only datatypes defined in the XSD type system
- support interoperability across platforms
- highly reliable
- easy to create and deploy
Remoting:
- can be accessed over any protocol
- support for both stateful and stateless environment
- support for rich type system
- homogenous environment
- if IIS is not used, application needs to provide plumbing for
ensuring the reliability
- complex to program
What is the roll of JIT in asp.net?
JIT allows parts of your application to execute when they are needed.
JIT convert Intermediate languge(IL) to machine code at run time or at
the point where the software is installed.
Suggest 3 best practices in detail for for Developing High
Performance Web and Enterprise Applications
Used Disconnected architecture like dataset
Used as possible as All HTML controls
Used all client side validations only
Used cursors for more than one rows
Used Cache for maintain state which is came from database
Developing Applications using Classes.[It means 3tire architecture]
Using JavaScript and XML when the designing and implementing webpages.
Using Stored Procedures to generate a call to DataBase.
My website has around 100 aspx. Out of this, a certain 20 aspx
files should be made available to the users only if they are
logged in. How can I achieve this with the web.config file?
what is purpose of xml control in standard controls of asp.net
Actually all data is transfer from place to other place in the form of xml formate so it is very easy to transfer
What Are The Difference Between AutoEventWireup="true" and
AutoEventWireup="False"
if the AutoEventWireup="true" propety in dropdown when index changed automatically post back to the server.
if the AutoEventWireup=" False" propety in dropdown when index changed will not post back to the server.
How many Controls present in Asp dot net?
There are three types of control in ASP.NET
1.- USER CONTROL (.ASCX)
2.- CUSTOM CONTROL (.DLL)
3.- WEB CONTROL
If Asp Dot Application is stateless what happened? during designing
asp.net is stateless Both ASP and ASP.NET are stateless. Because both ASP and ASP.NET uses HTTP protocol which is stateless
how can i am search the data from database? just like google
SELECT * FROM EMPLOYE WHERE DETAILS LIKE '%
This is the simplest query for that...
what is
It allows you to specify configuration details for particular folder or file in the Web.config file.
What is Active Directory? What is the namespace for that?
Active Directory Service Interfaces (ADSI) is a programmatic interface for the Microsoft Windows Active Directory. It enables your applications to interact with different directories on a network using a single interface.
Namespace:
-----------
System.DirectoryServices
Explain Generics?
The most common use of generics is to create collection classes.
Generics does not require boxing and unboxing while inserting and
retrieving elements.
By Performane wise Generics were fast
Generics are type safety.
With out Web.config can we executes the application?
Yes, application will inherit cofiguration setting from machine.config
file
if our web.config does not contain any connectionStrings then we can
run the application with out web.confing file
What is the Impersonation?and what is the importence of that?
Impersonation is nothing but applying different themes and skins to a particular web page or website.
Can we use the java script code in .Net Code behind?
yes we can use javascript in code behind.
Define the script block that contains the JavaScript function. You can add this directly to the HTML of the page.
Insert the script block by the
Page.RegisterStartupScript() or the
Page.RegisterClientScriptBlock() method.
or by using updatepanel by raising an async postback using JavaScript code
What is Runtime callable wrapper?
A Runtime Callable Wrapper (RCW) is a proxy object generated by the .NET Common Language Runtime (CLR) in order to allow a Component Object Model (COM) object to be accessed from managed code. Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.
For example, a managed application written in C# might make use of an existing COM library written in C++ or Visual Basic 6, via RCWs.
what is COM Object in Dot net?
Component Object Model is a method to facilitate communication between different applications and languages.
The following steps explain the way to create the COM server in C#:
Create a new Class Library project.
Create a new interface, say IManagedInterface, and declare the methods
required. Then provide the Guid (this is the IID) for the interface
using the GuidAttribute defined in System.Runtime.InteropServices.
The Guid can be created using the Guidgen.exe. [Guid("3B515E51-0860-
48ae-B49C-05DF356CDF4B")]
Define a class that implements this interface. Again provide the Guid
(this is the CLSID) for this class also. Mark the assembly as
ComVisible. For this go to AssemblyInfo.cs file and add the following
statement [assembly: ComVisible (true)]. This gives the accessibility
of all types within the assembly to COM.Build the project. This will
generate an assembly in the output path. Now register the assembly
using regasm.exe (a tool provided with the .NET Framework)- regasm
\bin\debug\ComInDotNet.dll \tlb:ComInDotNet.tlb This will create a
TLB file after registration.Alternatively this can be done in the
Project properties -> Build -> check the Register for COM interop.
The COM server is ready. Now a client has to be created. It can be in
any language. If the client is .NET, just add the above created COM
assembly as reference and use it.
What command line used to generate Runtime callable wrapper.
tlbimp.exe,
for example:
tlbimp
InteropExample.dll /output:InteropExampleRCW.dll /verbose
What is the difference between Postback and Ispostback Property?
PostBack: Postback is the event which sends the form data to the server. The server processes the data & sends it back to the browser. The page goes through its full life cycle & is rendered on the browser. It can be triggered by using the server controls.
And the IsPostBack property of the page object may be used to check whether the page request is a postback or not. IsPostBack property is of the type Boolean.
What is CTE in sql server 2005?
Common Table Expressions, It is return temporary result set from inside a statement.
which one is faster execute reader, scalar, execute non query ?
can machine.config file orverrides web.config. For example: if u set
session timeout as 30 mins in web.config file to a particular
application and if u set session timeout as 10 mins in machin.config.
what will happen and which session is set to the appliction?
As the Web.Config file defines application level settings.It'll override the settings of the machine.config file.So the session timeout as 30 mins defined in web.config file is set to the application.
Is There any Third party tools are using in .Net Technologies? Can u Explain?
The name of the Third Party Tool is Telerik Controls.
How to refresh a page in asp.net
by using ispostback property or by using ajax controls
by calling javascript function in asp.net you can also refresh page
How can i include both C# and vb.net classes in same solution?
Step 1:
It is possible,In app-Code folder create sub folders named VB,CS(as you like) and create .vb class files in the folder named VB and .cs class files in the CS folder.
Step 2:
Go to web.config file and mention the following
Difference between Stored procedures and User Defined functions[UDF]
Stored procedureA stored procedure is a program (or procedure) which is physically stored within a database. They are usually written in a proprietary database language like PL/SQL for Oracle database or PL/PgSQL for PostgreSQL. The advantage of a stored procedure is that when it is run, in response to a user request, it is run directly by the database engine, which usually runs on a separate database server.
User-defined functionA user-defined function is a routine that encapsulates useful logic for use in other queries. While views are limited to a single SELECT statement, user-defined functions can have multiple SELECT statements and provide more powerful logic than is possible with views.In SQL Server 2000User defined functions have 3 main categories
Scalar-valued function - returns a scalar value such as an integer or a timestamp. Can be used as column name in queries
Inline function - can contain a single SELECT statement.
Table-valued function - can contain any number of statements that populate the table variable to be returned. They become handy when you need to return a set of rows, but you can't enclose the logic for getting this rowset in a single SELECT statement.
Differences between Stored procedure and User defined functions
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
Inline UDF's can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
Of course there will be Syntax differences and here is a sample of that
Stored procedure Code: SQL
CREATE PROCEDURE dbo.StoredProcedure1
/*
(
@parameter1 datatype = default value,
@parameter2 datatype OUTPUT
)
*/
AS
/* SET NOCOUNT ON */
RETURN
User defined functions Code: SQL
CREATE FUNCTION dbo.Function1
(
/*
@parameter1 datatype = default value,
@parameter2 datatype
*/
)
RETURNS /* datatype */
AS
BEGIN
/* sql statement ... */
RETURN /* value */
END
Can we change the session timeout in ASP.NET, if yes then how and from where?
By default session time out is 20 minutes but one can change it. there are two ways to change the sessiontime out in asp.net that is:-
1) from web config. file by setting the session timot element eg.
or
2) by doing programtically eg.
session.timeout=60
What is three major points in WCF?
1) Address --- Specifies the location of the service which will be like http://Myserver/MyService.Clients will use this location to communicate with our service.
2)Contract --- Specifies the interface between client and the server.It's a simple interface with some attribute.
3)Binding --- Specifies how the two paries will communicate in term of transport and encoding and protocols.
FAQ'S IN .NET
What is the .NET Framework?
The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications.
The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET.
What is the common language runtime (CLR)?
The common language runtime is the execution engine for .NET Framework applications.
It provides a number of services, including the following:
Code management (loading and execution)
Application memory isolation
Verification of type safety
Conversion of IL to native code
Access to metadata (enhanced type information)
Managing memory for managed objects
Enforcement of code access security
Exception handling, including cross-language exceptions
Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)
Automation of object layout
Support for developer services (profiling, debugging, and so on)
What is the common type system (CTS)?
The common type system is a rich type system, built into the common language runtime, that supports the types and operations found in most programming languages. The common type system supports the complete implementation of a wide range of programming languages.
What is the Common Language Specification (CLS)?
The Common Language Specification is a set of constructs and constraints that serves as a guide for library writers and compiler writers. It allows libraries to be fully usable from any language supporting the CLS, and for those languages to integrate with each other. The Common Language Specification is a subset of the common type system. The Common Language Specification is also important to application developers who are writing code that will be used by other developers. When developers design publicly accessible APIs following the rules of the CLS, those APIs are easily used from all other programming languages that target the common language runtime.
What is the Microsoft Intermediate Language (MSIL)?
MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross-language integration.
Prior to execution, MSIL is converted to machine code. It is not interpreted.
What is managed code and managed data?
Managed code is code that is written to target the services of the common language runtime (see What is the Common Language Runtime?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR).
Closely related to managed code is managed data—data that is allocated and de-allocated by the common language runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class). An example of a restriction is that a managed class can only inherit from one base class.
What is an assembly?
An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit.
Assemblies are self-describing by means of their manifest, which is an integral part of every assembly. The manifest:
Establishes the assembly identity (in the form of a text name), version, culture, and digital signature (if the assembly is to be shared across applications).
Defines what files (by name and file hash) make up the assembly implementation.
Specifies the types and resources that make up the assembly, including which are exported from the assembly.
Itemizes the compile-time dependencies on other assemblies.
Specifies the set of permissions required for the assembly to run properly.
This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The runtime can determine and locate the assembly for any running object, since every type is loaded in the context of an assembly. Assemblies are also the unit at which code access security permissions are applied. The identity evidence for each assembly is considered separately when determining what permissions to grant the code it contains.
The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.
What are private assemblies and shared assemblies?
A private assembly is used only by a single application, and is stored in that application's install directory (or a subdirectory therein). A shared assembly is one that can be referenced by more than one application. In order to share an assembly, the assembly must be explicitly built for this purpose by giving it a cryptographically strong name (referred to as a strong name). By contrast, a private assembly name need only be unique within the application that uses it.
By making a distinction between private and shared assemblies, we introduce the notion of sharing as an explicit decision. Simply by deploying private assemblies to an application directory, you can guarantee that that application will run only with the bits it was built and deployed with. References to private assemblies will only be resolved locally to the private application directory.
There are several reasons you may elect to build and use shared assemblies, such as the ability to express version policy. The fact that shared assemblies have a cryptographically strong name means that only the author of the assembly has the key to produce a new version of that assembly. Thus, if you make a policy statement that says you want to accept a new version of an assembly, you can have some confidence that version updates will be controlled and verified by the author. Otherwise, you don't have to accept them.
For locally installed applications, a shared assembly is typically explicitly installed into the global assembly cache (a local cache of assemblies maintained by the .NET Framework). Key to the version management features of the .NET Framework is that downloaded code does not affect the execution of locally installed applications. Downloaded code is put in a special download cache and is not globally available on the machine even if some of the downloaded components are built as shared assemblies.
The classes that ship with the .NET Framework are all built as shared assemblies.
If I want to build a shared assembly, does that require the overhead of signing and managing key pairs?
Building a shared assembly does involve working with cryptographic keys. Only the public key is strictly needed when the assembly is being built. Compilers targeting the .NET Framework provide command line options (or use custom attributes) for supplying the public key when building the assembly. It is common to keep a copy of a common public key in a source database and point build scripts to this key. Before the assembly is shipped, the assembly must be fully signed with the corresponding private key. This is done using an SDK tool called SN.exe (Strong Name).
Strong name signing does not involve certificates like Authenticode does. There are no third party organizations involved, no fees to pay, and no certificate chains. In addition, the overhead for verifying a strong name is much less than it is for Authenticode. However, strong names do not make any statements about trusting a particular publisher. Strong names allow you to ensure that the contents of a given assembly haven't been tampered with, and that the assembly loaded on your behalf at run time comes from the same publisher as the one you developed against. But it makes no statement about whether you can trust the identity of that publisher.
What is the difference between a namespace and an assembly name?
A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under the control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionality related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the Microsoft® ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.
Application Deployment and Isolation
What options are available to deploy my .NET applications?
The .NET Framework simplifies deployment by making zero-impact install and XCOPY deployment of applications feasible. Because all requests are resolved first to the private application directory, simply copying an application's directory files to disk is all that is needed to run the application. No registration is required.
This scenario is particularly compelling for Web applications, Web Services, and self-contained desktop applications. However, there are scenarios where XCOPY is not sufficient as a distribution mechanism. An example is when the application has little private code and relies on the availability of shared assemblies, or when the application is not locally installed (but rather downloaded on demand). For these cases, the .NET Framework provides extensive code download services and integration with the Windows Installer. The code download support provided by the .NET Framework offers several advantages over current platforms, including incremental download, code access security (no more Authenticode dialogs), and application isolation (code downloaded on behalf of one application doesn't affect other applications). The Windows Installer is another powerful deployment mechanism available to .NET applications. All of the features of Windows Installer, including publishing, advertisement, and application repair will be available to .NET applications in Windows Installer 2.0.
I've written an assembly that I want to use in more than one application. Where do I deploy it?
Assemblies that are to be used by multiple applications (for example, shared assemblies) are deployed to the global assembly cache. In the prerelease and Beta builds, use the /i option to the GACUtil SDK tool to install an assembly into the cache:
gacutil /i myDll.dll
Windows Installer 2.0, which ships with Windows XP and Visual Studio .NET will be able to install assemblies into the global assembly cache.
How can I see what assemblies are installed in the global assembly cache?
The .NET Framework ships with a Windows shell extension for viewing the assembly cache. Navigating to % windir%\assembly with the Windows Explorer activates the viewer.
What is an application domain?
An application domain (often AppDomain) is a virtual process that serves to isolate an application. All objects created within the same application scope (in other words, anywhere along the sequence of object activations beginning with the application entry point) are created within the same application domain. Multiple application domains can exist in a single operating system process, making them a lightweight means of application isolation.
An OS process provides isolation by having a distinct memory address space. While this is effective, it is also expensive, and does not scale to the numbers required for large web servers. The Common Language Runtime, on the other hand, enforces application isolation by managing the memory use of code running within the application domain. This ensures that it does not access memory outside the boundaries of the domain. It is important to note that only type-safe code can be managed in this way (the runtime cannot guarantee isolation when unsafe code is loaded in an application domain).
What is garbage collection?
Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer," which is written by the user). Some garbage collectors, like the one used by .NET, compact memory and therefore decrease your program's working set.
How does non-deterministic garbage collection affect my code?
For most programmers, having a garbage collector (and using garbage collected objects) means that you never have to worry about deallocating memory, or reference counting objects, even if you use sophisticated data structures. It does require some changes in coding style, however, if you typically deallocate system resources (file handles, locks, and so forth) in the same block of code that releases the memory for an object. With a garbage collected object you should provide a method that releases the system resources deterministically (that is, under your program control) and let the garbage collector release the memory when it compacts the working set.
Can I avoid using the garbage collected heap?
All languages that target the runtime allow you to allocate class objects from the garbage-collected heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work out when they should explicitly 'free' each object.
The CLR also provides what are called ValueTypes—these are like classes, except that ValueType objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed automatically when your code exits the procedure in which they are defined. This is how "structs" in C# operate.
Managed Extensions to C++ lets you choose where class objects are allocated. If declared as managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If they don't include the __gc keyword, they behave like regular C++ objects, allocated from the C++ heap, and freed explicitly with the "free" method.
Remoting
How do in-process and cross-process communication work in the Common Language Runtime?
There are two aspects to in-process communication: between contexts within a single application domain, or across application domains. Between contexts in the same application domain, proxies are used as an interception mechanism. No marshaling/serialization is involved. When crossing application domains, we do marshaling/serialization using the runtime binary protocol.
Cross-process communication uses a pluggable channel and formatter protocol, each suited to a specific purpose.
If the developer specifies an endpoint using the tool soapsuds.exe to generate a metadata proxy, HTTP channel with SOAP formatter is the default.
If a developer is doing explicit remoting in the managed world, it is necessary to be explicit about what channel and formatter to use. This may be expressed administratively, through configuration files, or with API calls to load specific channels. Options are:
HTTP channel w/ SOAP formatter (HTTP works well on the Internet, or anytime traffic must travel through firewalls)
TCP channel w/ binary formatter (TCP is a higher performance option for local-area networks (LANs))
When making transitions between managed and unmanaged code, the COM infrastructure (specifically, DCOM) is used for remoting. In interim releases of the CLR, this applies also to serviced components (components that use COM+ services). Upon final release, it should be possible to configure any remotable component.
Distributed garbage collection of objects is managed by a system called "leased based lifetime." Each object has a lease time, and when that time expires, the object is disconnected from the remoting infrastructure of the CLR. Objects have a default renew time-the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.
Interoperability
Can I use COM objects from a .NET Framework program?
Yes. Any COM component you have deployed today can be used from managed code, and in common cases the adaptation is totally automatic.
Specifically, COM components are accessed from the .NET Framework by use of a runtime callable wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET Framework-compatible interfaces. For OLE automation interfaces, the RCW can be generated automatically from a type library. For non-OLE automation interfaces, a developer may write a custom RCW and manually map the types exposed by the COM interface to .NET Framework-compatible types.
Can .NET Framework components be used from a COM program?
Yes. Managed types you build today can be made accessible from COM, and in the common case the configuration is totally automatic. There are certain new features of the managed development environment that are not accessible from COM. For example, static methods and parameterized constructors cannot be used from COM. In general, it is a good idea to decide in advance who the intended user of a given type will be. If the type is to be used from COM, you may be restricted to using those features that are COM accessible.
Depending on the language used to write the managed type, it may or may not be visible by default.
Specifically, .NET Framework components are accessed from COM by using a COM callable wrapper (CCW). This is similar to an RCW (see previous question), but works in the opposite direction. Again, if the .NET Framework development tools cannot automatically generate the wrapper, or if the automatic behavior is not what you want, a custom CCW can be developed.
Can I use the Win32 API from a .NET Framework program?
Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.
Here is an example of C# calling the Win32 MessageBox function:
using System;
using System.Runtime.InteropServices;
class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);
public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}
The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications.
The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET.
What is the common language runtime (CLR)?
The common language runtime is the execution engine for .NET Framework applications.
It provides a number of services, including the following:
Code management (loading and execution)
Application memory isolation
Verification of type safety
Conversion of IL to native code
Access to metadata (enhanced type information)
Managing memory for managed objects
Enforcement of code access security
Exception handling, including cross-language exceptions
Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)
Automation of object layout
Support for developer services (profiling, debugging, and so on)
What is the common type system (CTS)?
The common type system is a rich type system, built into the common language runtime, that supports the types and operations found in most programming languages. The common type system supports the complete implementation of a wide range of programming languages.
What is the Common Language Specification (CLS)?
The Common Language Specification is a set of constructs and constraints that serves as a guide for library writers and compiler writers. It allows libraries to be fully usable from any language supporting the CLS, and for those languages to integrate with each other. The Common Language Specification is a subset of the common type system. The Common Language Specification is also important to application developers who are writing code that will be used by other developers. When developers design publicly accessible APIs following the rules of the CLS, those APIs are easily used from all other programming languages that target the common language runtime.
What is the Microsoft Intermediate Language (MSIL)?
MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross-language integration.
Prior to execution, MSIL is converted to machine code. It is not interpreted.
What is managed code and managed data?
Managed code is code that is written to target the services of the common language runtime (see What is the Common Language Runtime?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR).
Closely related to managed code is managed data—data that is allocated and de-allocated by the common language runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class). An example of a restriction is that a managed class can only inherit from one base class.
What is an assembly?
An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit.
Assemblies are self-describing by means of their manifest, which is an integral part of every assembly. The manifest:
Establishes the assembly identity (in the form of a text name), version, culture, and digital signature (if the assembly is to be shared across applications).
Defines what files (by name and file hash) make up the assembly implementation.
Specifies the types and resources that make up the assembly, including which are exported from the assembly.
Itemizes the compile-time dependencies on other assemblies.
Specifies the set of permissions required for the assembly to run properly.
This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The runtime can determine and locate the assembly for any running object, since every type is loaded in the context of an assembly. Assemblies are also the unit at which code access security permissions are applied. The identity evidence for each assembly is considered separately when determining what permissions to grant the code it contains.
The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.
What are private assemblies and shared assemblies?
A private assembly is used only by a single application, and is stored in that application's install directory (or a subdirectory therein). A shared assembly is one that can be referenced by more than one application. In order to share an assembly, the assembly must be explicitly built for this purpose by giving it a cryptographically strong name (referred to as a strong name). By contrast, a private assembly name need only be unique within the application that uses it.
By making a distinction between private and shared assemblies, we introduce the notion of sharing as an explicit decision. Simply by deploying private assemblies to an application directory, you can guarantee that that application will run only with the bits it was built and deployed with. References to private assemblies will only be resolved locally to the private application directory.
There are several reasons you may elect to build and use shared assemblies, such as the ability to express version policy. The fact that shared assemblies have a cryptographically strong name means that only the author of the assembly has the key to produce a new version of that assembly. Thus, if you make a policy statement that says you want to accept a new version of an assembly, you can have some confidence that version updates will be controlled and verified by the author. Otherwise, you don't have to accept them.
For locally installed applications, a shared assembly is typically explicitly installed into the global assembly cache (a local cache of assemblies maintained by the .NET Framework). Key to the version management features of the .NET Framework is that downloaded code does not affect the execution of locally installed applications. Downloaded code is put in a special download cache and is not globally available on the machine even if some of the downloaded components are built as shared assemblies.
The classes that ship with the .NET Framework are all built as shared assemblies.
If I want to build a shared assembly, does that require the overhead of signing and managing key pairs?
Building a shared assembly does involve working with cryptographic keys. Only the public key is strictly needed when the assembly is being built. Compilers targeting the .NET Framework provide command line options (or use custom attributes) for supplying the public key when building the assembly. It is common to keep a copy of a common public key in a source database and point build scripts to this key. Before the assembly is shipped, the assembly must be fully signed with the corresponding private key. This is done using an SDK tool called SN.exe (Strong Name).
Strong name signing does not involve certificates like Authenticode does. There are no third party organizations involved, no fees to pay, and no certificate chains. In addition, the overhead for verifying a strong name is much less than it is for Authenticode. However, strong names do not make any statements about trusting a particular publisher. Strong names allow you to ensure that the contents of a given assembly haven't been tampered with, and that the assembly loaded on your behalf at run time comes from the same publisher as the one you developed against. But it makes no statement about whether you can trust the identity of that publisher.
What is the difference between a namespace and an assembly name?
A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under the control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionality related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the Microsoft® ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.
Application Deployment and Isolation
What options are available to deploy my .NET applications?
The .NET Framework simplifies deployment by making zero-impact install and XCOPY deployment of applications feasible. Because all requests are resolved first to the private application directory, simply copying an application's directory files to disk is all that is needed to run the application. No registration is required.
This scenario is particularly compelling for Web applications, Web Services, and self-contained desktop applications. However, there are scenarios where XCOPY is not sufficient as a distribution mechanism. An example is when the application has little private code and relies on the availability of shared assemblies, or when the application is not locally installed (but rather downloaded on demand). For these cases, the .NET Framework provides extensive code download services and integration with the Windows Installer. The code download support provided by the .NET Framework offers several advantages over current platforms, including incremental download, code access security (no more Authenticode dialogs), and application isolation (code downloaded on behalf of one application doesn't affect other applications). The Windows Installer is another powerful deployment mechanism available to .NET applications. All of the features of Windows Installer, including publishing, advertisement, and application repair will be available to .NET applications in Windows Installer 2.0.
I've written an assembly that I want to use in more than one application. Where do I deploy it?
Assemblies that are to be used by multiple applications (for example, shared assemblies) are deployed to the global assembly cache. In the prerelease and Beta builds, use the /i option to the GACUtil SDK tool to install an assembly into the cache:
gacutil /i myDll.dll
Windows Installer 2.0, which ships with Windows XP and Visual Studio .NET will be able to install assemblies into the global assembly cache.
How can I see what assemblies are installed in the global assembly cache?
The .NET Framework ships with a Windows shell extension for viewing the assembly cache. Navigating to % windir%\assembly with the Windows Explorer activates the viewer.
What is an application domain?
An application domain (often AppDomain) is a virtual process that serves to isolate an application. All objects created within the same application scope (in other words, anywhere along the sequence of object activations beginning with the application entry point) are created within the same application domain. Multiple application domains can exist in a single operating system process, making them a lightweight means of application isolation.
An OS process provides isolation by having a distinct memory address space. While this is effective, it is also expensive, and does not scale to the numbers required for large web servers. The Common Language Runtime, on the other hand, enforces application isolation by managing the memory use of code running within the application domain. This ensures that it does not access memory outside the boundaries of the domain. It is important to note that only type-safe code can be managed in this way (the runtime cannot guarantee isolation when unsafe code is loaded in an application domain).
What is garbage collection?
Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer," which is written by the user). Some garbage collectors, like the one used by .NET, compact memory and therefore decrease your program's working set.
How does non-deterministic garbage collection affect my code?
For most programmers, having a garbage collector (and using garbage collected objects) means that you never have to worry about deallocating memory, or reference counting objects, even if you use sophisticated data structures. It does require some changes in coding style, however, if you typically deallocate system resources (file handles, locks, and so forth) in the same block of code that releases the memory for an object. With a garbage collected object you should provide a method that releases the system resources deterministically (that is, under your program control) and let the garbage collector release the memory when it compacts the working set.
Can I avoid using the garbage collected heap?
All languages that target the runtime allow you to allocate class objects from the garbage-collected heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work out when they should explicitly 'free' each object.
The CLR also provides what are called ValueTypes—these are like classes, except that ValueType objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed automatically when your code exits the procedure in which they are defined. This is how "structs" in C# operate.
Managed Extensions to C++ lets you choose where class objects are allocated. If declared as managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If they don't include the __gc keyword, they behave like regular C++ objects, allocated from the C++ heap, and freed explicitly with the "free" method.
Remoting
How do in-process and cross-process communication work in the Common Language Runtime?
There are two aspects to in-process communication: between contexts within a single application domain, or across application domains. Between contexts in the same application domain, proxies are used as an interception mechanism. No marshaling/serialization is involved. When crossing application domains, we do marshaling/serialization using the runtime binary protocol.
Cross-process communication uses a pluggable channel and formatter protocol, each suited to a specific purpose.
If the developer specifies an endpoint using the tool soapsuds.exe to generate a metadata proxy, HTTP channel with SOAP formatter is the default.
If a developer is doing explicit remoting in the managed world, it is necessary to be explicit about what channel and formatter to use. This may be expressed administratively, through configuration files, or with API calls to load specific channels. Options are:
HTTP channel w/ SOAP formatter (HTTP works well on the Internet, or anytime traffic must travel through firewalls)
TCP channel w/ binary formatter (TCP is a higher performance option for local-area networks (LANs))
When making transitions between managed and unmanaged code, the COM infrastructure (specifically, DCOM) is used for remoting. In interim releases of the CLR, this applies also to serviced components (components that use COM+ services). Upon final release, it should be possible to configure any remotable component.
Distributed garbage collection of objects is managed by a system called "leased based lifetime." Each object has a lease time, and when that time expires, the object is disconnected from the remoting infrastructure of the CLR. Objects have a default renew time-the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.
Interoperability
Can I use COM objects from a .NET Framework program?
Yes. Any COM component you have deployed today can be used from managed code, and in common cases the adaptation is totally automatic.
Specifically, COM components are accessed from the .NET Framework by use of a runtime callable wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET Framework-compatible interfaces. For OLE automation interfaces, the RCW can be generated automatically from a type library. For non-OLE automation interfaces, a developer may write a custom RCW and manually map the types exposed by the COM interface to .NET Framework-compatible types.
Can .NET Framework components be used from a COM program?
Yes. Managed types you build today can be made accessible from COM, and in the common case the configuration is totally automatic. There are certain new features of the managed development environment that are not accessible from COM. For example, static methods and parameterized constructors cannot be used from COM. In general, it is a good idea to decide in advance who the intended user of a given type will be. If the type is to be used from COM, you may be restricted to using those features that are COM accessible.
Depending on the language used to write the managed type, it may or may not be visible by default.
Specifically, .NET Framework components are accessed from COM by using a COM callable wrapper (CCW). This is similar to an RCW (see previous question), but works in the opposite direction. Again, if the .NET Framework development tools cannot automatically generate the wrapper, or if the automatic behavior is not what you want, a custom CCW can be developed.
Can I use the Win32 API from a .NET Framework program?
Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.
Here is an example of C# calling the Win32 MessageBox function:
using System;
using System.Runtime.InteropServices;
class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);
public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}
Subscribe to:
Posts (Atom)
Windows service timer service using background threads - Tuesday, June 10, 2008 this is a windows service timer which runs in the back ground checking for a event to happen |
Create a Setup project for a Windows Service - Thursday, June 05, 2008 Create a Setup project for a Windows Service This section describes how to create a Windows Service project and how to use a compiled Setup project to install the Windows Service. |
Get the index of the SelectedRow in a DataGridView - Wednesday, April 23, 2008 this code shows how to get the index of a selected grid |
c# extracting domain from a url - Friday, April 18, 2008 I was scouring the web for a function which can extract domain from a url and came across this code |
Data grid view multiple checkbox selection - Friday, April 04, 2008 This code shows how to use data grid view and check boxes |
Could not find installable ISAM - Tuesday, March 11, 2008 How to avoid this bug |
.NET Component art controls - Friday, March 07, 2008 About Component art |
Issue of changing IPAddress programatically in windows vista - Thursday, March 06, 2008 |
Referencing Controls in Templates after mode changes in Formview - Wednesday, March 05, 2008 FormView: Referencing Controls in Templates after mode changes |
Programmatically Download File from Remote Location to User Through Server - Wednesday, March 05, 2008 this code shows how to do it |