S.No ViewState SessionState 1View state is maintained in page level only.Session state is maintained in session level.2View state of one page is not visible in another page.i.e., when user requests another page previous page data will be no longer available.Session state value is available in all pages within a user session.i.e., The data will be no longer available if user close the browser or session timeout occurs.3View state information stored in client only. Session state information stored in server.4View state persist the values of particular page in the client (browser) when post back operation done.Session state persist the data of particular user in the server. This data available till user close the browser or session time completes.5View state used to persist page-instance-specific data.Session state used to persist the user-specific data on the server side.
Wednesday, August 29, 2012
Difference between ViewState and SessionState
Difference between Session and Cookies
S.No Session State Cookies 1Session can store any type of data because the value is of datatype of "object"Cookies can store only "string" datatype2These are stored at Server sideThey are stored at Client side3Session are secured because it is stored in binary format/encrypted form and it gets decrypted at server Cookie is non-secure since stored in text format at client side4Session is independent for every client i.e individual for every clientCookies may or may not be individual for every client5There is no limitation on size or number of sessions to be used in an applicationDue to cookies network traffic will increase.Size of cookie is limited to 40 and number of cookies to be used is restricted to 20.6For all conditions/situations we can use sessionsOnly in few situations we can use cookies because of no security7We cannot disable the sessions.Sessions can be used without cookies also(by disabling cookies)We can disable cookies8The disadvantage of session is that it is a burden/overhead on serverSince the value is string there is no security9Sessions are called as Non-Persistent cookies because its life time can be set manuallyWe have persistent and non-persistent cookies
Difference between Gridview,Datalist and Repeater
- Gridview - Limited in design, works like an html table. More in built functionality like edit/update, page, sort. Lots of overhead.
- DataGrid - Old version of the Gridview. A gridview is a super datagrid.
- Datalist - more customisable version of the Gridview. Also has some overhead. More manual work as you have to design it yourself.
- ListView - the new Datalist : Almost a hybrid of the datalist and gridview where you can use paging and build in Gridview like functionality, but have the freedom of design. One of the new controls in this family
- Repeater - Very light weight. No built in functionality like Headers, Footers. Has the least overhead.Features of a GridView
•Displays data as a table •Control over –Alternate item –Header –Footer –Colors, font, borders, etc. –Paging •Updateable •Item as row Features of Repeater
•List format •No default output •More control •More complexity •Item as row •Not updateable Features of DataList •Directional rendering •Good for columns •Item as cell •Alternate item •Updateable
Repeater :
It contains Header Template, Item template , alternate Item template and footer template . it can't support Selection, editing, sorting and paging. this is read only and fast. Datalist : It contains Header Template, Item template , alternate Item template , Edit itm template and footer template . it can't support sorting and paging but support selection and editing DataGrid(or GridView) : It contains Header Template, Item template , alternate Item template , Edit itm template and footer template . it can support selection, editing , sorting and paging . Mostly every developer caught used this control .
Monday, August 27, 2012
Difference between DataTable.Copy and DataTable.Clone
Both the methods DataTable.Clone and DataTable.Copyare are used to make copies of existing datatables, the difference is
DataTable.Clone() - Copies only the structure of the source table with the constraints, the data is not copied from the source table.
DataTable.Copy() - Copies the structure and data from the source table.
Example: DataTable.Clone()
DataTable dt;
dt= sourceTable.Clone();
Here, the targetTable is created with only the structure of the sourceTable
targetTable.Rows.Count() returns 0.
Example: DataTable.Copy()
DataTable dt;
dt= sourceTable.Copy();
Tuesday, August 21, 2012
Difference Between TRUNCATE & DELETE
TRUNCATE
|
DELETE
|
faster and uses fewer system and transaction log resources than DELETE.
|
Slower than truncate because, it maintain logs for every record.
|
removes the data by deallocating the data pages used to store the tables data, and only the page deallocations are recorded in the transaction log.
|
removes rows one at a time and records an entry in the transaction log for each deleted row.
|
removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column.
|
If you want to retain the identity counter, use DELETE instead. If you want to remove table definition and its data, use the DROP TABLE statement.
|
You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint;
|
use DELETE statement without a WHERE clause
|
Because TRUNCATE TABLE is not logged, it cannot activate a trigger.
|
Activates Trigger
|
No Roll back
|
Can Rollback
|
DDL Command
|
DML Command
|
Difference between EXE and DLL
- EXE stands for Extensible Execute File and DLL stands for Dynamic Link Library. It is also called assembly in Dot Net.
- EXE gives direct output, it needs a resource and DLL does not give direct output, it always execute with any software and provide resource to that software.
- EXE is use by End User like-Client but DLL can not use by End User.
- An ActiveX Dll runs is an in process server running in the same memory space as the client process and an ActiveX Exe is an out of process server which runs in it's own separate memory space.
- EXE runs independently, whereas DLL runs within an EXE. DLL is an in-process file and EXE is an out-process file.
- A DLL would share the same process and memory space of the calling application while an EXE creates its separate process and memory space.
- And another difference is that EXEs are executable programs while DLLs are libraries loaded into a process and contain some sort of useful functionality like security, database access or something.
- EXE is mainly executable files which execute when user run the programs or click on them whereas DLL contains the function and procedure which link dynamically when needs them.
- EXE gives direct output, it needs a resource and DLL does not give direct output, it always execute with any software and provide resource to that software.
- EXE is use by End User like-Client but DLL can not use by End User.
- An ActiveX Dll runs is an in process server running in the same memory space as the client process and an ActiveX Exe is an out of process server which runs in it's own separate memory space.
- EXE runs independently, whereas DLL runs within an EXE. DLL is an in-process file and EXE is an out-process file.
- A DLL would share the same process and memory space of the calling application while an EXE creates its separate process and memory space.
- And another difference is that EXEs are executable programs while DLLs are libraries loaded into a process and contain some sort of useful functionality like security, database access or something.
- EXE is mainly executable files which execute when user run the programs or click on them whereas DLL contains the function and procedure which link dynamically when needs them.
Difference between WCF and Web service
Web service is a part of WCF. WCF offers much more flexibility and portability to develop a service when comparing to web service. Still we are having more advantages over Web service, following table provides detailed difference between them.
| Features | Web Service | WCF |
|---|---|---|
| Hosting | It can be hosted in IIS | It can be hosted in IIS, windows activation service, Self-hosting, Windows service |
| Programming | [WebService] attribute has to be added to the class | [ServiceContraact] attribute has to be added to the class |
| Model | [WebMethod] attribute represents the method exposed to client | [OperationContract] attribute represents the method exposed to client |
| Operation | One-way, Request- Response are the different operations supported in web service | One-Way, Request-Response, Duplex are different type of operations supported in WCF |
| XML | System.Xml.serialization name space is used for serialization | System.Runtime.Serialization namespace is used for serialization |
| Encoding | XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom | XML 1.0, MTOM, Binary, Custom |
| Transports | Can be accessed through HTTP, TCP, Custom | Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom |
| Protocols | Security | Security, Reliable messaging, Transactions |
Features of WCF
- Service Orientation
- Interoperability
- Multiple Message Patterns
- Service Metadata
- Data Contracts
- Security
- Multiple Transports and Encodings
- Reliable and Queued Messages
- Durable Messages
- Transactions
- AJAX and REST Support
- Extensibility
WCF is a replacement for all earlier web service technologies from Microsoft. It also does a lot more than what is traditionally considered as "web services".
Subscribe to:
Posts (Atom)