Saturday, February 13, 2010

Difference between BasicHttpBinding and WsHttpBinding

If we want to summarize in one sentence, the difference between WsHttpBinding and BasicHttpBinding is that WsHttpBinding supports WS-* specification. WS-* specifications are nothing but standards to extend web service capabilities.

Below is a detailed comparison table between both the entities from security, compatibility, reliability and SOAP version perspective.




Security support

This supports the old ASMX style, i.e. WS-BasicProfile 1.1.

This exposes web services using WS-* specifications.


This is aimed for clients who do not have .NET 3.0 installed and it supports wider ranges of clients. Many of the clients like Windows 2000 still do not run .NET 3.0. So older version of .NET can consume this service.

As its built using WS-* specifications, it does not support wider ranges of client and it cannot be consumed by older .NET version less than 3 version.

Soap version

SOAP 1.1

SOAP 1.2 and WS-Addressing specification.

Reliable messaging

Not supported. In other words, if a client fires two or three calls you really do not know if they will return back in the same order.

Supported as it supports WS-* specifications.

Default security options

By default, there is no security provided for messages when the client calls happen. In other words, data is sent as plain text.

As WsHttBinding supports WS-*, it has WS-Security enabled by default. So the data is not sent in plain text.

Security options

  • None
  • Windows – default authentication
  • Basic
  • Certificate
  • None
  • Transport
  • Message
  • Transport with message credentials

One of the biggest differences you must have noticed is the security aspect. By default, BasicHttpBinding sends data in plain text while WsHttpBinding sends it in encrypted and secured manner.

Friday, February 12, 2010

when to create interfaces

I got the thread from MSDN about when to create interfaces.really it will helpful to understand the need of the creating interface. some points from the thread.
  • Interfaces are better suited to situations in which your applications require many possibly unrelated object types to provide certain functionality.

  • Interfaces are more flexible than base classes because you can define a single implementation that can implement multiple interfaces.

  • Interfaces are better in situations in which you do not have to inherit implementation from a base class.

  • Interfaces are useful when you cannot use class inheritance. For example, structures cannot inherit from classes, but they can implement interfaces.

MSDN:when to create interfaces

Thursday, February 11, 2010

Search in Datagridview

                 This is a sample for search datagridview for example.  The user will  type the employee number into the textbox and click on the search button.  then we want the focus to move to the row with the employee number .
private void SelectGridRow(int id)
 foreach (DataGridViewRow row in dataGridView1.Rows)
  //assume col 0 as emp column
  if (dataGridView1.Rows[row.Index].Cells[0].Value.Equals(id))
   dataGridView1.Rows[row.Index].Selected = true;
   dataGridView1.Rows[row.Index].DefaultCellStyle.BackColor = Color.Coral;
   dataGridView1.FirstDisplayedScrollingRowIndex = row.Index;


    Transactions provide a way to group a set of actions or operations into a single indivisible unit of execution. A transaction is a collection of operations with the following properties:

  • Atomicity. This ensures that either all of the updates completed under a specific transaction are committed and made durable or they are all aborted and rolled back to their previous state.

  • Consistency. This guarantees that the changes made under a transaction represent a transformation from one consistent state to another. For example, a transaction that transfers money from a checking account to a savings account does not change the amount of money in the overall bank account.

  • Isolation. This prevents a transaction from observing uncommitted changes belonging to other concurrent transactions. Isolation provides an abstraction of concurrency while ensuring one transaction cannot have an unexpected impact on the execution of another transaction.

  • Durability. This means that once committed, updates to managed resources (such as a database record) will be persistent in the face of failures.

Friday, January 29, 2010