Microsoft Introduce ASP.Net WebHooks

Microsoft Introduce ASP.Net WebHooks. In the MSDN blog article you will get an overview of how to work with Microsoft ASP.NET WebHooks. Microsoft ASP.Net Webhooks make it easy to send and receive webhooks from web application.

MSDN Blog:

Introducing Microsoft ASP.NET WebHooks Preview

Sending WebHooks with ASP.NET WebHooks Preview

Happy Coding 🙂

Advertisements

Rename SQL Table

You can rename a table in SQL Server in following way:

sp_rename OLD_TABLE_NAME, NEW_TABLE_NAME

You must require alteration permission.

Renaming table will not rename stored procedures user-defined functions or programs refer to that table. You must manually modify all object which refer renamed table.

Note: Think twice before you rename a table. If existing stored procedures user-defined functions or programs refer to that table, the name modification will give you an error.

Get a table with (months + year) between two dates using MSSQL

DECLARE @start DATE = GETDATE()
DECLARE @nth INT = 3
DECLARE @end DATE = DATEADD(MONTH, @nth, GETDATE());

WITH cte
AS (
SELECT dt = DATEADD(DAY, – (DAY(@start) – 1), @start)

UNION ALL

SELECT DATEADD(MONTH, 1, dt)
FROM cte
WHERE dt < DATEADD(DAY, – (DAY(@end) – 1), @end)
)
SELECT CONVERT(CHAR(4), dt, 100) + CONVERT(CHAR(4), dt, 120)
FROM cte

Happy Coding 🙂

SOAP vs REST Web Services

SOAP REST
SOAP is a protocol. REST is an architectural style.
SOAP stands for Simple Object Access Protocol. REST stands for REpresentational State Transfer.
SOAP can’t use REST because it is a protocol. REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP.
SOAP uses services interfaces to expose the business logic. REST uses URI to expose business logic.
SOAP defines standards to be strictly followed. REST does not define too much standards like SOAP.
SOAP requires more bandwidth and resource than REST. REST requires less bandwidth and resource than SOAP.
SOAP defines its own security. RESTful web services inherits security measures from the underlying transport.
SOAP permits XML data format only. REST permits different data format such as Plain text, HTML, XML, JSON etc.
SOAP is less preferred than REST. REST more preferred than SOAP.

What is SOAP ?

The Simple Object Access Protocol (SOAP) is an attempt to define a standard for creating web service APIs. It is a pattern, a web service architecture, which specifies the basic rules to be considered while designing web service platforms. It typically uses HTTP as a layer 7 protocol, although this is not mandatory. The SOAP message itself consists of an envelope, inside of which are the SOAP headers and body, the actual information we want to send. It is based on the standard XML format, designed especially to transport and store structured data. SOAP may also refer to the format of the XML that the envelope uses.

What is REST ?

The Representational State Transfer (REST) is another architectural pattern (resource-oriented), an alternative to SOAP. Unlike SOAP, RESTful applications use the HTTP build-in headers (with a variety of media-types) to carry meta information and use the GET, POST, PUT and DELETE verbs to perform CRUD operations. REST is resource-oriented and uses clean URLs (or RESTful URLs).

SOAP API REST API
Supports data in the form of XML only Supports both XML and JSON format
Requires WSDL for the integration Preferred for mobile and web apps since JSON being Lighter the app runs smoother and faster
Use SOAP API in any language that supports Web services.

Happy Coding 🙂

How to detect browser name and version using javascript or jquery in asp.net

<html>
<head>
 <script>
 navigator.sayswho = (function () {
 var ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
 
 if (/trident/i.test(M[1])) {
 tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
 //return 'IE ' + (tem[1] || '');
 return { name: 'IE ', version: (tem[1] || '') };
 }
 
 if (M[1] === 'Chrome') {
 tem = ua.match(/\bOPR\/(\d+)/);
 //if (tem != null) return 'Opera ' + tem[1];
 if (tem != null) { return { name: 'Opera', version: tem[1] }; }
 }
 
 M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];

 if ((tem = ua.match(/version\/(\d+)/i)) != null) {
 M.splice(1, 1, tem[1]);
 }
 alert('Browser Name: ' + M.join(' and Version # '));
 return M.join(' ');
 })();
 </script>
</head>
</html>

Copy above code and paste it into notepad and save notepad as .html file. Now open .html file and you will see the result.

http://www.codeproject.com/Answers/898796/How-to-get-browser-name-in-javascript-or-jquery-in#answer2