<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>.NET Technical bits</title><description>This blog delivers the technical related bits and dynamics news for software developers. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.</description><managingEditor>noreply@blogger.com (Kumar S)</managingEditor><pubDate>Fri, 13 Sep 2024 10:26:54 +0530</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">34</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>http://technical-bits.blogspot.com/</link><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle>This blog delivers the technical related bits and dynamics news for software developers. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.</itunes:subtitle><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><title>Convert number to words using C#</title><link>http://technical-bits.blogspot.com/2012/06/convert-number-to-words-using-c.html</link><author>noreply@blogger.com (Kumar S)</author><pubDate>Fri, 15 Jun 2012 12:13:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-7631977334290352561</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Convert number to words using C#&lt;br /&gt;
&lt;br /&gt;
static string[] ones ={"", "one" , "two", "three", "four", "five", "six", "seven", "eight" , "nine", "ten" , &lt;br /&gt;
"eleven", "twelve" , "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static string[] tens ={"zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static string[] thou = { "", "thousand", "lakh"};&lt;br /&gt;
&lt;br /&gt;
public static string NumberToWords(int inputNum)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
int dig1, dig2, dig3, level = 0, lasttwo, threeDigits;&lt;br /&gt;
&lt;br /&gt;
string retval = "";&lt;br /&gt;
&lt;br /&gt;
string x = "";&lt;br /&gt;
&lt;br /&gt;
try&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
bool isNegative = false;&lt;br /&gt;
&lt;br /&gt;
if (inputNum &amp;lt; 0)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
isNegative = true;&lt;br /&gt;
&lt;br /&gt;
inputNum *= -1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if (inputNum == 0)&lt;br /&gt;
&lt;br /&gt;
return ("ZERO");&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
string s = inputNum.ToString();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
while (s.Length &amp;gt; 0)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
// Get the three rightmost characters&lt;br /&gt;
&lt;br /&gt;
x = (s.Length &amp;lt; 3) ? s : s.Substring(s.Length - 3, 3);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Separate the three digits&lt;br /&gt;
&lt;br /&gt;
threeDigits = int.Parse(x);&lt;br /&gt;
&lt;br /&gt;
lasttwo = threeDigits % 100;&lt;br /&gt;
&lt;br /&gt;
dig1 = threeDigits / 100;&lt;br /&gt;
&lt;br /&gt;
dig2 = lasttwo / 10;&lt;br /&gt;
&lt;br /&gt;
dig3 = (threeDigits % 10);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// append a "thousand" where appropriate&lt;br /&gt;
&lt;br /&gt;
if (level &amp;gt; 0 &amp;amp;&amp;amp; dig1 + dig2 + dig3 &amp;gt; 0)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
retval = thou[level] + " " + retval;&lt;br /&gt;
&lt;br /&gt;
retval = retval.Trim();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// check that the last two digits is not a zero&lt;br /&gt;
&lt;br /&gt;
if (lasttwo &amp;gt; 0)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
if (lasttwo &amp;lt; 20) // if less than 20, use "ones" only&lt;br /&gt;
&lt;br /&gt;
retval = ones[lasttwo] + " " + retval;&lt;br /&gt;
&lt;br /&gt;
else // otherwise, use both "tens" and "ones" array&lt;br /&gt;
&lt;br /&gt;
retval = tens[dig2] + " " + ones[dig3] + " " + retval;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Lakhs&lt;br /&gt;
&lt;br /&gt;
if (level &amp;gt; 0 &amp;amp;&amp;amp; dig1 &amp;gt; 0)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
if (dig1 &amp;gt; 1)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
retval = ones[dig1] + " lakhs " + retval;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
retval = ones[dig1] + " lakh " + retval;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}// if a hundreds part is there, translate it&lt;br /&gt;
&lt;br /&gt;
else if (dig1 &amp;gt; 0)&lt;br /&gt;
&lt;br /&gt;
retval = ones[dig1] + " hundred " + retval;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
s = (s.Length - 3) &amp;gt; 0 ? s.Substring(0, s.Length - 3) : "";&lt;br /&gt;
&lt;br /&gt;
level++;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
while (retval.IndexOf(" ") &amp;gt; 0)&lt;br /&gt;
&lt;br /&gt;
retval = retval.Replace(" ", " ");&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
retval = retval.Trim();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if (isNegative)&lt;br /&gt;
&lt;br /&gt;
retval = "negative " + retval;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
catch (Exception)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return (retval);&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Difference between WCF and ASP.NET Web Services</title><link>http://technical-bits.blogspot.com/2011/05/difference-between-wcf-and-aspnet-web.html</link><author>noreply@blogger.com (Kumar S)</author><pubDate>Wed, 11 May 2011 17:54:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-2361600675639683584</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;strong&gt;Data translation:&lt;/strong&gt;&lt;br /&gt;
ASP.NET web service depends on defining data and relies on the XmlSerializer to transform data to or from a service.&lt;br /&gt;
&lt;br /&gt;
There are few issues with XmlSerializer to XML from serialize .NET types.&lt;br /&gt;
&lt;br /&gt;
• The translated XML will have only the public fields or properties of .NET types&lt;br /&gt;
&lt;br /&gt;
• The implemented class from IDictionary (ex: hash table) cannot be translated&lt;br /&gt;
&lt;br /&gt;
• This will have the classes which implement IEnumerable interface&lt;br /&gt;
&lt;br /&gt;
The WCF uses the attributes DataContract attribute and DataMemeber attribute to translate .NET types in to XML.&lt;br /&gt;
&lt;br /&gt;
[DataContract]&lt;br /&gt;
public class Member&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int memberID;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public string memberName;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public decimal salary;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The DataContractAttribute can be used for class or a struct. DataMemberAttribute can be used for private/public field or property.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;DataContractSerializer and XMLSerializer:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
• Performance wise DataContractSerializer better than XMLserialization&lt;br /&gt;
&lt;br /&gt;
• DataContratSerializer Explicitly shows the which fields or properties are serialized into XML but XMLSerializer is not&lt;br /&gt;
&lt;br /&gt;
• Hash Table can be translated in DataContractSerializer&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Creating WCF and Web Services:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
When we create a web service the WebService attribute need to be added to the web service class and WebMethod Attribute need to be added for any web service class methods.&lt;br /&gt;
For Example:&lt;br /&gt;
&lt;br /&gt;
[WebService]&lt;br /&gt;
public class MyService : System.Web.Services.WebService&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [WebMethod]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string InvokeMe(string message)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return message;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
To create a WCF service we will write this code:&lt;br /&gt;
[ServiceContract]&lt;br /&gt;
public interface IMyService&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string InvokeMe(string message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class MyService : IMyService&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string InvokeMe (string message)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return message;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The interface defines a WCF service contract using the ServiceContract attribute and the OperationContract tells which of the methods of the interface defines the operations of the service contract. The service type in WCF will be referred to as a class that implements the service.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Hosting the Services:&lt;/strong&gt;&lt;br /&gt;
ASP.NET web services are created and compiled and will be hosted in IIS. This hosted will have the service file with extension .asmx and will have assembly with the compiled class. The hosted .asmx url can be added as a web reference to a .NET project so that the class and methods from service will be accessible in the project.&lt;br /&gt;
WCF Service can be hosted within IIS or WindowsActivationService using the steps below.&lt;br /&gt;
&lt;br /&gt;
• Compile the service type into a class library.&lt;br /&gt;
&lt;br /&gt;
• Copy the service file with an extension .SVC into a virtual directory and assembly into bin sub directory of the virtual directory.&lt;br /&gt;
&lt;br /&gt;
• Copy the web.config file into the virtual directory.&lt;br /&gt;
&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Asp.NET Chart - How to specify Data</title><link>http://technical-bits.blogspot.com/2011/04/how-to-specify-aspnet-chart-data.html</link><category>Asp.NET Chart</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Tue, 26 Apr 2011 12:33:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-141232322860824401</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;The chart area(s), series, and data points can be specified declaratively (either by entering the declarative mark-up by hand or via the Properties window) or programmatically in the code-behind class. Typically the series and chart area(s) are specified declaratively and the data points are populated programmatically by querying a database or some other dynamic data store. Let's start by discussing how to display a chart whose chart area, series, and data points are all specified declaratively.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Chart ID="chtNBAChampionships" runat="server"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;Series&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Series Name="Championships" YValueType="Int32" ChartType="Column" ChartArea="MainChartArea"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;Points&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:DataPoint AxisLabel="Celtics" YValues="17" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:DataPoint AxisLabel="Lakers" YValues="15" /&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:DataPoint AxisLabel="Bulls" YValues="6" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:DataPoint AxisLabel="Spurs" YValues="4" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:DataPoint AxisLabel="76ers" YValues="3" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:DataPoint AxisLabel="Pistons" YValues="3" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:DataPoint AxisLabel="Warriors" YValues="3" /&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/Points&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:Series&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/Series&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;ChartAreas&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:ChartArea Name="MainChartArea"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:ChartArea&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/ChartAreas&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:Chart&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Note that the Chart control has a &amp;lt;Series&amp;gt; section and a &amp;lt;ChartAreas&amp;gt; section, which define the series and the chart areas, respectively. The &amp;lt;ChartAreas&amp;gt; section in the above mark-up defines a single ChartArea named MainChartArea. The &amp;lt;Series&amp;gt; section defines a single Series named Championships. This Championship series is configured to render as a column and is displayed in the MainChartArea. Next, its data points are defined via the &amp;lt;Points&amp;gt; collection. There are seven data points, each data point displaying the NBA team name via the AxisLabel property and the number of championships in the YValues property.&lt;br /&gt;
&lt;br /&gt;
After defining this mark-up, visit this page through a browser. You should see a chart in your browser similar to the screen shot below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSK4elQG1bpqy_QJc7UCBV_wJlyDDLR0Ew3Wkvo3qm0bcedFqhZ_Ze-7_NyZob-8DmTyCX70LVslXl-J1MGis3pT2b-eh6mkZshi_SLEJmQpJGb-V1InDDVRKWiF7zLi036sZKa8E0hGtZ/s1600/untitled.GIF" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i8="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSK4elQG1bpqy_QJc7UCBV_wJlyDDLR0Ew3Wkvo3qm0bcedFqhZ_Ze-7_NyZob-8DmTyCX70LVslXl-J1MGis3pT2b-eh6mkZshi_SLEJmQpJGb-V1InDDVRKWiF7zLi036sZKa8E0hGtZ/s1600/untitled.GIF" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSK4elQG1bpqy_QJc7UCBV_wJlyDDLR0Ew3Wkvo3qm0bcedFqhZ_Ze-7_NyZob-8DmTyCX70LVslXl-J1MGis3pT2b-eh6mkZshi_SLEJmQpJGb-V1InDDVRKWiF7zLi036sZKa8E0hGtZ/s72-c/untitled.GIF" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How to add a Microsoft Chart control to an ASP.NET Page</title><link>http://technical-bits.blogspot.com/2011/04/how-to-add-microsoft-chart-control-to.html</link><category>Microsoft Chart control</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Tue, 26 Apr 2011 12:14:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-4614032240992464415</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;To add charts to a web page simply drag the Chart control from the Toolbox onto the page. Doing so adds the Chart control's declarative mark-up to the page:&lt;/div&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Chart ID="Chart1" runat="server"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;Series&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Series Name="Series1" IsVisibleInLegend="False"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;EmptyPointStyle IsVisibleInLegend="False" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:Series&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/Series&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;ChartAreas&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:ChartArea Name="ChartArea1"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:ChartArea&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/ChartAreas&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:Chart&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Note that the Chart control is identified in the declarative mark-up via the tag prefix and name &lt;chart&gt;. This prefix (asp) is mapped to the Chart Controls assembly in Web.config:&lt;/chart&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;controls&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/controls&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;span style="color: #f6b26b;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;Additionally, an HTTP Handler named ChartHttpHandler is mapped to requests to chartImg.axd. As we'll see in a bit, when visited through a browser the Chart control renders an &amp;lt;img&amp;gt; element with a src attribute of ChartImg.axd. As a result, the browser makes a request to this file (ChartImg.axd) to display the chart image. This request is routed to the ChartHttpHandler HTTP Handler which generates the image contents and returns that binary data to the browser for display. This mapping between the ChartImg.axd path and the ChartHttpHandler HTTP Handler is implemented via the following Web.config mark-up:&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;handlers&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;remove name="ChartImageHandler" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;/div&gt;&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color: #e69138;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/handlers&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Both of the above configuration additions are automatically added to Web.config when you add a Chart control to a web page for the first time in your project.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How to implement Partial-Page Rendering</title><link>http://technical-bits.blogspot.com/2011/04/how-to-implement-partial-page-rendering.html</link><category>Partial-Page Rendering</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Tue, 12 Apr 2011 16:50:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-7769208635367806625</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;With partial-page rendering, you can refresh individual regions of the page asynchronously and make the page more responsive to the user. You can implement partial-page rendering using ASP.NET AJAX Web server controls, and optionally write client script that uses the APIs in the Microsoft Ajax Library.&lt;br /&gt;
To add AJAX functionality to ASP.NET Web pages, you identify individual sections of the page that you want to update. You then put the content of these sections into UpdatePanel controls. The contents of an UpdatePanel control can be HTML or other ASP.NET controls. You can add an UpdatePanel control to the page as you would any other control. For example, in Visual Studio you can drag it from the toolbox to the Web page, or you can add it by using declarative mark-up in the page. The following example shows the mark-up for an UpdatePanel control.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;ContentTemplate&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;!-- Place updatable markup and controls here. --&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/ContentTemplate&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:UpdatePanel&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
By default, postbacks that originate from controls inside the update panel (child controls) automatically initiate asynchronous postbacks and cause a partial-page update. You can also specify that controls outside the update panel cause an asynchronous postback and that they refresh the UpdatePanel control's content. A control that causes an asynchronous postback is referred to as a trigger.&lt;br /&gt;
Here is a sample with UpdatePanel which refreshes a particular region of a web page. This sample refreshes a grid data and a label for every 5 seconds.&lt;br /&gt;
Here we have created an ASPX page with Site. master as the Master page and this page does have a developer express data grid and a label box.&lt;br /&gt;
&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="5000"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:Timer&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;Triggers&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/Triggers&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;ContentTemplate&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;dx:ASPxDataView ID="ASPxDataViewSystemInfo" runat="server" &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;ClientIDMode="AutoID"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;ItemTemplate&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;b&amp;gt;ID&amp;lt;/b&amp;gt;:&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Label ID="IDLabel" runat="server" Text='&amp;lt;%# Eval("ID") %&amp;gt;' /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;b&amp;gt;Name&amp;lt;/b&amp;gt;:&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;asp:Label ID="PageRankLabel" runat="server" Text='&amp;lt;%# Eval("Name") %&amp;gt;' /&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/ItemTemplate&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/dx:ASPxDataView&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;dx:ASPxLabel ID="ASPxLabelCurrentTime" runat="server" Text="ASPxLabel"&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/dx:ASPxLabel&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/ContentTemplate&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:UpdatePanel&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;/asp:Content&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
There is a function in the code behind file to bind data for the grid&lt;br /&gt;
&lt;em class="code"&gt;&lt;/em&gt;&lt;br /&gt;
&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;public void BindData() &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;{&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;SqlConnection con = new SqlConnection("Data Source=10.1.14.15;Initial Catalog=iDynamics;Persist Security Info=True;User ID=developers;Password=dev");&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;SqlCommand cmd = new SqlCommand();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;cmd.CommandText = "select * from Staff ";&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;cmd.Connection = con;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;con.Open();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;IDataAdapter da = new SqlDataAdapter(cmd);&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;DataSet ds = new DataSet();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;da.Fill(ds);&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;cmd.ExecuteNonQuery();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;ASPxDataViewSystemInfo.DataSource = ds;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;ASPxDataViewSystemInfo.DataBind();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;}&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
The refresh code needs to be executed inside the timer tick event.&lt;br /&gt;
&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;protected void Timer1_Tick(object sender, EventArgs e) &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;{&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;ASPxLabelCurrentTime.Text = "Grid Refreshed at: " + DateTime.Now.ToLongTimeString();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;BindData();&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;}&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
The above example will be displayed the staff details in grid and the refreshed time in the label box. The grid and label box information will be refreshed by every 5 minutes. We cannot see any flickering while refreshing the values on grid and labelbox.&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>ASP.NET Whole Page Rendering</title><link>http://technical-bits.blogspot.com/2011/04/aspnet-whole-page-rendering.html</link><category>Page Rendering</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Tue, 12 Apr 2011 16:11:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-6829438056232678505</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;How do we refresh an ASP.NET web page to auto refresh on a set interval. Obviously, there are several methods, including Java Script. &lt;br /&gt;
&lt;br /&gt;
To simply refresh the web page every five minutes, you can place the "meta http-equiv...." line shown below in the HTML editor of your ASPX page. Content ="300" means refresh every 300 seconds or five minutes.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style="color: #e69138;"&gt;&amp;lt;HEAD&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;WebForm1&amp;lt;title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;meta content="C#" name="CODE_LANGUAGE"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--The next line of code will refresh the page every 5 minutes--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;meta http-equiv="refresh" content="300"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;meta content="JavaScript" name="vs_defaultClientScript"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;meta content="http://schemas.microsoft.com/intellisense/ie5" &lt;br /&gt;
&lt;br /&gt;
name="vs_targetSchema"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/HEAD&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
That's all there is to it, if there is only a data grid on the page! However, be aware that this refresh acts like an initial page load, and any other controls, such as Drop Down Lists, etc., which have been set to other than default values will be lost unless you do some additional coding to restore their content at the time the refresh fires. &lt;br /&gt;
&lt;br /&gt;
The above code will load the entire ASP page. Here it is not possible to load/refresh a particular region or control (example: data grid). Here is the need of partial rendering comes.&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></item><item><title>Advantages of LINQ over Stored Procedures</title><link>http://technical-bits.blogspot.com/2011/04/advantages-and-disadvantages-of-linq.html</link><category>Advantages of LINQ</category><category>Stored Procedures</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Fri, 8 Apr 2011 11:02:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-1007024397128021875</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;1. It stands for Language Integrated Query. LINQ is collection of standard query operators that provides the query facilities into .NET framework language like C#.&lt;br /&gt;
2. &lt;b&gt;Debugging&lt;/b&gt;: It is really very hard to debug the stored procedure but as LINQ is part of .NET, you can use visual studio's debugger to debug the queries.&lt;br /&gt;
3. &lt;b&gt;Deployment&lt;/b&gt;: With stored procedures, we need to provide an additional script for stored procedures but with LINQ everything gets complied into single DLL hence deployment becomes easy.&lt;br /&gt;
4. &lt;b&gt;Type Safety&lt;/b&gt;: LINQ is type safe, so queries errors are type checked at compile time. It is really good to encounter an error when compiling rather than runtime exception!&lt;br /&gt;
5. &lt;b&gt;Abstraction&lt;/b&gt;: This is especially true with LINQ-to-Entities. This abstraction also allows the framework to add additional improvements that you can easily take advantage of. PLINQ is an example of adding multi-threading support to LINQ. Code changes are minimal to add this support. It would be MUCH harder to do this data access code that simply calls stored procedures.&lt;br /&gt;
6. &lt;b&gt;Debugging support&lt;/b&gt;: I can use any .NET debugger to debug the queries. With stored procedures, you cannot easily debug the SQL and that experience is largely tied to your database vendor (MS SQL Server provides a query analyzer, but often that isn't enough).&lt;br /&gt;
7. &lt;b&gt;Vendor agnostic&lt;/b&gt;: LINQ works with lots of databases and the number of supported databases will only increase. Stored procedures are not always portable between databases, either because of varying syntax or feature support (if the database supports stored procedures at all).&lt;br /&gt;
8. &lt;b&gt;Easier&lt;/b&gt;: You don't have to learn T-SQL to do data access, nor do you have to learn the data access API (e.g. ADO.NET) necessary for calling the stored procedures.&lt;br /&gt;
9.&lt;strong&gt; Not just tables in a relational database&lt;/strong&gt;: LINQ's benefits include, most significantly, a standardized way to query not just tables in a relational database but also text files, XML files, and other data sources using identical syntax. A second benefit is the ability to use this standardized method from any .NET-compliant language such as C#, VB.NET, and others.&lt;br /&gt;
10. &lt;strong&gt;Collections like arrays&lt;/strong&gt;: It allows you to query collections like arrays, enumerable classes etc in the native language of your application, and like VB or C# in much the same way as you would query a database using SQL. LINQ to SQL, which is what most of the current fuss is about, is an Object/Relational Mapper (O/RM) built in to Visual Studio.&lt;br /&gt;
11. &lt;strong&gt;Entity classes&lt;/strong&gt;: It automatically generates entity classes based on the database schema, so it helps speed up development of n-layer architecture applications.&lt;br /&gt;
12. &lt;b&gt;Faster to Develop&lt;/b&gt;: LINQ to SQL is not necessarily going to speed up data access code. Since LINQ to SQL is abstraction over the low level ADO.NET command and connection classes, it's bound to be a bit slower at runtime (but hopefully faster to develop with).&lt;br /&gt;
13. &lt;b&gt;Amount of Code&lt;/b&gt;: It seems to me that the main advantage of Linq over writing a stored procedure in management studio is the hard typing of tables and parameters and auto completion of column names. The amount of code to connect to the database is significantly reduced - to one or two lines making code much more readable and removing coding errors.&lt;br /&gt;
14. &lt;b&gt;Code is much more robust&lt;/b&gt;: You get auto complete on the (column / field names) and an error if you mistype or mismatch - your code is much more robust.&lt;br /&gt;
15. &lt;b&gt;Filtering and Grouping &lt;/b&gt;: Say you access your code via a stored procedure (to apply filtering, grouping, join etc) and you (or someone edits) your stored procedure, to add a (returned) column which happens to be the 3rd column of 7: then that will break your code which refers to ordinal position. Actually if you got to the spec for SQL, you will find that ordinal position on a table may not be maintained, where as column name is guaranteed.&lt;br /&gt;
16. &lt;b&gt;No ordinal position problem&lt;/b&gt;: Now that the ordinal position problem in the VB implementation is fixed you can happily manipulate to your heart’s content.&lt;br /&gt;
17. &lt;b&gt;Easier to transform data into objects&lt;/b&gt;: Makes it easier to transform data into objects. I'm sure you've heard the term "Impedence Mismatch" being used quite often, meaning that LINQ reduces the amount of work you must do to translate between object-oriented code and data paradigms such as hierarchical, flat-file, messages, relational, and more. It doesn't eliminate the "Impedence Mismatch" because you must still reason about your data in its native form, but the bridge from here to there is (IMO) much shorter.&lt;br /&gt;
18. &lt;b&gt;Common syntax&lt;/b&gt;: A common syntax for all data. Once you learn query syntax, you can use it with any LINQ provider. I think this is a much better development paradigm than the Tower of Babel that has grown over the years with data access technologies. Of course, each LINQ provider has unique nuances that are necessary, but the basic approach and query syntax is the same.&lt;br /&gt;
19. &lt;b&gt;Strongly typed code&lt;/b&gt;: The C# (or VB.NET) query syntax is part of the language and you code with C# types, which are translated into something a provider understands. This means that you gain the productivity of having your compiler find errors earlier in the development lifecycle than elsewhere. Granted, many errors in stored proc syntax will generate errors when you save, but LINQ is more general than SQL Server. You have to think of all the other types of data sources that generate runtime errors because their queries are formed with strings or some other loosely typed mechanism.&lt;br /&gt;
20. &lt;b&gt;Provider integration&lt;/b&gt;: Pulling together data sources is very easy. For example, you can use LINQ to Objects, LINQ to SQL, and LINQ to XML together for some very sophisticated scenarios. I think it's very elegant.&lt;br /&gt;
21. &lt;b&gt;Reduction in work&lt;/b&gt;: Before LINQ, I spent a lot of time building DALs, but now my DataContext is the DAL. I've used OPFs too, but now I have LINQ that ships with multiple providers in the box and many other 3rd party providers, giving me the benefits from my previous points. I can set up a LINQ to SQL DataContext in a minute (as fast as my computer and IDE can keep up).&lt;br /&gt;
22. &lt;b&gt;Performance in the general case doesn't become an issue&lt;/b&gt;: SQL Server optimizes queries quite well these days, just like stored procedures. Of course, there are still cases where stored procedures are necessary for performance reasons. For example, I've found it smarter to use a stored proc when I had multiple interactions between tables with additional logic inside of a transaction. The communications overhead of trying to do the same task in code, in addition to getting the DTC involved in a distributed transaction made the choice for a stored proc more compelling. However, for a query that executes in a single statement, LINQ is my preferred choice because even if there was a small performance gain from a stored proc, the benefits in previous points (IMO) carry more weight.&lt;br /&gt;
23. &lt;b&gt;Built-in security&lt;/b&gt;: One reason I preferred stored procedures before LINQ was that they forced the use of parameters, helping to reduce SQL injection attacks. LINQ to SQL already parameterizes input, which is just as secure.&lt;br /&gt;
24. &lt;b&gt;LINQ is declarative&lt;/b&gt;: A lot of attention is paid to working with LINQ to XML or LINQ to SQL, but LINQ to Objects is incredibly powerful. A typical example of LINQ to Objects is reading items from a string[]. However, that's just a small example. If you think about all of the IEnumerable&lt;t&gt; collections (you can also query IEnumerable) that you work with every day, the opportunities are plentiful. i.e. Searching an ASP.NET ListBox control for selected items, performing set operations (such as Union) on two collections, or iterating through a List&lt;t&gt; and running a lambda in a ForEach of each item. Once you begin to think in LINQ, which is declarative in nature, you can find many of your tasks to be simpler and more intuitive than the imperative techniques you use today.&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>New concepts in ASP.NET 4.0, Visual Studio 2010 IDE</title><link>http://technical-bits.blogspot.com/2010/12/new-concepts-in-aspnet-40-visual-studio.html</link><category>ASP.NET 4.0</category><category>Visual Studio 2010 IDE</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Thu, 30 Dec 2010 11:23:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-2358947370801294852</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;1. &lt;strong&gt;Code snippets&lt;/strong&gt;: - Code snippets are pre-developed code templates which can save time spent on thinking about the syntax. There are already a lot of built-in code snippets in VS2005 and VS2008. However, those are only available for the code-behind. Code snippets in VS2010 are introduced for JScript, HTML, and ASP.NET markup as well. &lt;br /&gt;
2. &lt;strong&gt;New Profiles&lt;/strong&gt;: - We have seen different development profiles in previous versions of .NET. Like VB, C#, Web Development, and General Development. We select a profile based on our priorities. These are selected after the first installation of Visual Studio or from the Import Export option.&lt;br /&gt;
In VS2010, two more profiles are introduced and both support HTML developers. Those are:&lt;br /&gt;
1. Web Development &lt;br /&gt;
2. Web Development (Code Optimized)&lt;br /&gt;
3. &lt;strong&gt;Generate From Usage&lt;/strong&gt;: - In previous versions of ASP.NET, Microsoft introduced code refactoring to generate methods and identifiers from existing code. In ASP.NET 4.0, there is a new concept of Generate From Usage - generates properties, methods, classes, and other types based on existing code.&lt;br /&gt;
4. &lt;strong&gt;Multi Targeting&lt;/strong&gt;: - In VS2008, it is possible to create a project in version 2.0 or 3.0, rather than developing in default 3.5. Also, there is an option to change a developed project's target framework version.&lt;br /&gt;
The same option is available in VS2010, but with one improvement. In the previous versions, if you create a project in framework 2.0, intellisense will still show you the types and members of 3.5 version as well, so there are more chances of error if you cannot identify the member of the chosen framework. But in VS2010, the intellisense will show you options for the appropriate framework only.&lt;br /&gt;
5. &lt;strong&gt;Multi-Monitor&lt;/strong&gt;: - Visual Studio 2010 provides us facility to move windows of the IDE outside of the Visual Studio IDE and place them on the desktop area. It also supports having different IDE windows on multiple monitors. If we close Visual Studio and open it again, we will find all the windows on the same places where we finished them last time. &lt;br /&gt;
6. &lt;strong&gt;Code Navigation in Class Files&lt;/strong&gt;: - A new Navigate To option gives us facility to search a term in a file more quickly. It searches the text as you type, but it works for class files only, i.e., it doesn't work for HTML or code-behind files. In the following example, it shows the function name as I type it in the Navigate To window; on selection of any, it will navigate to the function definition.&lt;br /&gt;
&lt;br /&gt;
7. &lt;strong&gt;View Call Hierarchy&lt;/strong&gt;: -This featrure helps to see the use of a function and its properties. For example, if you right click on a function name, it will show you the hierarchical list of function usage.&lt;br /&gt;
8. &lt;strong&gt;Code Identifier Highlighting&lt;/strong&gt;: - On selection of an identifier, the IDE will highlight the places for you where it is utilized. For example, I selected variable i and it highlights the different places it is used.&lt;br /&gt;
9. &lt;strong&gt;Intellisense Improvements&lt;/strong&gt;: - In VS2008, on selecting properties for an object, intellisense will show you the properties based on the alphabetical order as you type.&lt;br /&gt;
In VS2010, it shows you the properties based on groups. For example, if you type text for a text box, it will show you the members based on the word text, like Text, TextChanged, TextMode. It also supports Pascal case intellisense. For example, if you type TC, it will navigate to the TextChanged member.&lt;br /&gt;
10. &lt;strong&gt;EnablePersistedSelection&lt;/strong&gt;: -On selecting a row in controls like DataList or GridView, if we move to another page index, it selects the same numbered row on the newly selected page, although we selected it only on the first page.&lt;br /&gt;
To avoid this, ASP.NET 4.0 has introduced a new property for these controls, called EnablePersistedSelection. If you set it to true, it will not select the same numbered row on other pages, and on navigation to the original page, for example, the first page, it will show the initially selected row as selected.&lt;br /&gt;
11. &lt;strong&gt;Web.Config Transformation&lt;/strong&gt;: - Normally, we set some values in web.config for the development environment, and then we change those values manually at the time of deployment or testing.&lt;br /&gt;
For example, if we have a connection string or any key value combination in the web.config file, and we want to replace those at the time of project publishing or deployment, then we can use the new web.config transformation. It is an automatic way to perform this operation.&lt;br /&gt;
Web.config settings can be overridden by other config files like web.release.config, web.debug.config etc., at the time of debug, release. These values are not overridden in the original web.config but in the published web.config.&lt;br /&gt;
With the help of transformation, we can replace, remove, or delete a node, and for a node itself, we can remove or set attributes.&lt;br /&gt;
12. &lt;strong&gt;URL Routing&lt;/strong&gt;: - Nowadays, we see that website URLs are more SEO specific and do not show any descriptive information. For example, rather than showing a URL like: http://mywebsite.com/userprofiles.aspx?userid=1, developers would prefer to show the URL as: http://mywebsite.com/mydetails.&lt;br /&gt;
URL mapping in ASP.NET 2.0 provides us an option to achieve this functionality up to some extent. We can mention exact URLs to navigate and URLs to show to the user. But in the case of postback, this option starts showing the actual URL in the browser.&lt;br /&gt;
URL routing was introduced in ASP.NET 3.5. Developers had to create different route handler classes depending on the number of URL routings for a website. The postback issue was solved with this URL routing option.&lt;br /&gt;
In ASP.NET 4.0, you do not need to define separate handler classes for each routing. There is a built-in helper function MapPageRoute which helps you to implement routing more quickly. These routes are registered on Application_Start. For example, in this example, in global.asax, the SetRouting method sets routing, the first parameter is the router's friendly name, the second parameter is to check for the URL pattern to match, and the third is the ASPX page where this functionality would be implemented for the users.&lt;br /&gt;
13.&lt;strong&gt; Add Reference Dialog&lt;/strong&gt;: - In previous versions of Visual Studio, on opening the Add Reference dialog box, it will take some time to load .NET assembly files initially till the time it loads all the references from the GAC. In VS2010, on opening Add Reference, it opens the Projects tab by default.&lt;br /&gt;
If you click on the .NET or COM tab by mistake, you still have an option of canceling it before it loads all the assemblies. So, the VS IDE does not freeze like before.&lt;br /&gt;
14.&lt;strong&gt; Compressing Session Values&lt;/strong&gt;: - ASP.NET session out-of-process state values are saved in a database or on the server. These are saved in a serialized format. Bigger session values consume more resources to be sent to the server. Now, those can be compressed with a new built-in property compressionEnabled. This attribute for the sessionState element can be mentioned in the web.config.&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Scope of WCF Security and WCF Bindings and Behaviors</title><link>http://technical-bits.blogspot.com/2010/12/scope-of-wcf-security-and-wcf-bindings.html</link><author>noreply@blogger.com (Kumar S)</author><pubDate>Thu, 30 Dec 2010 10:37:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-1288158460278825889</guid><description>When you create an overall security policy – for example, transfer security with authentication and authorization for your services – you can use bindings and behaviors to configure the required settings. &lt;br /&gt;
Bindings and behaviors are described as follows: &lt;br /&gt;
• &lt;strong&gt;Bindings.&lt;/strong&gt; Bindings control the security mode, client credential type, and other security settings. &lt;br /&gt;
• &lt;strong&gt;Behaviors&lt;/strong&gt;. Service behaviors control impersonation levels, how client credentials are authenticated and authorized, and service credentials. &lt;br /&gt;
You can configure bindings and behaviors, or you can program against the object model. Your binding selection determines the available security options for WCF. The following table summarizes the most commonly used bindings in WCF.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Difference Between .net 2.0,3.0,3.5</title><link>http://technical-bits.blogspot.com/2010/11/difference-between-net-203035.html</link><category>.net 2.0</category><category>3.0</category><category>3.5</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Tue, 30 Nov 2010 13:24:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-3898427145496935212</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;strong&gt;.NET Framework 2.0&lt;/strong&gt;&lt;br /&gt;
Released with Visual Studio 2005 , Microsoft SQL Server 2005, and BizTalk 2006.&lt;br /&gt;
The 2.0 Redistributable Package can be downloaded for free from Microsoft, and was published on 2006-01-22.&lt;br /&gt;
The 2.0 Software Development Kit (SDK) can be downloaded for free from Microsoft.&lt;br /&gt;
It is included as part of Visual Studio 2005 and Microsoft SQL Server 2005.&lt;br /&gt;
Version 2.0 is the last version with support for Windows 2000, Windows 98 and Windows Me.&lt;br /&gt;
It shipped with Windows Server 2003 R2 (not installed by default).&lt;br /&gt;
Changes in 2.0 on comparison with 1.1&lt;br /&gt;
Numerous API changes.&lt;br /&gt;
A new hosting API for native applications wishing to host an instance of the .NET runtime. The new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and more (detailed reference). It was initially developed to efficiently host the runtime in Microsoft SQL Server, which implements its own scheduler and memory manager.&lt;br /&gt;
Full 64-bit support for both the x64 and the IA64 hardware platforms.&lt;br /&gt;
Language support for generics built directly into the .NET CLR.&lt;br /&gt;
Many additional and improved ASP.NET web controls.&lt;br /&gt;
New data controls with declarative data binding.&lt;br /&gt;
New personalization features for ASP.NET, such as support for themes, skins and webparts.&lt;br /&gt;
.NET Micro Framework - a version of the .NET Framework related to the Smart Personal Objects Technology initiative.&lt;br /&gt;
Partial classes&lt;br /&gt;
Anonymous methods&lt;br /&gt;
&lt;strong&gt;.NET Framework 3.0&lt;/strong&gt;&lt;br /&gt;
.NET Framework 3.0, formerly called WinFX includes a new set of managed code APIs that are an integral part of Windows Vista and Windows Server 2008 operating systems. It is also available for Windows XP SP2 and Windows Server 2003 as a download. There are no major architectural changes included with this release; .NET Framework 3.0 uses the Common Language Runtime of .NET Framework 2.0 Unlike the previous major .NET releases there was no .NET Compact Framework release made as a counterpart of this version.&lt;br /&gt;
.NET Framework 3.0 consists of four major new components:&lt;br /&gt;
Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies. See WPF SDK for developer articles and documentation on WPF.&lt;br /&gt;
Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.&lt;br /&gt;
Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.&lt;br /&gt;
Windows CardSpace, formerly code-named InfoCard; a software component which securely stores a person's digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website.&lt;br /&gt;
&lt;strong&gt;.NET Framework 3.5&lt;/strong&gt;&lt;br /&gt;
Version 3.5 of the .NET Framework was released on 19 November 2007, but it is not included with Windows Server 2008. As with .NET Framework 3.0, version 3.5 uses the CLR of version 2.0. In addition, it installs .NET Framework 2.0 SP1, .NET Framework 2.0 SP2 (with 3.5 SP1) and .NET Framework 3.0 SP1, which adds some methods and properties to the BCL classes in version 2.0 which are required for version 3.5 features such as Language Integrated Query (LINQ). These changes do not affect applications written for version 2.0, however As with previous versions, a new .NET Compact Framework 3.5 was released in tandem with this update in order to provide support for additional features on Windows Mobile and Windows Embedded CE devices.&lt;br /&gt;
The source code of the Base Class Library in this version has been partially released (for debugging reference only) under the Microsoft Reference Source License.&lt;br /&gt;
Changes since version 3.0&lt;br /&gt;
New language features in C# 3.0 and VB.NET 9.0 compiler&lt;br /&gt;
Adds support for expression trees and lambda methods&lt;br /&gt;
Extension methods&lt;br /&gt;
Expression trees to represent high-level source code at runtime&lt;br /&gt;
Anonymous types with static type inference&lt;br /&gt;
Language Integrated Query (LINQ) along with its various providers&lt;br /&gt;
LINQ to Objects&lt;br /&gt;
LINQ to XML&lt;br /&gt;
LINQ to SQL&lt;br /&gt;
Paging support for ADO.NET&lt;br /&gt;
ADO.NET synchronization API to synchronize local caches and server side datastores&lt;br /&gt;
Asynchronous network I/O API&lt;br /&gt;
Peer-to-peer networking stack, including a managed PNRP resolver&lt;br /&gt;
Managed wrappers for Windows Management Instrumentation and Active Directory APIs&lt;br /&gt;
Enhanced WCF and WF runtimes, which let WCF work with POX and JSON data, and also expose WF workflows as WCF services.WCF services can be made stateful using the WF persistence model.&lt;br /&gt;
Support for HTTP pipelining and syndication feeds.&lt;br /&gt;
ASP.NET AJAX is included&lt;br /&gt;
New System.CodeDom namespace.&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Difference between ArrayList and Generic List</title><link>http://technical-bits.blogspot.com/2010/11/difference-between-arraylist-and.html</link><author>noreply@blogger.com (Kumar S)</author><pubDate>Tue, 30 Nov 2010 11:41:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-8990908556853549832</guid><description>Here we will see some important differences for the collections ArrayList() and Generic List&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ArrayList:&lt;/strong&gt;&lt;br /&gt;&lt;ul class="list"&gt;&lt;br /&gt;&lt;li&gt;The namespace for ArrayList is System.Collections &lt;/li&gt;&lt;br /&gt;&lt;li&gt;How to create ArrayList?&lt;p&gt;&lt;em class="code"&gt;&lt;br /&gt;ArrayList stringArrayList = new ArrayList();&lt;/em&gt; &lt;/p&gt;&lt;p&gt;Here we dont need to specify object type arraylist going to contain,store different type of objects or items&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;In ArrayList each item is stored as an Object so while reteriving we can get object only.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt; It is like Array of Objects.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;strong&gt;Generic List:&lt;/strong&gt;&lt;br /&gt;&lt;ul class="list"&gt;&lt;br /&gt;&lt;li&gt;The namespace for Generic List is System.Collections.Generic &lt;/li&gt;&lt;br /&gt;&lt;li&gt;How to create a List?&lt;p&gt;&lt;em class="code"&gt;&lt;br /&gt;List&lt;string&gt; stringList = new List&lt;string&gt;();&lt;/em&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;i.e.&lt;br/&gt;&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;List&amp;lt;type&amp;gt; nameOfList = new List&amp;lt;type&amp;gt;(); &lt;/em&gt;&lt;br/&gt;&lt;br /&gt; type means object type which List&amp;lt;T&amp;gt; going to hold.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;In List&amp;lt;T&amp;gt; , it can hold or contain only type of object which is mentioned while initialising the List&amp;lt;T&amp;gt; &lt;br/&gt;Just like in above example stringList will only contain object of type string, the type supplied as generic parameter.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;  It is newly added in .Net 2.0 and onwards, processing will be fast and no need of explicit casting.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Let us see one example.&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;string first = “First String”;&lt;br /&gt;&lt;br /&gt;string second = “Second String”;&lt;br /&gt;&lt;br /&gt;int firstInt = 1;&lt;br /&gt;&lt;br /&gt;int secondInt = 2;&lt;br /&gt;&lt;br /&gt;ArrayList stringArrayList = new ArrayList(); // No need to specify the object type,can store anything.&lt;br /&gt;&lt;br /&gt;stringArrayList.Add(first); // string type&lt;br /&gt;&lt;br /&gt;stringArrayList.Add(second); // string type&lt;br /&gt;&lt;br /&gt;stringArrayList.Add(firstInt); // Can contain any type so no problem in storing int&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;List&lt;string&gt; stringList = new List&lt;string&gt;(); // Need to specify the object type, will contain only string types.&lt;br /&gt;&lt;br /&gt;stringList.Add(first);&lt;br /&gt;&lt;br /&gt;stringList.Add(second);&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;See this sample&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;stringList.Add(firstInt); // adding int in string type List.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;we will get the exceptions below as List need to contain only string types. others are not allowed.&lt;br /&gt;&lt;em class="code" style="color:red;"&gt;&lt;br /&gt;&lt;br /&gt;1) ‘The best overloaded method match for ‘System.Collections.Generic.List&lt;string&gt;.Add(string)’ has some invalid arguments’&lt;br /&gt;&lt;br /&gt;2) ‘Argument ’1′: cannot convert from ‘int’ to ‘string’&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt; See another Sample&lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;string abcd = stringArrayList[1]; &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Suppose if we try to get an ArrayList item without using the casting then we can get following exception, as arraylist contain Objects only we need to cast as pre our requirments.&lt;br /&gt;&lt;br /&gt;We will get Exception – &lt;br /&gt;&lt;br /&gt;&lt;em class="code" style="color:red;"&gt;&lt;br /&gt;‘Cannot implicitly convert type ‘object’ to ‘string’. An explicit conversion exists (are you missing a cast?)’&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;We can avoid it as &lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;string abcd = stringArrayList[1].ToString(); // Needs casting ,memory overhead.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>IEnumerable vs. IQueryable</title><link>http://technical-bits.blogspot.com/2010/05/ienumerable-vs-iqueryable.html</link><category>IEnumerable</category><category>IQueryable</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Mon, 10 May 2010 17:20:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-7672480510429825305</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;strong&gt;IQueryable&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
• The primary difference is that the LINQ operators for IQueryable&lt;t&gt; take Expression objects instead of delegates, meaning the custom query logic it receives, e.g., a predicate or value selector, is in the form of an expression tree instead of a delegate to a method.&lt;br /&gt;
• IQueryable&lt;t&gt; extends the IEnumerable&lt;t&gt; interface, so anything you can do with a "plain" IEnumerable&lt;t&gt;, you can also do with an IQueryable&lt;t&gt;.&lt;br /&gt;
• The expression can simply be a constant expression of the object itself or a more complex tree of a composed set of query operators and operands. The query provider's IQueryProvider.Execute() or IQueryProvider.CreateQuery() methods are called with an Expression passed to it, and then either a query result or another IQueryable is returned, respectively.&lt;br /&gt;
• IQueryable&lt;t&gt; allows for out-of memory things like a remote data source, such as a database or web service.&lt;br /&gt;
• IQueryable&lt;t&gt; is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;IEnumerable&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
• IEnumerable doesn’t have the concept of moving between items, it is a forward only collection. It’s very minimalistic; something that most any data source can provide. Using only this minimal functionality, LINQ can provide all of these great operators.&lt;br /&gt;
• IEnumerable&lt;t&gt; is great for working with sequences that are iterated in-memory.&lt;br /&gt;
• IEnumerable&lt;t&gt; just has a GetEnumerator() method that returns an Enumerator&lt;t&gt; for which you can call its MoveNext() method to iterate through a sequence of T&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>LINQ Query Syntax versus Method Syntax</title><link>http://technical-bits.blogspot.com/2010/05/linq-query-syntax-versus-method-syntax.html</link><author>noreply@blogger.com (Kumar S)</author><pubDate>Mon, 10 May 2010 17:17:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-6361616300655962439</guid><description>Most queries in the introductory LINQ documentation are written as query expressions by using the declarative query syntax introduced in C# 3.0. However, the .NET common language runtime (CLR) has no notion of query syntax in itself. Therefore, at compile time, query expressions are translated to something that the CLR does understand: method calls. These methods are called the standard query operators, and they have names such as Where, Select, GroupBy, Join, Max, Average, and so on. You can call them directly by using method syntax instead of query syntax.&lt;br /&gt;The following example shows a simple query expression and the semantically equivalent query written as a method-based query.&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;class QueryVMethodSyntax&lt;br /&gt;{&lt;br /&gt;    static void Main()&lt;br /&gt;    {&lt;br /&gt;        int[] numbers = { 5, 10, 8, 3, 6, 12};&lt;br /&gt;&lt;br /&gt;        //Query syntax:&lt;br /&gt;        IEnumerable&lt;int&gt; numQuery1 = &lt;br /&gt;            from num in numbers&lt;br /&gt;            where num % 2 == 0&lt;br /&gt;            orderby num&lt;br /&gt;            select num;&lt;br /&gt;&lt;br /&gt;        //Method syntax:&lt;br /&gt;        IEnumerable&lt;int&gt; numQuery2 = numbers.Where(num =&gt; num % 2 == 0).OrderBy(n =&gt; n);&lt;br /&gt;&lt;br /&gt;        foreach (int i in numQuery1)&lt;br /&gt;        {&lt;br /&gt;            Console.Write(i + " ");&lt;br /&gt;        }&lt;br /&gt;        Console.WriteLine(System.Environment.NewLine);&lt;br /&gt;        foreach (int i in numQuery2)&lt;br /&gt;        {&lt;br /&gt;            Console.Write(i + " ");&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        // Keep the console open in debug mode.&lt;br /&gt;        Console.WriteLine(System.Environment.NewLine);&lt;br /&gt;        Console.WriteLine("Press any key to exit");&lt;br /&gt;        Console.ReadKey();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;/*&lt;br /&gt;    Output:&lt;br /&gt;    6 8 10 12&lt;br /&gt;    6 8 10 12&lt;br /&gt; */&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;The output from the two examples is identical. You can see that the type of the query variable is the same in both forms: IEnumerable&lt;(Of &lt;(T&gt;)&gt;).&lt;br /&gt;To understand the method-based query, let's examine it more closely. On the right side of the expression, notice that the where clause is now expressed as an instance method on the numbers object, which as you will recall has a type of IEnumerable&lt;int&gt;. If you are familiar with the generic IEnumerable&lt;(Of &lt;(T&gt;)&gt;) interface, you know that it does not have a Where method. However, if you invoke the IntelliSense completion list in the Visual Studio IDE, you will see not only a Where method, but many other methods such as Select, SelectMany, Join, and Orderby. These are all the standard query operators.&lt;br /&gt;Although it looks as if IEnumerable&lt;(Of &lt;(T&gt;)&gt;) has been redefined to include these additional methods, in fact this is not the case. The standard query operators are implemented as a new kind of method called extension methods. Extensions methods "extend" an existing type; they can be called as if they were instance methods on the type. The standard query operators extend IEnumerable&lt;(Of &lt;(T&gt;)&gt;) and that is why you can write numbers.Where(...).</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>LINQ - Mixed Query and Method Syntax</title><link>http://technical-bits.blogspot.com/2010/05/linq-mixed-query-and-method-syntax.html</link><author>noreply@blogger.com (Kumar S)</author><pubDate>Mon, 10 May 2010 17:14:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-7774703202555763668</guid><description>This example shows how to use method syntax on the results of a query clause. Just enclose the query expression in parentheses, and then apply the dot operator and call the method. In the following example, query #7 returns a count of the numbers whose value is between 3 and 7. In general, however, it is better to use a second variable to store the result of the method call. In this manner, the query is less likely to be confused with the results of the query.&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;// Query #7.&lt;br /&gt;&lt;br /&gt;// Using a query expression with method syntax&lt;br /&gt;int numCount1 =&lt;br /&gt;    (from num in numbers1&lt;br /&gt;     where num &lt; 3 || num &gt; 7&lt;br /&gt;     select num).Count();&lt;br /&gt;&lt;br /&gt;// Better: Create a new variable to store&lt;br /&gt;// the method call result&lt;br /&gt;IEnumerable&lt;int&gt; numbersQuery =&lt;br /&gt;    from num in numbers1&lt;br /&gt;    where num &lt; 3 || num &gt; 7&lt;br /&gt;    select num;&lt;br /&gt;&lt;br /&gt;int numCount2 = numbersQuery.Count();&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;Because Query #7 returns a single value and not a collection, the query executes immediately.&lt;br /&gt;The previous query can be written by using implicit typing with var, as follows:&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;var numCount = (from num in numbers...&lt;br /&gt;It can be written in method syntax as follows:&lt;br /&gt;var numCount = numbers.Where(n =&gt; n &lt; 3 || n &gt; 7).Count();&lt;br /&gt;It can be written by using explicit typing, as follows:&lt;br /&gt;int numCount = numbers.Where(n =&gt; n &lt; 3 || n &gt; 7).Count();&lt;br /&gt;&lt;/em&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>LINQ Queries - Method Syntax</title><link>http://technical-bits.blogspot.com/2010/05/linq-queries-method-syntax.html</link><author>noreply@blogger.com (Kumar S)</author><pubDate>Mon, 10 May 2010 17:11:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-3220986267804867935</guid><description>Some query operations must be expressed as a method call. The most common such methods are those that return singleton numeric values, such as Sum, Max, Min, Average, and so on. These methods must always be called last in any query because they represent only a single value and cannot serve as the source for an additional query operation. The following example shows a method call in a query expression:&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;List&lt;int&gt; numbers1 = new List&lt;int&gt;() { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };&lt;br /&gt;List&lt;int&gt; numbers2 = new List&lt;int&gt;() { 15, 14, 11, 13, 19, 18, 16, 17, 12, 10 };&lt;br /&gt;// Query #4.&lt;br /&gt;double average = numbers1.Average();&lt;br /&gt;&lt;br /&gt;// Query #5.&lt;br /&gt;IEnumerable&lt;int&gt; concatenationQuery = numbers1.Concat(numbers2);&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;If the method has parameters, these are provided in the form of a lambda expression, as shown in the following example:&lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;// Query #6.&lt;br /&gt;IEnumerable&lt;int&gt; largeNumbersQuery = numbers2.Where(c =&gt; c &gt; 15);&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;In the previous queries, only Query #4 executes immediately. This is because it returns a single value, and not a generic IEnumerable&lt;(Of &lt;(T&gt;)&gt;) collection. The method itself has to use foreach in order to compute its value.&lt;br /&gt;Each of the previous queries can be written by using implicit typing with var, as shown in the following example:&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;// var is used for convenience in these queries&lt;br /&gt;var average = numbers1.Average();&lt;br /&gt;var concatenationQuery = numbers1.Concat(numbers2);&lt;br /&gt;var largeNumbersQuery = numbers2.Where(c =&gt; c &gt; 15);&lt;br /&gt;&lt;/em&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>LINQ Queries - Query Syntax</title><link>http://technical-bits.blogspot.com/2010/05/linq-queries-query-syntax.html</link><category>IEnumerable</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Mon, 10 May 2010 17:03:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-8107608109186070810</guid><description>The recommended way to write most queries is to use query syntax to create query expressions. The following example shows three query expressions. The first query expression demonstrates how to filter or restrict results by applying conditions with a where clause. It returns all elements in the source sequence whose values are greater than 7 or less than 3. The second expression demonstrates how to order the returned results. The third expression demonstrates how to group results according to a key. This query returns two groups based on the first letter of the word.&lt;br /&gt;&lt;em class="code"&gt;&lt;br /&gt;// Query #1.&lt;br /&gt;List&lt;int&gt; numbers = new List&lt;int&gt;() { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };&lt;br /&gt;&lt;br /&gt;// The query variable can also be implicitly typed by using var&lt;br /&gt;IEnumerable&lt;int&gt; filteringQuery =&lt;br /&gt;    from num in numbers&lt;br /&gt;    where num &lt; 3 || num &gt; 7&lt;br /&gt;    select num;&lt;br /&gt;&lt;br /&gt;// Query #2.&lt;br /&gt;IEnumerable&lt;int&gt; orderingQuery =&lt;br /&gt;    from num in numbers&lt;br /&gt;    where num &lt; 3 || num &gt; 7&lt;br /&gt;    orderby num ascending&lt;br /&gt;    select num;&lt;br /&gt;&lt;br /&gt;// Query #3.&lt;br /&gt;string[] groupingQuery = { "carrots", "cabbage", "broccoli", "beans", "barley" };&lt;br /&gt;IEnumerable&amp;lt;IGrouping&lt;char, string&gt;&amp;gt; queryFoodGroups =&lt;br /&gt;    from item in groupingQuery&lt;br /&gt;    group item by item[0];&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;Note that the type of the queries is IEnumerable&lt;(Of &lt;(T&gt;)&gt;). All of these queries could be written using var as shown in the following example:&lt;br /&gt;var query = from num in numbers...&lt;br /&gt;In each previous example, the queries do not actually execute until you iterate over the query variable in a foreach statement.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How to: Write LINQ Queries in C#</title><link>http://technical-bits.blogspot.com/2010/05/how-to-write-linq-queries-in-c.html</link><category>Use method syntax</category><category>Use query syntax</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Mon, 10 May 2010 16:59:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-7734640112387916342</guid><description>The three ways in which you can write a LINQ query in C#:&lt;br /&gt;&lt;br /&gt;1. Use query syntax. Please refer this &lt;a href="http://technical-bits.blogspot.com/2010/05/linq-queries-query-syntax.html" title="query syntax"&gt;post&lt;/a&gt;.&lt;br /&gt;2. Use method syntax. Please refer this &lt;a href="http://technical-bits.blogspot.com/2010/05/linq-queries-method-syntax.html" title=" method syntax"&gt;post&lt;/a&gt;.&lt;br /&gt;3. Use a combination of query syntax and method syntax. Please refer this &lt;a href="http://technical-bits.blogspot.com/2010/05/linq-mixed-query-and-method-syntax.html" title="combination of query syntax and method syntax"&gt;post&lt;/a&gt;.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>WCF Message Security</title><link>http://technical-bits.blogspot.com/2010/05/wcf-message-security.html</link><category>Message Security advantages</category><category>Message Security disadvantages</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Thu, 6 May 2010 11:31:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-3983285770419460573</guid><description>When using message security, the user credentials and claims are encapsulated in every message using the WS-Security specification to secure messages. This option gives the most flexibility from an authentication perspective. You can use any type of security credentials you want, largely independent of transport, as long as both the client and the service agree.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW7zhScGIExVc1_f4mRBBRooYFJB0o3gPo2ew2zxn_xVIcT83zVgfZfr0JlJFHZhoTG34iH4M4WmZyMoZsYkW7Gkj4-PXcWHAWSWSqxvwV_xNVGOHjAgTaaGMOQ-OJD-uW6T9H3Slv_TOh/s1600/image.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 151px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW7zhScGIExVc1_f4mRBBRooYFJB0o3gPo2ew2zxn_xVIcT83zVgfZfr0JlJFHZhoTG34iH4M4WmZyMoZsYkW7Gkj4-PXcWHAWSWSqxvwV_xNVGOHjAgTaaGMOQ-OJD-uW6T9H3Slv_TOh/s320/image.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5468033398391022546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Use message security for the following scenarios:&lt;br /&gt;&lt;br /&gt;• You are sending a message to a WCF service, and the message is likely to be forwarded to other WCF services or may be routed through intermediate systems.&lt;br /&gt;• Your WCF clients are accessing the WCF service over the Internet, it’s possible that other intermediate systems may be used in between, and security is your top consideration.&lt;br /&gt;&lt;br /&gt;Using message security has following advantages:&lt;br /&gt;&lt;br /&gt;• It provides end-to-end security. Because message security directly encrypts and signs the message, having intermediaries does not break the security.&lt;br /&gt;• It allows partial or selective message encryption and signing, thus improving overall application performance.&lt;br /&gt;• Message security is transport-independent and can be used with any transport protocol.&lt;br /&gt;• It supports a wide set of credentials and claims, including issue token, which enables federated security.&lt;br /&gt;&lt;br /&gt;Using message security has following disadvantages:&lt;br /&gt;&lt;br /&gt;• This option may reduce performance compared to transport security because each individual message is encrypted and signed.&lt;br /&gt;• It does not support interoperability with older ASP.NET Web Services (ASMX) clients because it requires both the client and service to support WS-Security specifications.</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW7zhScGIExVc1_f4mRBBRooYFJB0o3gPo2ew2zxn_xVIcT83zVgfZfr0JlJFHZhoTG34iH4M4WmZyMoZsYkW7Gkj4-PXcWHAWSWSqxvwV_xNVGOHjAgTaaGMOQ-OJD-uW6T9H3Slv_TOh/s72-c/image.JPG" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>WCF Transport Security</title><link>http://technical-bits.blogspot.com/2010/05/wcf-transport-security.html</link><category>transport security advantages</category><category>transport security disadvantages</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Thu, 6 May 2010 11:26:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-4910650924859016357</guid><description>When using transport security, the user credentials and claims are passed using the transport layer. In other words, user credentials are transport-dependent, which allows fewer authentication options compared to message security. Each transport protocol (TCP, IPC, MSMQ, or HTTP) has its own mechanism for passing credentials and handling message protection. The most common approach for this is to use Secure Sockets Layer (SSL) for encrypting and signing the contents of the packets sent over Secure HTTP (HTTPS). &lt;br /&gt;&lt;br /&gt;Transport security is used to provide point-to-point security between the two endpoints (service and client). If there are intermediary systems between the client and the service, each intermediate point must forward the message over a new SSL connection.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz6NnnSj3hahmU2nSzpSh7Lkmw68JntCncLueJbFYKsuuvkv_NTWLbu_wP5KS-faPfC61TBzYYeyWvGr7BPDiFlxaeX6rt2BXAacdtYZEinpKk0xAZAg_kEBGoAKKwytnwCXRIuQx2bT0C/s1600/image.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 154px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz6NnnSj3hahmU2nSzpSh7Lkmw68JntCncLueJbFYKsuuvkv_NTWLbu_wP5KS-faPfC61TBzYYeyWvGr7BPDiFlxaeX6rt2BXAacdtYZEinpKk0xAZAg_kEBGoAKKwytnwCXRIuQx2bT0C/s320/image.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5468032281108712290" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Use transport security for the following scenarios:&lt;br /&gt;&lt;br /&gt;• You are sending a message directly from your application to a WCF service and the message will not be routed through intermediate systems.&lt;br /&gt;• You have both the service and the client in an intranet.&lt;br /&gt;&lt;br /&gt;Using transport security has the following advantages:&lt;br /&gt;&lt;br /&gt;• It provides interoperability, meaning that communicating parties do not need to understand the WS-Security specification.&lt;br /&gt;• It may result in better performance.&lt;br /&gt;• Hardware accelerators can be used to further improve performance.&lt;br /&gt;&lt;br /&gt;Using transport security has the following disadvantages:&lt;br /&gt;&lt;br /&gt;• Because security is applied on a point-to-point basis, there is no provision for multiple hops or routing through intermediate application nodes.&lt;br /&gt;• It supports a limited set of credentials and claims compared to message security.&lt;br /&gt;• It is transport-dependent upon the underlying platform, transport mechanism, and security service provider such as NTLM or Kerberos</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz6NnnSj3hahmU2nSzpSh7Lkmw68JntCncLueJbFYKsuuvkv_NTWLbu_wP5KS-faPfC61TBzYYeyWvGr7BPDiFlxaeX6rt2BXAacdtYZEinpKk0xAZAg_kEBGoAKKwytnwCXRIuQx2bT0C/s72-c/image.JPG" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>WCF Transfer Security</title><link>http://technical-bits.blogspot.com/2010/05/wcf-transfer-security.html</link><category>Message</category><category>Transport</category><category>TransportCredentialOnly</category><category>TransportWithMessageCredential</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Thu, 6 May 2010 11:04:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-5899138004297816161</guid><description>After selecting a binding, you can decide which type of transfer security, otherwise known as security mode, to use for your WCF service. You can provide security on the transport level or the message level. Each option has its own advantages and disadvantages. For instance, transport security secures the entire communication channel (e.g., by using SSL) and therefore only supports point-to-point communication over a single transport. Message security protects each message individually and therefore supports multipoint communication, multiple transports, or even partial message encryption if necessary. Most scenarios are best supported by using transport security. The following security modes are available across the standard bindings.&lt;br /&gt;&lt;br /&gt;&lt;table class="table-data"&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;Mode&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;No security is provided; all information is passed in clear text.&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Transport&lt;/td&gt;&lt;td&gt;Mutual authentication and message protection are provided at the transport level.&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Message&lt;/td&gt;&lt;td&gt;Mutual authentication and message protection are provided at the message level&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Both&lt;/td&gt;&lt;td&gt;Mutual authentication and message protection are provided at both the transport and message levels. This is far more than is necessary for most scenarios.&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;TransportWithMessageCredential&lt;/td&gt;&lt;td&gt;Client authentication is provided at the message level, and message protection and service authentication are provided at the transport level.&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;TransportCredentialOnly&lt;/td&gt;&lt;td&gt;Mutual authentication is provided at the transport level; no message protection is provided. This option is available only on &lt;strong&gt;basicHttpBinding&lt;/strong&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>WCF Bindings and Behaviors</title><link>http://technical-bits.blogspot.com/2010/05/wcf-bindings-and-behaviors.html</link><category>basicHttpBinding</category><category>netTcpBinding</category><category>wsFederationHttpBinding</category><category>wsHttpBinding</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Thu, 6 May 2010 10:40:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-5875090616053921603</guid><description>When you create an overall security policy – for example, transfer security with authentication and authorization for your services – you can use bindings and behaviors to configure the required settings.&lt;br /&gt;&lt;br /&gt;Bindings and behaviors are described as follows:&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Bindings.&lt;/strong&gt; Bindings control the security mode, client credential type, and other security settings.&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Behaviors.&lt;/strong&gt; Service behaviors control impersonation levels, how client credentials are authenticated and authorized, and service credentials.&lt;br /&gt;&lt;br /&gt;You can configure bindings and behaviors, or you can program against the object model. Your binding selection determines the available security options for WCF. The following table summarizes the most commonly used bindings in WCF.&lt;br /&gt;&lt;br /&gt;&lt;table class="table-data"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Binding&lt;/th&gt;&lt;th&gt;Common scenarios&lt;/th&gt;&lt;th&gt;Default security settings&lt;/th&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;&lt;strong&gt;basicHttpBinding&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Legacy Web service protocols&lt;/td&gt;&lt;td&gt;No security&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;&lt;strong&gt;netTcpBinding&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Binary TCP communication between machines&lt;/td&gt;&lt;td&gt;Transport security with Windows authentication&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;&lt;strong&gt;wsFederationHttpBinding&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Federated security scenarios&lt;/td&gt;&lt;td&gt;Message security with issue token authentication&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;&lt;strong&gt;wsHttpBinding&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Leveraging security standards (WS-Security)&lt;/td&gt;&lt;td&gt;Message security with Windows authentication&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;By default, every WCF binding will provide transfer security and user authentication except for BasicHttpBinding. If necessary, you can change the security settings to suit your scenario requirements.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>WCF Key Security Features and Scope of WCF Security</title><link>http://technical-bits.blogspot.com/2010/05/wcf-key-security-features.html</link><category>Auditing</category><category>authentication</category><category>authorization</category><category>Confidentiality</category><category>Integrity</category><category>Scope of WCF Security</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Wed, 5 May 2010 16:03:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-4956358943174955724</guid><description>Any Service-Oriented Architecture (SOA) needs to support security features that provide auditing, authentication, authorization, confidentiality, and integrity for the messages exchanged between the client and the service. Windows Communication Foundation (WCF) provides these security features by default for any application that is built on top of the WCF framework.&lt;br /&gt;&lt;br /&gt;Key security features include:&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Auditing&lt;/strong&gt; - Effective auditing and logging is the key to non-repudiation. Non-repudiation guarantees that a user cannot deny performing an operation or initiating a transaction.&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Authentication&lt;/strong&gt; - Authentication allows you to confidently identify the clients of your service. These might be end users, other services, processes, or computers. WCF supports mutual authentication, which identifies both the client and the service in tandem, to help in preventing man-in-the-middle attacks&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Authorization&lt;/strong&gt; - Authorization determines what system resources and operations can be accessed by the authenticated user. This allows you to grant specific application and resource permissions for authenticated users.&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Confidentiality&lt;/strong&gt; - Confidentiality, also referred to as privacy, is the process of making sure that data remains private and confidential, and that it cannot be viewed by unauthorized users. Encryption is frequently used to enforce confidentiality. Privacy is a key concern, particularly for data / messages passed across networks. &lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Integrity&lt;/strong&gt; - Integrity is the guarantee that data is protected from accidental or deliberate modification. Like privacy, integrity is a key concern, particularly for data / messages passed across networks. Integrity for data in transit is typically provided by using hashing techniques and message authentication codes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Scope of WCF Security&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The above fundamental security features are covered in the following WCF features:&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Transfer security.&lt;/strong&gt; Responsible for providing message confidentiality, data integrity, and authentication of communicating parties.&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Authorization.&lt;/strong&gt; Responsible for providing a framework for making authorization decisions.&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;Auditing.&lt;/strong&gt; Responsible for logging security-related events to the audit log.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>WCF Security</title><link>http://technical-bits.blogspot.com/2010/05/wcf-security.html</link><category>authentication</category><category>authorization</category><category>delegation</category><category>impersonation</category><category>transfer security</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Wed, 5 May 2010 15:59:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-5034171047485026658</guid><description>Securing your WCF service requires knowledge of the WCF security features related to auditing and logging, authentication, authorization, confidentiality, and integrity. Use behaviors and bindings to configure security for your WCF service. Bindings and behaviors allow you to configure transfer security, authentication, authorization, impersonation, and delegation as well as auditing and logging. Transfer security is the means by which WCF secures messages over the network. WCF gives you two options to implement transfer security: transport security and message security. Transport security secures the entire communication channel (e.g., by using SSL), while message security secures each message individually. WCF supports a variety of authentication options including username, Windows, and certificate authentication. Depending on your authentication method, you can choose to authorize your users by using role-based security or resource-based security. Use WCF impersonation and delegation to flow the identity and security context of your client-side original caller to the back end in order to support a granular authorization approach.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Structs in C#</title><link>http://technical-bits.blogspot.com/2010/04/structs-in-c.html</link><category>default constructor</category><category>Structs</category><category>System.ValueType</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Tue, 20 Apr 2010 17:02:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-8149272062402040055</guid><description>• Within a struct declaration, fields cannot be initialized unless they are declared as const or static.&lt;br /&gt;• A struct may not declare a default constructor (a constructor without parameters) or a destructor.&lt;br /&gt;• Structs are copied on assignment. When a struct is assigned to a new variable, all the data is copied, and any modification to the new copy does not change the data for the original copy. This is important to remember when working with collections of value types such as Dictionary&lt;string, myStruct&gt;.&lt;br /&gt;• Structs are value types and classes are reference types.&lt;br /&gt;• Unlike classes, structs can be instantiated without using a new operator.&lt;br /&gt;• Structs can declare constructors that have parameters.&lt;br /&gt;• A struct cannot inherit from another struct or class, and it cannot be the base of a class. All structs inherit directly from System.ValueType, which inherits from System.Object.&lt;br /&gt;• A struct can implement interfaces.&lt;br /&gt;• A struct can be used as a nullable type and can be assigned a null value.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Joins in LINQ Query Expressions</title><link>http://technical-bits.blogspot.com/2010/04/joins-in-query-expressions.html</link><category>from clause</category><category>Group join</category><category>Inner join</category><category>Joins in LINQ Query</category><category>Left outer join</category><category>let clause</category><author>noreply@blogger.com (Kumar S)</author><pubDate>Wed, 7 Apr 2010 17:44:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-6868702993054746692.post-5073308639493672911</guid><description>As we discussed in the prevoius post a join clause takes two source sequences as input. The elements in each sequence must either be or contain a property that can be compared to a corresponding property in the other sequence. The join clause compares the specified keys for equality by using the special equals keyword. All joins performed by the join clause are equijoins. The shape of the output of a join clause depends on the specific type of join you are performing. The following are three most common join types:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Inner join&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The following example shows a simple inner equijoin. This query produces a flat sequence of “product name / category” pairs. The same category string will appear in multiple elements. If an element from categories has no matching products, that category will not appear in the results.&lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;var innerJoinQuery =&lt;br /&gt;    from category in categories&lt;br /&gt;    join prod in products on category.ID equals prod.CategoryID&lt;br /&gt;    select new { ProductName = prod.Name, Category = category.Name }; //produces flat sequence&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Group join&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A join clause with an into expression is called a group join.&lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;var innerGroupJoinQuery =&lt;br /&gt;    from category in categories&lt;br /&gt;    join prod in products on category.ID equals prod.CategoryID into prodGroup&lt;br /&gt;    select new { CategoryName = category.Name, Products = prodGroup };&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;A group join produces a hierarchical result sequence, which associates elements in the left source sequence with one or more matching elements in the right side source sequence. A group join has no equivalent in relational terms; it is essentially a sequence of object arrays.&lt;br /&gt;&lt;br /&gt;If no elements from the right source sequence are found to match an element in the left source, the join clause will produce an empty array for that item. Therefore, the group join is still basically an inner-equijoin except that the result sequence is organized into groups.&lt;br /&gt;&lt;br /&gt;If you just select the results of a group join, you can access the items, but you cannot identify the key that they match on. Therefore, it is generally more useful to select the results of the group join into a new type that also has the key name, as shown in the previous example.&lt;br /&gt;&lt;br /&gt;You can also, of course, use the result of a group join as the generator of another subquery:&lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;var innerGroupJoinQuery2 =&lt;br /&gt;    from category in categories&lt;br /&gt;    join prod in products on category.ID equals prod.CategoryID into prodGroup&lt;br /&gt;    from prod2 in prodGroup&lt;br /&gt;    where prod2.UnitPrice &gt; 2.50M&lt;br /&gt;    select prod2;    &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Left outer join&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In a left outer join, all the elements in the left source sequence are returned, even if no matching elements are in the right sequence. To perform a left outer join in LINQ, use the DefaultIfEmpty method in combination with a group join to specify a default right-side element to produce if a left-side element has no matches. You can use null as the default value for any reference type, or you can specify a user-defined default type. In the following example, a user-defined default type is shown:&lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;var leftOuterJoinQuery =&lt;br /&gt;    from category in categories&lt;br /&gt;    join prod in products on category.ID equals prod.CategoryID into prodGroup&lt;br /&gt;    from item in prodGroup.DefaultIfEmpty(new Product{Name = String.Empty, CategoryID = 0})&lt;br /&gt;        select new { CatName = category.Name, ProdName = item.Name };&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;from:&lt;/strong&gt;  A query expression must begin with a from clause. Additionally, a query expression can contain sub-queries, which also begin with a from clause. The from clause specifies the following:&lt;br /&gt;&lt;br /&gt;o The data source on which the query or sub-query will be run.&lt;br /&gt;o A local range variable that represents each element in the source sequence.&lt;br /&gt;Both the range variable and the data source are strongly typed. The data source referenced in the from clause must have a type of IEnumerable, IEnumerable&lt;(Of &lt;(T&gt;)&gt;), or a derived type such as IQueryable&lt;(Of &lt;(T&gt;)&gt;).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;let:&lt;/strong&gt;  In a query expression, it is sometimes useful to store the result of a sub-expression in order to use it in subsequent clauses. You can do this with the let keyword, which creates a new range variable and initializes it with the result of the expression you supply. Once initialized with a value, the range variable cannot be used to store another value. However, if the range variable holds a queryable type, it can be queried.&lt;br /&gt;&lt;br /&gt;In the following example let is used in two ways:&lt;br /&gt;o To create an enumerable type that can itself be queried.&lt;br /&gt;o To enable the query to call ToLower only one time on the range variable word. Without using let, you would have to call ToLower in each predicate in the where clause.&lt;br /&gt;&lt;br /&gt;&lt;em class="code"&gt;class LetSample1&lt;br /&gt;{&lt;br /&gt;    static void Main()&lt;br /&gt;    {&lt;br /&gt;        string[] strings = &lt;br /&gt;        {&lt;br /&gt;            "A penny saved is a penny earned.",&lt;br /&gt;            "The early bird catches the worm.",&lt;br /&gt;            "The pen is mightier than the sword." &lt;br /&gt;        };&lt;br /&gt;&lt;br /&gt;        // Split the sentence into an array of words&lt;br /&gt;        // and select those whose first letter is a vowel.&lt;br /&gt;        var earlyBirdQuery =&lt;br /&gt;            from sentence in strings&lt;br /&gt;            let words = sentence.Split(' ')&lt;br /&gt;            from word in words&lt;br /&gt;            let w = word.ToLower()&lt;br /&gt;            where w[0] == 'a' || w[0] == 'e'&lt;br /&gt;                || w[0] == 'i' || w[0] == 'o'&lt;br /&gt;                || w[0] == 'u'&lt;br /&gt;            select word;&lt;br /&gt;&lt;br /&gt;        // Execute the query.&lt;br /&gt;        foreach (var v in earlyBirdQuery)&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("\"{0}\" starts with a vowel", v);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        // Keep the console window open in debug mode.&lt;br /&gt;        Console.WriteLine("Press any key to exit.");&lt;br /&gt;        Console.ReadKey();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;/* Output:&lt;br /&gt;    "A" starts with a vowel&lt;br /&gt;    "is" starts with a vowel&lt;br /&gt;    "a" starts with a vowel&lt;br /&gt;    "earned." starts with a vowel&lt;br /&gt;    "early" starts with a vowel&lt;br /&gt;    "is" starts with a vowel&lt;br /&gt;*/&lt;/em&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item></channel></rss>