Archive for the ‘C#’ Category
Enums dont implement IEnumerable
9 May, 200810 ASP.NET Performance and Scalability Secrets
5 February, 2008An article by Omar Al Zabir explains 10 easy ways to make ASP.NET and AJAX web sites faster, more scalable and support more traffic at lower cost. Omar Al Zabir is the CTO of Pageflakes one of the best mashups.
Main points he has discussed in this article
- ASP.NET pipeline optimisation
- ASP.NET process configuration optimisation
- Things you must do for ASP.NET before going live
- Content Delivery Network
- Caching AJAX calls on browser
- Making best use of Browser Cache
- On demand progressive UI loading for fast smooth experience
- Optimise ASP.NET 2.0 Profile provider
- How to query ASP.NET 2.0 Membership tables without bringing down the site
- Prevent Denial of Service (DOS) attack
Read the full article at code project 10 ASP.NET Performance and Scalability Secrets
System.Data.DataSetExtensions Config Error in Visual Studio 2008 RTM
3 December, 2007I got the exception shown below when I opened an application that was developed under VS 2008:
ASP.NET runtime error: Could not load file or assembly ‘System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ or one of its dependencies. The system cannot find the file specified
What’s happened is there is no more an assembly System.Data.DataSetExtensions with version number 2.0. There is a new version for the same assembly name under 3.5.0.0.
To resolve the problem, simply right-click on the web application, properties, then remove the reference to the 2.0.0.0 assembly.
Then, right-click on the web application solution, Add Reference, locate the System.Data.DataSetExtensions and add a reference to it. You may also need to update the entry web / app.config file under the <assemblies> tag. Update the version to 3.5.0.0
I’m in a podcast!
30 July, 2007Have a listen for yourself http://www.craigmurphy.com/blog/?p=610
It was a sound bite taken by Craig after the DeveloperDeveloperDeveloper event held at MS HQ in Reading.
Overloading routines in WebServices
19 January, 2007Web services are also classes just like any other .NET classes. Since a web service is a class it can utilise all the OO features like method overloading. However to use this feature with WebMethods we need toadd a little extra syntax.
Creating WebMethods
Create a 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. Now mark the methods as Web Methods, simply add the [WebMethod] attribute.
[WebMethod]
public string GetGreeting()
{
return “Hi Guest”;
}[WebMethod]
public string GetGreeting(string p_Name)
{
return “Hi ” + p_Name + “!”;
}[WebMethod]
public string GetGreeting(string p_Name, string p_Message)
{
return “Hi ” + p_Name + “!” + p_Message;
}
Run the WebService in the browser. That should give an error saying that the GetGreeting() methods use the same message name ‘GetGreeting’.
Adding the MessageName property.
Add the MessageName property to the WebMethod attribute as shown below:
[WebMethod]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 but for the second and third method the alias we set using the MessageName property is displayed.
You could of course use the alias’ as your method names – but that’d be taking the fun out of OO



