Category C#

Task based Asynchrony in C# 5.0

The Task and Task<TResult> types are already in the .NET Framework 4. A Task represents an ongoing activity, which may be CPU intensive work running on a separate thread, but may also represent an I/O operation, for example an outstanding…

Whats New in C# 5.0 Part-2

With the proposed new features, the asynchronous version of the code will instead look like this: public async Task<int> SumPageSizesAsync(IList<Uri> uris) { int total = 0; foreach (var uri in uris) { statusText.Text = string.Format(“Found {0} bytes …”, total); var…

Whats new in C# 5.0 Part-1

The Microsoft Visual Studio Async Community Technology Preview introducing a new language feature in C# and VB, and a new framework pattern to go with it, that will make asynchronous programming similar to synchronous programming. This blog describes the limitations…

PLINQ

What is a Parallel Query? Language-Integrated Query (LINQ) was introduced in the .NET Framework version 3.0 It features a unified model for querying any System.Collections.IEnumerable or System.Collections.Generic.IEnumerable data source in a type-safe manner. LINQ to Objects is the name for…

IIS 404 error when viewing ASPX pages

Root Cause By default, when IIS is installed on any version of the Windows Server 2003 family, IIS only serves static content (HTML). Resolution To permit IIS to serve dynamic content, the administrator must unlock this content in the Web…

Restriction Operator in LINQ

Restriction Operatorswhere is the restriction operator. It applies filter criteria on the sequence. The values of the sequence are filtered based on a supplied predicate. The where operator does not initiate the execution of the query. The query is executed…

WCF Security

Overview Services and service consumers are often on opposite sides of trust boundaries. A trust boundary is a physical or virtual boundary within which actual levels of trust can vary. A trust boundary can be an application process, a machine,…

Detect MITM attacks and Secure your clients

The following code demonstrates a dynamic URL generator written in C# for use in ASP.NET, implemented as a static class method, and its corresponding parser module that singles out MITM attackers by detecting multiple IP address mismatches originating from the…

Symmetric key Encryption and Decryption

I saw many of the applications with out basic level of security with respect to data transfer etc. Few people uses Base64 Encoding while sending data through URL which is a common practice. But a simple Javascript code can reverse…