Hello folks ,
Lets go back in the 90s to know this
made it difficult for the developers to make the website compatible in both the browsers.
Declaration of ECMA script :
In June 1997, ECMA International published the first edition of the ECMA-262 specification.
In June 1998, some modifications were made to adapt it to the ISO/IEC-16262 standard, and the second edition was released. The third edition of ECMA-262 was published on December 1999.
Development of the fourth edition of the ECMAScript standard was never completed.The fifth edition was released in December 2009. The current edition of the ECMAScript standard is 6, released in June 2015.
List of ECMA Script features browser supporting http://kangax.github.io/compat-table/es5/
Microsoft has introduced a helpful framework with ASP.NET MVC4 called WEB API for building the http based services.
In this article we will cover following points about this new framework
2) WHY WEB API
ASP.net Web API is an api which helps in creating the http based client and server endpoints on top of the ASP.net framework.
The Client side http based programming model has been built in to the System.net and the server side http based programming model has been built in to the WCF.
The First version of WCF did not support the Http based services.
It strongly supported the traditional Soap based service endpoints which really lack in the many other features in http like caching , compression etc.
With the release of the .NET Framework 3.5 in November 2007, Microsoft released the feature to create the simple http based endpoints but it was again more embedded in the WCF.
So Microsoft WCF team has decided to come up with the framework which is completely used for the http based services ,
As ASP.NET team is more engage in the web / http work , routing , html Microsoft has decided to merge this framework with the ASP.Net
and introduced WEB API with the ASP.NET MVC 4 release.
If we are implementing an application whether html 5 or mobile , they need services for accessing data or to artifact the system.
In the modern programming land scape services should be created by keeping wide range of clients in mind.
Most of the applications are accessing data as JSON using HTTP based services which is going to be a trend than accessing data from traditional Soap services.
please refer http://www.asp.net/web-api for details of web api.
ASP.NET # MVC # 21 Telerik Grid with checkboxes problem – Grid does not maintain the state of the checkboxes on changing page index
Telerik provides the best UI controls for the ASP.NET MVC application development.
Especially the Telerik Grid is used often in the web development.
However Checkbox column functionality of Telerik Grid does not maintain the state of the checkboxes on the page index changing event.
If user selects check boxes on the first page and then goes to the other and the checks made on the first page disappears.
In this example we have a grid with checkboxes that is bound to the Model class name Order.
The order class has three properties OrderId,OrderName and IsChecked. IsChecked property is a Boolean flag to see whether order is previously checked or not.
Controller code contains _ChckBoxesAjax method with a GridAction attribute that returns the IEnumerable list of type Order class.
1. RegisterLiveEventForCheckBoxes – This method should be called on the document.ready method of the page which has the Grid on it.
2.OnCheckBoxGridDataBound – This method will be called on the OnDataBound event of the grid.
In this article , we will see how to write the generic error handler in the WCF which is used for custom error logging and in returning the appropriate fault message to the user if any error comes while processing the user request.
IErrorHandler interface is used for error handling and logging in the WCF.
HandleError method logs an error.
It returns true if the error is considered as already handled other wise false will be returned and error will be handled as usual.
ProvideFault method can only be used in DUPLEX communication.
This method allows to create the custom FaultException
This method accepts the parameter error which is of type Exception , this exception is the exception occurs during the execution of a service method.
Following is the code for IErrorHandler interface Implementation.
Brief Summary for the code above
1) It has been derived from the Attribute class so that it can be used as an attribute over the service class directly.
2)It has been also derived from IServiceBehaviour interface which is used to apply this ErrorHandler behavior to the channel dispatcher in the Service
Now our ErrorHandlerBehavior attribute is ready to use on any WCF service.The benefit of creating the atttribute for this behavior is we can directly use this in the c# code on the service class as below
While using LINQ as Linq to Sql queries , We often come across a scenario where we have to join the same table for multiple columns in it.
Following example illustrates how we can achieve it in Linq :
We have two tables Table1 and Table2 with columns column1 and column2 and we have to join the Table1 with Table2 for both the columns.
We can achieve it using AnonymousType introduced by Microsoft.
Following is the code used for it
Many times we come across a situation when we need to call a method asynchronously and don’t want to wait till it completes its execution.
For Example In the above code, if I want to call
AsynchronousMethod() and not wait for it to finish executing? In fact, to make things interesting, what if I didn’t care when it is finished?
Let’s say, I just wanted to call AsynchronousMethod() without waiting for any of the function calls to complete. Basically, doing something called Fire and Forget. You call the function, you don’t wait for it, and you just forget about it.
* BeginInvoke() is the line of code that executes the
AsynchronousMethod() function. However, the control is returned to the caller right away, without waiting for
AsynchronousMethod() to complete.
* The code above does not know when a call to
* BeginInvoke() is used instead of
Invoke(). For now, don’t worry about the parameters this function takes; I will cover that in more detail later.
How .NET works in background to make this Possible?
Once you ask the framework to call something asynchronously, it needs a thread to do the work. It can not be the current thread, because that would make the invocation synchronous (blocking). Instead, the runtime queues a request to execute the function on a thread from the .NET Thread Pool. You don’t really need to code anything for it, all of it happens in the background. But, just because it is all transparent doesn’t mean you should care about it. There are a few things to remember:
* AsynchronousMethod() is executed on a separate thread, a thread that belongs to the .NET Thread Pool.
* A .NET Thread Pool contains threads in it , and each time
AsynchronousMethod() is called, it is going to be executed on one of these threads. You can’t control which one.
* The Thread Pool has its limits! Once all the threads are used, an async method invocation is queued until one of the threads from the pool is freed. This is called Thread Pool Starvation, and normally when it comes to that, performance is compromised.
Hope this Helps!!!!!!
An HTTP module is an object that sits in the ASP.NET pipeline, where it can see-and even modify-incoming requests and outgoing responses.
Today while working with website containing multiple applications , I faced a scenario where i need to log incoming requests in database . By collecting the login name, a date and time, and the application that the user accessed during the login session.
By thinking on above scenario one would say what’s a big deal in this!! we can make entry every time the user clicks on the application .but problem with this solution is it would give call to the database every time user clicks on any application. First, it performs database insert. Second, it uses a request-processing thread to perform the I/O-a thread that could otherwise be used to service additional incoming requests, which imposes a penalty on throughput.
So for this we decided to write a http module which made it possible for us, but Question is How httpModule improve our performance / throughput the answer is ASYNCHRONOUS HttpModule.
How above module works asynchronous???
Its Init method calls HttpApplication.AddOnPreRequestHandlerExecuteAsync in order to register begin and end methods for PreRequestHandlerExecute events.
The HttpApplication class features other AddOn methods for other per-request events. For example, an HTTP module can call AddOnBeginRequestAsync to register async handlers for BeginRequest events.
AsyncRequestLogModule’s OnBeginAsync method uses the framework’s BeginExecuteNonQuery method to begin an asynchronous insert. The moment OnBeginAsync returns, the thread goes back into the thread pool.
Hope this helps