Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
18 December 2012
Click the button using Javascript
Click the button using Javascript
document.getElementById("btnSearch").click();
Javascript Empty validation in Asp.net
Javascript Empty validation
function CheckEmpty() {
try {
if (document.getElementById("txtClientNumber").value.trim() == "") {
alert("Must enter a Client Number");
return false;
}
}
catch (e) {
}
}
calling javascript from server side
btnAdd.Attributes.Add("onclick", "return CheckEmpty();")
Asp.net Gridview mouseover, mouseout color change in C#
Asp.net Gridview mouseover, mouseout color change in C#
protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.color='Red'";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';this.style.color='Black'";
e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.grd, "Select$" + e.Row.RowIndex);
}
}
catch (Exception ex)
{
throw ex;
}
}
Confirm ok/cancel in Javascript in Asp.net
Confirm ok/cancel in Javascript in Asp.net
function askConfirm()
{
if (confirm("Are you sure want to overwrite the file")) {
}
else {
return false;
}
function askConfirm()
{
if (confirm("Are you sure want to overwrite the file")) {
}
else {
return false;
}
Calling js from server side coding in Asp.net
ScriptManager.RegisterStartupScript(this, GetType(), "YourUniqueScriptKey", "askConfirm();", true);
Stored Procedure used to search the word in the Database Sql Server
Below Stored Procedure used to search the word in the Database Sql Server
/*
Test Script:
exec Find_Text_In_SP 'Searchword'
*/
CREATE Procedure dbo.Find_Text_In_SP(
@SearchString AS VARCHAR(500)
)
AS
BEGIN
SET NOCOUNT ON
SELECT name
FROM
sysobjects
WHERE
id IN
(SELECT id
FROM
syscomments
WHERE
text LIKE '%' + @SearchString + '%')
ORDER BY
name
END
14 December 2012
The MVC Programming Model in Asp.net
The MVC Programming Model in Asp.net
MVC is one of three ASP.NET programming models.
MVC is a framework for building web applications using a MVC (Model View Controller) design:
The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes:
Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
View. The view manages the display of information.
Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.
It is important to note that both the view and the controller depend on the model. However, the model depends on neither the view nor the controller. This is one the key benefits of the separation. This separation allows the model to be built and tested independent of the visual presentation. The separation between view and controller is secondary in many rich-client applications, and, in fact, many user interface frameworks implement the roles as one object. In Web applications, on the other hand, the separation between view (the browser) and controller (the server-side components handling the HTTP request) is very well defined.
28 November 2012
Get only Date in Sql Server
Get only Date in Sql Server
convert(VARCHAR(10), Fieldname, 101) AS [Field Name]
convert(VARCHAR(10), Fieldname, 101) AS [Field Name]
26 November 2012
royalarun.blogspot.com menu
C# and VB.Net :
What is Dotnet Framework?
Root namespace in dotnet framework
What is Webservice in asp.net
Base class for all classes in Dotnet framework
Asp.net Page Life cycle Overview?
Server.Transfer vs Response.Redirect
Change File creation date and time Conversion in C#
Bucket Problem in C# windows application
Session state mode in asp.net
Update Datatable in C#
Common myths in Asp.net
Windows Communication Foundation Overview
WCF and Webservices
Synclock and Lock in C#
Lamda Expression in C#
Anonymous type in C#
Extension Method in C#
String vs string in C#
Use of Using statement in C#
CalendarExtender show only years asp.net ajax control
Check Connection string is valid or not in C#
Event viewer read , write and Clear in C#
Application path in windows application in C#
Asp.net Path details - Absolute path and Relative path
Use Application Wrapper Class To Access Web.Config Values
Web application vs Web Service
End Point, Address Binding in WCF
Calling Javascript from server side in asp.net
C# and VB.net Connectivity with Query string
Debug the Windows server in Setup
C# and Vb.net Connectivity using Stored Procedure
Generics in Dotnet
Boxing and Unboxing in Dotnet
Response.redirect true vs False
Asp.net Impersonation
HTTP Status Code
Session state mode in Asp.net
Client side state management in asp.net
Page life cycle event in asp.net
Web application vs Website in Asp.net
Cloud Computing Definition
View State vs Hidden Fields in asp.net
Adding datarelation in Datatable in C#
Click the button when enter button is pressed in asp.net
Naming Convention in Asp.net
Export datatable in C# Windows application
Calculate time Difference between two dates in Asp.net
Webfarm in asp.net
Webgarden in Asp.net
When to use Generic Collection
String is Immutable in C# and Java, Use of String builder in C#
SqlBulk Copy in C#
SqlHelper Class file from Microsoft in C#
Hash table in C#
Get Multiple Value from CheckedListbox control in C#
List in C#
Session vs Caching in asp.net
Refer one asp.net page to another asp.net page
Http modules in asp.net
Http Handlers in asp.net
Get the Function name,Line number,Columnnumber of the Error in C#
What is Reflection and example
Choose the right Generic collection type in Dotnet framework
Difference between Assembly and Namespace in dotnet framework
Partial Class in C#
Why use Collections in Dotnet Framework
Move next line in multiline textbox in C#
Problem:Combobox Editable in C# Windows application and Asp.net
Partial Class in C#
Linq and XML in C#
Connection string for C# and Vb.net
Difference between typed dataset and untyped dataset in .Net framework
What are the basic differences between user controls and custom controls?
DELEGATES IN C#
OUTPUT PARAMETER IN C#
Advantages Of Visual Studio 2008
Option Explicit statement and Option Strict Statement
Difference Between Int32.Parse(), Convert.ToInt32(), and Int32.TryParse()
E-mail Validation Using REGEX
VB.NET VALIDATION USING ASCII
C# VALIDATION USING ASCII
Configuration system fail to initialize in C# windows application
Single Click Selection - CheckListbox Change Property Double click to Single Click C# and VB.NET
Disable remember password option in Firefox/Internet Explorer In Code
How to Overcome multiline textbox [draggable] for mozilla firefox and Chrome Browser in asp.net
WCF vs Webservice in asp.net
COALESCE (Transact-SQL)
OOPS
Single responsibility principle in OOPS
When to use Structure?
When to use Delegates instead of Interface?
When to Use Inheritance?
Stack and Queue real time example
Composition vs Inheritance in OOPS
When to Use Abstract class
When to use Interface ?
Interface vs Abstract Class
Single ton Class with example in C#
Meaning For Dotnet First line of Code
Difference Between ASP.NET Server Controls,HTML Server Controls and HTML Intrinsic Controls
General
What is Mobile apps?
Difference between Sleep and Hibernate in Laptop
Cloud computing - Overview
Alternate tag for Html tag, while posting in blog
To reset IIS
Redbus Success Story
Difference between 32 bit and 64 bit Processor
Run Commands that can be used in both “Windows Operating System
Difference Style of Communication
Assertive Communication
Link with in the page in HTML
Sql Server Queries
50 new features in Sql Sever 2008
Sql Server Tips and Guidelines
SSMS Tool Pack Free Download
Sql Group by Function with Example
Normalization types with example
View in Sql Server with Example
Get all the table name in Database Sql Server
Delete all Stored Procedure in Sql Server
Varchar vs nVarchar in Sql Server
Sql Server Having Clause
Copy one table to another in Sql Server
Stored Procedure that change in Last n days
Stored Procedure that create in n days in Sql Server
Show the Stored Procedure Permission details in Sqlserver
Query to Find Seed Values, Increment Values and Current Identity Column value of a table in Sqlserver
Delete Column in Sql Server tables
Script for renaming object in Sql Server
Script for renaming table Column in Sql Server
Select and Case statement in Sql Server
Sql Server where 1=0
Sql Server where 1=1
While loop in Sql Server
Pivot and Unpivot Query in Sql Server
Display list of stored procedure using particular text in Sql Server
Find the text in Stored Procedure in Sql Server
Sql injection in Sql Server
Hierarchy ID in Sql Server
Try Catch in Sql Server
Wait for in Sql Server 2008
Trigger overview in Asp.net
Difference between Primary key and Unique Key
Different types of Database keys
Difference between sp_executesql and EXEC() in Sql Server
Microsoft SQL Server Constrains
Uses of SET XACT_ABORT in Sql Server
Dynamic Store Procedure in Sql Server
Check String is null or empty in Sql Server
Empty all table values in Sql Server
Difference between Temporary table and Global Temporary table
Trigger in Sql Server and types
Difference between Oracle and Sql Server
Difference between const and static readonly keywords C#
SET NOCOUNT { ON | OFF } in DOT NET
Introduction to Merge Statement – One Statement for INSERT, UPDATE, DELETE
Insert Multiple Rows in a single statement in Sql Server 2008
SQL PRIMARY KEY
SQL FOREIGN KEY
Difference between Stored procedure vs User Functions in Sql server
Difference Between SCOPE_IDENTITY and ROWCOUNT in sql server
Convert String to Datetime in Sql Server
To Find Highest Salary, nth Highest Salary, Lowest Salary, nth Lowest Salary
Coding to get nth record in sql server
Trigger example in Sql Server
PRIMARY KEY Constraints Primary key and Composite Primary key
Get only Date in Sql Server
What is Dotnet Framework?
Root namespace in dotnet framework
What is Webservice in asp.net
Base class for all classes in Dotnet framework
Asp.net Page Life cycle Overview?
Server.Transfer vs Response.Redirect
Change File creation date and time Conversion in C#
Bucket Problem in C# windows application
Session state mode in asp.net
Update Datatable in C#
Common myths in Asp.net
Windows Communication Foundation Overview
WCF and Webservices
Synclock and Lock in C#
Lamda Expression in C#
Anonymous type in C#
Extension Method in C#
String vs string in C#
Use of Using statement in C#
CalendarExtender show only years asp.net ajax control
Check Connection string is valid or not in C#
Event viewer read , write and Clear in C#
Application path in windows application in C#
Asp.net Path details - Absolute path and Relative path
Use Application Wrapper Class To Access Web.Config Values
Web application vs Web Service
End Point, Address Binding in WCF
Calling Javascript from server side in asp.net
C# and VB.net Connectivity with Query string
Debug the Windows server in Setup
C# and Vb.net Connectivity using Stored Procedure
Generics in Dotnet
Boxing and Unboxing in Dotnet
Response.redirect true vs False
Asp.net Impersonation
HTTP Status Code
Session state mode in Asp.net
Client side state management in asp.net
Page life cycle event in asp.net
Web application vs Website in Asp.net
Cloud Computing Definition
View State vs Hidden Fields in asp.net
Adding datarelation in Datatable in C#
Click the button when enter button is pressed in asp.net
Naming Convention in Asp.net
Export datatable in C# Windows application
Calculate time Difference between two dates in Asp.net
Webfarm in asp.net
Webgarden in Asp.net
When to use Generic Collection
String is Immutable in C# and Java, Use of String builder in C#
SqlBulk Copy in C#
SqlHelper Class file from Microsoft in C#
Hash table in C#
Get Multiple Value from CheckedListbox control in C#
List in C#
Session vs Caching in asp.net
Refer one asp.net page to another asp.net page
Http modules in asp.net
Http Handlers in asp.net
Get the Function name,Line number,Columnnumber of the Error in C#
What is Reflection and example
Choose the right Generic collection type in Dotnet framework
Difference between Assembly and Namespace in dotnet framework
Partial Class in C#
Why use Collections in Dotnet Framework
Move next line in multiline textbox in C#
Problem:Combobox Editable in C# Windows application and Asp.net
Partial Class in C#
Linq and XML in C#
Connection string for C# and Vb.net
Difference between typed dataset and untyped dataset in .Net framework
What are the basic differences between user controls and custom controls?
DELEGATES IN C#
OUTPUT PARAMETER IN C#
Advantages Of Visual Studio 2008
Option Explicit statement and Option Strict Statement
Difference Between Int32.Parse(), Convert.ToInt32(), and Int32.TryParse()
E-mail Validation Using REGEX
VB.NET VALIDATION USING ASCII
C# VALIDATION USING ASCII
Configuration system fail to initialize in C# windows application
Single Click Selection - CheckListbox Change Property Double click to Single Click C# and VB.NET
Disable remember password option in Firefox/Internet Explorer In Code
How to Overcome multiline textbox [draggable] for mozilla firefox and Chrome Browser in asp.net
WCF vs Webservice in asp.net
COALESCE (Transact-SQL)
OOPS
Single responsibility principle in OOPS
When to use Structure?
When to use Delegates instead of Interface?
When to Use Inheritance?
Stack and Queue real time example
Composition vs Inheritance in OOPS
When to Use Abstract class
When to use Interface ?
Interface vs Abstract Class
Single ton Class with example in C#
Meaning For Dotnet First line of Code
Difference Between ASP.NET Server Controls,HTML Server Controls and HTML Intrinsic Controls
General
What is Mobile apps?
Difference between Sleep and Hibernate in Laptop
Cloud computing - Overview
Alternate tag for Html tag, while posting in blog
To reset IIS
Redbus Success Story
Difference between 32 bit and 64 bit Processor
Run Commands that can be used in both “Windows Operating System
Difference Style of Communication
Assertive Communication
Link with in the page in HTML
Sql Server Queries
50 new features in Sql Sever 2008
Sql Server Tips and Guidelines
SSMS Tool Pack Free Download
Sql Group by Function with Example
Normalization types with example
View in Sql Server with Example
Get all the table name in Database Sql Server
Delete all Stored Procedure in Sql Server
Varchar vs nVarchar in Sql Server
Sql Server Having Clause
Copy one table to another in Sql Server
Stored Procedure that change in Last n days
Stored Procedure that create in n days in Sql Server
Show the Stored Procedure Permission details in Sqlserver
Query to Find Seed Values, Increment Values and Current Identity Column value of a table in Sqlserver
Delete Column in Sql Server tables
Script for renaming object in Sql Server
Script for renaming table Column in Sql Server
Select and Case statement in Sql Server
Sql Server where 1=0
Sql Server where 1=1
While loop in Sql Server
Pivot and Unpivot Query in Sql Server
Display list of stored procedure using particular text in Sql Server
Find the text in Stored Procedure in Sql Server
Sql injection in Sql Server
Hierarchy ID in Sql Server
Try Catch in Sql Server
Wait for in Sql Server 2008
Trigger overview in Asp.net
Difference between Primary key and Unique Key
Different types of Database keys
Difference between sp_executesql and EXEC() in Sql Server
Microsoft SQL Server Constrains
Uses of SET XACT_ABORT in Sql Server
Dynamic Store Procedure in Sql Server
Check String is null or empty in Sql Server
Empty all table values in Sql Server
Difference between Temporary table and Global Temporary table
Trigger in Sql Server and types
Difference between Oracle and Sql Server
Difference between const and static readonly keywords C#
SET NOCOUNT { ON | OFF } in DOT NET
Introduction to Merge Statement – One Statement for INSERT, UPDATE, DELETE
Insert Multiple Rows in a single statement in Sql Server 2008
SQL PRIMARY KEY
SQL FOREIGN KEY
Difference between Stored procedure vs User Functions in Sql server
Difference Between SCOPE_IDENTITY and ROWCOUNT in sql server
Convert String to Datetime in Sql Server
To Find Highest Salary, nth Highest Salary, Lowest Salary, nth Lowest Salary
Coding to get nth record in sql server
Trigger example in Sql Server
PRIMARY KEY Constraints Primary key and Composite Primary key
Get only Date in Sql Server
20 November 2012
Update Datatable in C#
// Update Datatable in C#
//Two methods to Update Datatable in C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace DataTableUpdation
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
DataTable dt = new DataTable();
//Add Datacolumn
DataColumn workCol = dt.Columns.Add("FirstName", typeof(String));
dt.Columns.Add("LastName", typeof(String));
dt.Columns.Add("Blog", typeof(String));
dt.Columns.Add("City", typeof(String));
dt.Columns.Add("Country", typeof(String));
//Add in the datarow
DataRow newRow = dt.NewRow();
newRow["firstname"] = "Arun";
newRow["lastname"] = "Prakash";
newRow["Blog"] = "http://royalarun.blogspot.com/";
newRow["city"] = "Coimbatore";
newRow["country"] = "India";
dt.Rows.Add(newRow);
// 1st method
// Get all DataRows where the name is the name you want.
IEnumerable< DataRow > rows = dt.Rows.Cast< DataRow >().Where( r => r["firstname"].ToString() == "Arun");
// Loop through the rows and change the name.
rows.ToList().ForEach(r => r.SetField("firstname", "AnotherName"));
// 2nd method
// Alternative approach.
// Simply loop through the rows, check the value of the Name field and change its value accordingly.
foreach (DataRow row in dt.Rows)
{
if (row["firstname"].ToString() == "AnotherName")
row.SetField("firstname", "Arun");
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
11 October 2012
Common myths in Asp.net
Common myths in Asp.net :
C# code is faster than Visual Basic code:
· if good programming practices are followed, there is no reason why Visual Basic and C# code cannot execute with nearly identical performance. To put it more succinctly, similar code produces similar results.
Codebehind is faster than inline :
· It doesn't matter where your code for your ASP.NET application lives, whether in a codebehind file or inline with the ASP.NET page.
Components are faster than pages:
· It is better to group functionality logically this way, but again it makes no difference with regard to performance.
For Each is better performance than For loop:
For Each is better performance than For loop:
Really for loop has better performance than Foreach statement
2 October 2012
Windows Communication Foundation - Overview
Windows Communication Foundation - Overview
Windows Communication Foundation (WCF) is a framework for building and running service-oriented applications. WCF unifies and extends the functionality of existing Microsoft connecting technologies, providing a single programming model independent of underlying communications protocols. WCF applications can interoperate with other technologies using open standards and protocols.
Characteristics and Benefits
Windows Communication Foundation delivers the following primary benefits: service-oriented architecture (SOA) support, flexible support for messaging models, a unified programming model, protocol neutrality, increased reliability, standards-based interoperability, integrated security and messaging services, and a flexible architecture designed for extensibility.
Service-Oriented Architecture (SOA)
Windows Communication Foundation is based on the principles of service-oriented architecture and programming. Service-orientation is an important complement to object-orientation that applies the lessons learned from component software, message-oriented middleware, and distributed object computing. Whereas object-oriented development focuses on applications that are built from interdependent classes, service-oriented development focuses on systems that are built from a set of autonomous services. The internal implementation of each service could be object-oriented.
Client and server applications built with WCF are composed of .NET Framework 3.0-supplied and developer-created classes. For very complex applications, an intermediate level of organization, called component architecture may also be applied, as depicted for a service in the following diagram:
A set of deployed, interacting services is called a system. SOA interactions are loosely-coupled because all communication is based upon published contracts and policies, standardized protocols, and schematized information. Contracts describe published interfaces, their operations, and the corresponding messages.
Unified Programming Model
Windows Communication Foundation represents the next generation connecting technology that combines and extends the best attributes of existing connecting technologies to deliver a unified development and runtime experience. It provides a single API and a consistent, straightforward programming model that supersedes the following technologies:
- DCOM and .NET Remoting support for efficient Remote Procedure Call (RPC) functionality.
- ASP.NET Web Services (ASMX) support for easily configurable, interoperable Web Services.
- .NET Framework Enterprise Services support for synchronization, distributed transactions, basic security, and distributed COM+ services.
- Web Services Enhancements (WSE) support for open Web Service standards, collectively known as WS-* specifications. This includes security, reliable messaging, and distributed transactions specifications.
- Queued messaging that is compatible with either MSMQ or the .NET Framework System.Messaging namespace technologies.
Flexible Support for Messaging Models
Classical Web services typically assume a request/reply message exchange pattern, where the client issues a request message and the service responds with a reply message. This pattern is particularly suited to HTTP because it is a stateless protocol with no delivery guarantees. In contrast, Windows Communication Foundation enables a wide variety of message topology solutions.
Two main communication state models are supported:
- A stateless model — messages are received with few or no guarantees. The stateless model is equivalent to most current-day Web services and is useful when broadcasting non-critical, one-way information.
- A stateful model — creates a communication session between two service objects. This model uses session state to enable Web services to provide advanced message functionality across the Internet, including callback methods, events, widely distributed transactions, and reliability and durability guarantees that enterprise applications require.
Three basic message-exchange patterns are supported:
- Datagram — one-way invocation, no response.
- Request/reply — one way invocation with response.
- Duplex — two-way invocation.Request/reply and duplex messages can be invoked synchronously or asynchronously. Each node can act as a client, service, or both.
Windows Communication Foundation provides a variety of built-in transports and messaging protocols and supports custom transports and protocols. More complex messaging solutions (for example, publish-and-subscribe or peer-to-peer) can be built on top of these basic capabilities.
Protocol Neutrality and Flexibility
Windows Communication Foundation contains a set of predefined communication bindings (a binding is a set of communication characteristics including communication protocols) that will serve a wide range of common usage scenarios. However, the protocol-agnostic design of WCF supports flexibility in the following ways:
- The messages exchanged between service and clients are defined in contracts that are independent of the protocols used to exchange those messages.
- A single service can support multiple protocols simultaneously.
- A pluggable communication infrastructure enables custom protocols to be defined and used in a straightforward manner.
Protocols can be selected through both imperative code and configuration files. Typically, the developer implements the logic of an application, including default protocols and minimum requirements, and the service administrator specifies configuration details at deployment, which often include the actual protocols used. These deployment-time policies do not require recoding or recompilation, enabling the administrator to tune the deployment of the service or client.
Reliability
The reliability and robustness of solutions built with the Windows Communication Foundation is assured for a number of reasons, including:
- SOA requires loosely-coupled, autonomous clients and services, which increases unit isolation; the loss or corruption of one service does not bring down the entire solution.
- Message delivery can be assured at either the transport level or at the message level using the WS-Reliable Messaging protocol. This guarantees that messages are delivered in a consistent pattern (for example, in-order and delivered exactly once).
- For more sophisticated requirements, queued messaging through MSMQ is supported.
- Powerful mechanisms are available to handle critical failures; internal application exceptions and external message faults are handled in an elegant and consistent fashion.
- Distributed transaction support increases the reliability of a solution by enforcing operation consistency and further decreasing process coupling.
- Perhaps most importantly, WCF eliminates the need for each organization or project to develop their own messaging infrastructure, freeing them to concentrate on developing code in their area of expertise.
Extensibility
Windows Communication Foundation supports extensibility through the following features:
- A thoroughly extensible object model, making it possible to customize the product to suit specific customer needs.
- Composable protocol channels that allow combining or stacking existing protocols to satisfy scenario requirements.
- An architecture designed to support pluggable extension classes so that the following areas can be customized: protocols, transports, behaviors, bindings, serializers, message inspectors, and validators. These types of extensions are beyond the scope of this document, but for more information, see "Extending Windows Communication Foundation" in the Windows SDK.
From a developer's perspective, these extensibility features are both straightforward and powerful to use.
Integration and Interoperability
The Windows Communication Foundation assures a high level of compatibility with other Web services and existing Microsoft messaging technologies. Interoperability is often a primary concern for large scale, organization-wide solutions (for example, Enterprise Application Integration (EAI) and Business-to-Business Integration). Messaging interoperability issues fall into two categories:
- With other messaging platforms, possibly residing on heterogeneous operating systems and programming languages
- With other Microsoft services and messaging technologies
From a messaging perspective, WCF is designed to be platform-agnostic. Because it uses open WS-* standards to transport, format, and interpret messages, it can interoperate with any other messaging system that relies on these same standards. Specifically, WCF services will interoperate with any system that communicates using WS-I Basic Profile (BP)-compliant wire protocols. (The Web Services Interoperability Organization (WS-I) is a consortium of leading Web service leaders whose mission is to develop and promote interoperable messaging standards.) For example, WCF interoperates with existing ASP.NET Web services (ASMX). WS-* standards for reliability, security, and transactions are also supported, which makes it interoperable with the Web Services Enhancements for .NET Framework (WSE) 3.0.
The following diagram depicts the Web services stack and lists the primary standards supported at each level.
Microsoft has also done significant work to assure compatibility of Windows Communication Foundation with existing Microsoft technologies for building distributed systems (for example, Enterprise Services, COM+ services, and Message Queuing). Applications built with these existing technologies can now easily expose functionality as Web services. Windows Communication Foundation can communicate with these applications using standard Web service's profiles. The migration of existing applications that use .NET Remoting, ASP.NET Web services, and .NET Framework Enterprise Services to natively use the Windows Communication Foundation is often straightforward and cost-efficient. More information on specific integration approaches will be published on MSDN online.
From a general application development standpoint, Windows Communication Foundation integrates seamlessly with other managed technologies, and through .NET interop, with unmanaged technologies.
Integrated Security and Messaging Services
Security is a prime consideration. Message identity, confidentiality, integrity, authentication, authorization, and auditing are provided through transport- or message-level security mechanisms.
Security Level
|
Example
|
Description
|
Transport
|
HTTPS, SSL over TCP
|
Point-to-point security that protects the entire message by encrypting the communication stream. Transport-level security schemes are widely deployed and usually more efficient than message-level security.
|
Message
|
WS-Security family of specifications
|
End-to-end security where only message contents, or portions of them, are encrypted. Message-level security schemes are independent of transports and message-exchange patterns. Although they tend to be slower to process, they are much more flexible and extensible, and can use a variety of authentication schemes.
|
Windows Communication Foundation also provides a basic level of federation, in that a service can be configured to accept security credentials from multiple authorities, possibly using different identity and authorization schemes. Other areas of security (for example, authentication, non-repudiation, auditing, and resource protection) are provided by the .NET Framework or the Windows operating system.
In addition to basic delivery and security, a wide range of high-level message services are provided, including:
- Metadata — WS-Policy, WS- Policy Attachments, and WS- Metadata Exchange protocols (in addition to WSDL used to describe Web services) are supported to dynamically convey service metadata.
- Queued messaging — WCF delivers queued messaging functionality by using MSMQ as an underlying transport. Integration with an existing Message Queuing solution and the creation of a new asynchronous queue are both supported.
- Transactions — WS-Atomic Transaction and WS-Coordination protocols are supported through the managedSystem.Transactions namespace. This service allows two or more nodes, possibly interoperating using WS-*protocols, to participate in a distributed transaction.
- Content-based Routing — routing is enabled through support of the WS-Addressing protocol and custom WCF routers. Routing can be refined by filtering on content using the WCF filtering feature.
1 October 2012
Difference between WCF and Webservice in asp.net
Difference between WCF and Webservice in asp.net
-Webservices can be accessed only over HTTP and it works in stateless environment, WCF Service support HTTP, TCP, IPC, and even Message Queues for communication.
- WCF is flexible because because its services can be hosted in different types of application like [IIS,WAS,Self-hosting and Managed Windows service]
- Webservices use XmlSerializer, But WCF uses DataContractSerializer, and it is good performance compare with XmlSerializer.
- DataContractSerializer can translate the HashTable into XML
- In webservice Only Public fields or Properties of .NET types can be translated into XML
- ASP.NET web services are compiled into a class library assembly and a service file with an extension .asmx will have the code for the service.
-WCF Service can be hosted within IIS or WindowsActivationService.
-In ASP.NET Web services, unhandled exceptions are returned to the client as SOAP faults.
-In WCF Services, unhandled exceptions are not returned to clients as SOAP faults. To return SOAP faults to clients, you can throw instances of the generic type, FaultException, using the data contract type as the generic type.
-Web services provides only singlex communication,but WCF Supports shalf duplex and full duplex communication.
Half duplex
Half-duplex data transmission means that data can be transmitted in both directions on a signal carrier, but not at the same time.
half-duplex transmission implies a bidirectional line (one that can carry data in both directions).
They work in an stateless fashion over HTTP and are hosted inside a web server like IIS
Full duplex
Full-duplex data transmission means that data can be transmitted in both directions on a signal carrier at the same time.
Full-duplex transmission necessarily implies a bidirectional line (one that can move data in both directions).
WCF is a replacement for all earlier web service technologies from microsoft.
20 September 2012
What is Mobile app?
Mobile app
A mobile application (or mobile app) is a software application designed to run on smartphones, tablet computers and other mobile devices. They are available through application distribution platforms, which are typically operated by the owner of the mobile operating system, such as the Apple App Store, Google Play, Windows Phone Store and BlackBerry App World. Some apps are free, while others have a price. Usually, they are downloaded from the platform to a target device, such as an iPhone, BlackBerry, Android phone or Windows Phone, but sometimes they can be downloaded to less mobile computers, such as laptops or desktops.
Mobile apps were originally offered for general productivity and information retrieval, including email, calendar, contacts, and stock market and weather information. However, public demand and the availability of developer tools drove rapid expansion into other categories, such as mobile games, factory automation, GPS and location-based services, banking, order-tracking, and ticket purchases. The explosion in number and variety of apps made discovery a challenge, which in turn led to the creation of a wide range of review, recommendation, and curation sources, including blogs, magazines, and dedicated online app-discovery services.
Distribution as on 20-09-2012
Google Play
- application store for the Google Android operating system.With over 600,000 apps
BlackBerry App World
- Apps for the BlackBerry mobile devices . With over 99,500 apps
Nokia Store
- An app store for the Nokia phone. With over 1,20,000 apps
Windows Phone Marketplace
- Windows Phone Marketplace is a service by Microsoft for its Windows Phone 7 platform. with over 1,00,000 apps
Apple App Store
- The Apple App Store is a digital application distribution platform for iOS developed and maintained by Apple Inc. 7,25,700+ apps
14 September 2012
SyncLock and Lock in C#
SyncLock and Lock in C#
The lock (C#) and SyncLock (Visual Basic) statements can be used to ensure that a block of code runs to completion without interruption by other threads. This is accomplished by obtaining a mutual-exclusion lock for a given object for the duration of the code block.
A lock or SyncLock statement is given an object as an argument, and is followed by a code block that is to be executed by only one thread at a time. For example:
public class TestThreading { private System.Object lockThis = new System.Object(); public void Process() { lock (lockThis) { // Access thread-sensitive resources. } } }
Copy one table name to another table name in Sql Server
Copy one table name to another table name in Sql Server
INSERT INTO tablename1(column1,
SELECT column1,
INSERT INTO tablename1(column1,
column2
,
column3
)SELECT column1,
column2
,column3 from tablename2Stored procedure that create in last N Days in Sql Server
Stored procedure that create in last N Days in Sql Server
SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,create_date, GETDATE()) < 7
----Change 7 to any other day value.
SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,create_date, GETDATE()) < 7
----Change 7 to any other day value.
Stored Procedure that change in last N days in Sql Server
Stored Procedure that change in last N days in Sql Server
SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 7
----Change 7 to any other day value
SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 7
----Change 7 to any other day value
To know the stored procedure created date and modified date in Sql Server
To know the stored procedure created date and modified date in Sql Server
SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'P'
AND name = 'sp_name' -- stored procedure name
SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'P'
AND name = 'sp_name' -- stored procedure name
To show the stored procedure permission details in SQL Server
To show the stored procedure permission details in SQL Server:
select U. name, O. name, permission_name from sys . database_permissions
join sys . sysusers U on grantee_principal_id = uid
join sys . sysobjects O on major_id = id
where O. name like 'sp_name' -- stored procedure name
order by U. name
8 September 2012
Web application vs Webservice vs WCF in asp.net
Web application vs Webservice vs WCF in asp.net
Disadvantage of Web application
-------------------------------
In web application, its not possible to connect different technologies for eg[Java and Dotnet] and not possible to connect the application in two different servers.
Why Webservice?
-------------------
Webservice use SOAP (Simple Object Access protocol) and it is used to connect the web application using different type of technologies, and possible to connect the application that have hosted in different type of servers.
Disadvantage of Webservice
-----------------------------
Webservice use only HTTP Protocol.
It provides only singlex communication, not half duplex and full duplex communication.
They work in an stateless fasion over HTTP and are hosted inside a web server like IIS
Half duplex
-----------
Half-duplex data transmission means that data can be transmitted in both directions on a signal carrier, but not at the same time.
half-duplex transmission implies a bidirectional line (one that can carry data in both directions).
They work in an stateless fashion over HTTP and are hosted inside a web server like IIS
Full duplex
------------
Full-duplex data transmission means that data can be transmitted in both directions on a signal carrier at the same time.
Full-duplex transmission necessarily implies a bidirectional line (one that can move data in both directions).
Advantages of WCF Service
-----------------------------
WCF Service support HTTP, TCP, IPC, and even Message Queues for communication.
We can consume Web Services using server side scripts (ASP.NET), JavaScript Object Notations (JSON), and even REST (Representational State Transfer).
It can be configured to have singlex, request-response, or even full duplex communication.
These can be hosted in many ways inside IIS, inside a Windows service, or even self hosted.
Difference between Sleep and Hibernate in Laptops?
Difference between Sleep and Hibernate in Laptops?
-Sleep is a power-saving state that allows a computer to quickly resume full-power operation, Sleep puts your work and settings in memory and draws a small amount of power.
-Hibernation is also a power-saving state designed primarily for laptops. It puts your open documents
and programs on your hard disk and then turn off your computer.
Off all the power-saving states in Windows, hibernate uses the least amount of power.
If you won't use your laptop for an extended period and won't have an opportunity to charge the battery during that time - Hibernate is most efficient one.
21 August 2012
SQL SERVER – Query to Find Seed Values, Increment Values and Current Identity Column value of a table
SQL SERVER – Query to Find Seed Values, Increment
Values and Current Identity Column value of a table
SELECT IDENT_SEED(TABLE_NAME) AS Seed,
IDENT_INCR(TABLE_NAME) AS Increment,
IDENT_CURRENT(TABLE_NAME) AS Current_Identity,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'TableHasIdentity') = 1
AND TABLE_TYPE = 'BASE TABLE' and
TABLE_NAME='MSubject' -- [Table name]
For all the table in Database:
SELECT IDENT_SEED(TABLE_NAME) AS Seed,
IDENT_INCR(TABLE_NAME) AS Increment,
IDENT_CURRENT(TABLE_NAME) AS Current_Identity,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'TableHasIdentity') = 1
AND TABLE_TYPE = 'BASE TABLE'
7 August 2012
Lamda expression in C#
Lamda expression in C#
A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.
All lambda expressions use the lambda operator =>, which is read as "goes to".
The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x."
This expression can be assigned to a delegate type as follows:
To create an expression tree type:
A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.
All lambda expressions use the lambda operator =>, which is read as "goes to".
The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x."
This expression can be assigned to a delegate type as follows:
delegate int del(int i); static void Main(string[] args) { del myDelegate = x => x * x; int j = myDelegate(5); //j = 25 }
To create an expression tree type:
using System.Linq.Expressions; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Expression myET = x = > gt; x * x;
}
}
}
The =>; operator has the same precedence as assignment (=) and is right-associative.Lambdas are used in method-based LINQ queries as arguments to standard query operator methods such as Where.
6 August 2012
Anonymous Types in C#
Anonymous Types in C#
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to explicitly define a type first.
The following example shows an anonymous type that is initialized with two properties named Amount and Message.
var v = new { Amount = 108, Message = "Hello" }; // Rest the mouse pointer over v.Amount and v.Message in the following // statement to verify that their inferred types are int and string. Console.WriteLine(v.Amount + v.Message);
In the following example, the names of the properties of the anonymous type are Color and Price.
var productQuery = from prod in products select new { prod.Color, prod.Price }; foreach (var v in productQuery) { Console.WriteLine("Color={0}, Price={1}", v.Color, v.Price); }
11 July 2012
String vs string in c#
String vs string in C#
we use either the keyword string or String .
Is both String and string same in C# ?
string is just an alias name for the class System.String which means both has the same functionality.
The IL code generated for both of them is also same .
Note that string is a keyword , but String isn’t which lets you create an variable with the name String like
Another interesting thing is we can also declare variable name as String
String String = "Arun Prakash";
MessageBox.Show(String);
If you declare the variable name as string, Error occured
String string = " Arun Prakash";
MessageBox.Show(string);
Is both String and string same in C# ?
string is just an alias name for the class System.String which means both has the same functionality.
The IL code generated for both of them is also same .
Note that string is a keyword , but String isn’t which lets you create an variable with the name String like
Another interesting thing is we can also declare variable name as String
String String = "Arun Prakash";
MessageBox.Show(String);
If you declare the variable name as string, Error occured
String string = " Arun Prakash";
MessageBox.Show(string);
Use of Using Statement in C#
Use of Using Statement in C#
In C#, using Keyword is used in two different ways and are hence referred to differently.
As a Directive
In this usage, the "using" keyword can be used to include a namespace in your program. (Mostly used)
In this usage, the "using" keyword can be used to include a namespace in your program. (Mostly used)
As a Statement
Using can also be used in a block of code to dispose an IDisposable objects.
Using can also be used in a block of code to dispose an IDisposable objects.
SqlConnection connection = new SqlConnection("connection string");
SqlCommand cmd = new SqlCommand("SELECT * FROM SomeTable", connection);
SqlDataReader reader = cmd.ExecuteReader();
connection.Open();
if (reader != null)
{
while (reader.Read())
{
//do something
}
}
reader.Close(); // close the reader
connection.Close(); // close the connection
|
If any exception occurs inside while block it throws exception, the connection.close() process will not executed due to the exception. To avoid this situation, we can take the help of the try....catch... finally block by closing the connection inside the finally block or inside the catch block.
Advantages of the below code:
"Using" keyword takes the parameter of type IDisposable. Whenever you are using any IDisposable type
object you should use the "using" keyword to handle automatically when it should close or dispose.
Internally using keyword calls the Dispose() method to dispose the IDisposable object.
using (SqlConnection connection = new SqlConnection("connection string"))
{
connection.Open();
using (SqlCommand cmd = new SqlCommand("SELECT * FROM SomeTable", connection))
{
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader != null)
{
while (reader.Read())
{
//do something
}
}
} // reader closed and disposed up here
} // command disposed here
} //connection closed and disposed here
|
7 July 2012
Cloud Computing
Cloud Computing
Cloud computing is the delivery of computing and storage capacity [1] as a service [2] to a heterogeneous community of end-recipients. The name comes from the use of a cloud-shaped symbol[3] as an abstraction for the complex infrastructure it contains in system diagrams[4]. Cloud computing entrusts services with a user's data, software and computation over a network.
There are three types of cloud computing:[5]
- Infrastructure as a Service (IaaS),
- Platform as a Service (PaaS), and
- Software as a Service (SaaS).
Using Infrastructure as a Service, users rent use of servers (as many as needed during the rental period) provided by one or more cloud providers.
Using Platform as a Service, users rent use of servers and the system software to use in them.
Using Software as a Service, users also rent application software and databases. The cloud providers manage the infrastructure and platforms on which the applications run.
End users access cloud-based applications through a web browser or a light-weight desktop or mobile app while the business software and user's data are stored on servers at a remote location.
Proponents claim that cloud computing allows enterprises to get their applications up and running faster, with improved manageability and less maintenance, and enables IT to more rapidly adjust resources to meet fluctuating and unpredictable business demand.
Cloud computing relies on sharing of resources to achieve coherence and economies of scale similar to a utility (like theelectricity grid) over a network (typically the Internet). At the foundation of cloud computing is the broader concept of converged infrastructure and shared services.
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...