Thursday, October 28, 2004

Smart Client Architecture and Design Guide Released

MSDN has just released a new architecture and design guide for Smart Clients which provides information on several topics for those creating smart client applications. Issues addressed include data handling, connection state management, security, and threading.

The definition of "smart client" is dependent on requirements and implementation details but all share the following characteristics:
  • Make use of local resources
  • Make use of network resources
  • Support occasionally connected users
  • Provide intelligent installation and update
  • Provide client device flexibility

To understand more on Smart Clients this article by David Hill would be helpful.

Access the Design Guide here...

Wednesday, October 27, 2004

Free Components!!!

People at Compona have given some really good free components.

ExplorerBar - FREE
Layout Containers - FREE
Common Controls - FREE
Compona Editors - FREE
Compona Grid
Math Lib - FREE

Thanks to dredge for this piece of info.

Wednesday, October 20, 2004

Templates and Generics

Generics is a feature that has been added to .NET2.0. I have been recently attending lectures on Generics where I heard people saying it is a .NET version of C++ Templates. But these articles contrast on this. From the explanation given I am now in sync with the fact that Templaets and Generics have a very minimal overlapping in their functionality else are different from each other. Read the articles at Are Generics in .NET like Templates in C++?, Comparing .NET Generics and C++ Templates and Templates & Generics.

Enums and Performance

Enumerations provide a convenient way to work with sets of related constants and to associate constant values with names. It is a is a special form of value type, which inherits from System.Enum and supplies alternate names for the values of an underlying primitive type.

While doing some study on this area I came across this interesting post that speaks about Enums and its performance implications by Wesner Moise. Until I read the article I didn't have the least idea that an enum would have performance implications.

Saturday, October 16, 2004

Edit & Continue for C#!!!

At last Microsoft has decided to extend the Edit & Continue feature for C# also. Many C# developers including me have been looking for this option that is available in Whidbey for VB.NET and C++, but not for C#. Thanks to Micrososft for this decision.

For people who ask what is Edit & Continue, it is a debugger feature that allows you to pause an application being debugged, make changes to the code, and then continue without a full project recompile.

Read more on this and other VS .NET 2005 features here...

Wednesday, October 13, 2004

HTTP module to check for canonicalization issues with ASP.NET

Few days ago a Security vulnerability in ASP.NET was discovered. Canonicalization issue as it is known, is that an attacker could send specially crafted requests to a Web server running ASP.NET applications and bypass forms based authentication or Windows authorization configurations, and potentially view secured content without providing the proper credentials. Initial investigation has revealed that all versions of ASP.NET could be affected, independent of the installed IIS version or IIS components. Read more on this issue at What You Should Know About a Reported Vulnerability in Microsoft ASP.NET.

Microsoft has now released a HTTP module that implements Best Practices for Canonicalization to check the vulnerability. More details on the HTTP module here...

Directly download the MSI package here...

It is recommended that all ASP.NET users invariable of the platform or ASP.NET version, apply this Validation Path module.

Wednesday, October 06, 2004

Method Overloading in WebServices

Web services are also classes just like any other .NET classes. Nevertheless they have methods marked as WebMethods that can be exposed by the WebServices to be consumed by the outside world. Apart from these WebMethods they can also have normal methods like any other classes have.
Since a web service is a class it can utilize all the OO features like method overloading. However to use this feature on WebMethods we need to do something more that is explained in this article.

Creating WebMethods:

Let us create a simple WebService that has the following overloaded methods:

public string GetGreeting()
public string GetGreeting(string p_Name)
public string GetGreeting(string p_Name, string p_Message)

All these three methods return variants of a Greeting message to the WebClient. Let us now mark the methods as Web Methods. To acheive this apply the [WebMethod] attribute to the public methods.

public string GetGreeting()

return "Hi Guest";

public string GetGreeting(string p_Name)

return "Hi " + p_Name + "!";


public string GetGreeting(string p_Name, string p_Message)

return "Hi " + p_Name + "!" + p_Message;

This would compile fine. Run the WebService in the browser. That should give an error saying that the GetGreeting() mthods use the same message name 'GetGreeting' and asking to use the MessageName property of the WebMethod.

Adding the MessageName property:

Add the MessageName property to the WebMethod attribute as shown below:

public string GetGreeting()
return "Hi Guest";

[WebMethod (MessageName="WithOneString")]
public string GetGreeting(string p_Name)
return "Hi " + p_Name + "!";

[WebMethod (MessageName="WithTwoStrings")]
public string GetGreeting(string p_Name, string p_Message)
return "Hi " + p_Name + "!" + p_Message;

Now compile the WebService and run in the browser. You can see that the first method is displayed as GetGreeting wherein for the second and third method the alias we set using the MessageName property is displayed.

Friday, October 01, 2004

4 Essential C# Tips

1. Program to Interfaces Whenever Possible

The .NET Framework contains both classes and interfaces. When you write routines, you will find that you probably know which .NET class you're using. However, your code will be more robust and more reusable if you program using any supported interfaces instead of the class you happen to be working with at the time

2. Use Properties Instead of Raw Data

With the addition of properties as language elements, there is absolutely no reason to declare data elements with any access level greater than private. Because client code will view properties as data elements, you don't even lose the convenience of working with simple data elements in classes. In addition, using properties gives you more flexibility and more capabilities. Properties provide better encapsulation of your data elements. Properties let you make use of lazy evaluation to return data. Finally, properties can be virtual. They can even be abstract. You can also declare properties in interfaces.

3. Use Delegates for Producer/Consumer Idiom

When you create a class that implements the producer idiom, use a delegate to notify consumers. This will be a more flexible way to implement this idiom than interfaces. Delegates are multicast, so you can support multiple consumers without creating extra code. Also, you lower the coupling between classes by using the delegate model rather than a full interface model

4. Pay Attention to Initialization Order

The C# language adds the concept of initializers on member variable declarations. These initializers get executed before the body of the constructor gets executed. In fact, variable initializers get executed before the base class's constructor gets executed

Read the complete article here...

Microsoft announces new MVPs!!!

Microsoft has announced new MVPs and here is the list from India.
  1. Hari K. Prasad, Trivandrum
  2. Dhamayanthi N, Chennai
  3. Sanjay Vyas, Mumbai
  4. KS Naveen, Bangalore
  5. Sarang Datye, Pune
  6. Tarun Anand, Delhi

Hearty Congratulations to them...

Thanks to Vishal and Arun for the info.