<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Sumit Amar</title><subtitle type="html">Research and Development</subtitle><id>http://blogs.msdn.com/samar/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/samar/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2005-06-07T00:53:00Z</updated><entry><title>[Closed] Job Posting: Software Development Engineer </title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2008/01/23/job-posting-software-development-engineer.aspx" /><id>http://blogs.msdn.com/samar/archive/2008/01/23/job-posting-software-development-engineer.aspx</id><published>2008-01-24T06:24:00Z</published><updated>2008-01-24T06:24:00Z</updated><content type="html">&lt;P&gt;I have few job openings in my team for Silverlight, AJAX, WCF, WPF and SQL Server developers.&amp;nbsp;Here's the job description.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;“Do you like dynamic challenges in web application development? A large scale internet applications on the world’s top commercial web site sounds interesting to you? Do you want to work on cutting edge web application using state of the art Web 2.0 technologies? If you answer yes to any of the above questions, here is the opportunity for you.&lt;BR&gt;&lt;BR&gt;Marketing Center Of Excellence (Global Marketing Platform) division’s World Wide Events &amp;amp; Profile Center team is looking for a self motivated and seasoned senior web UI developer. This is an application that allows partners to create live, in-person and live meeting events via the partners’ extranet application, and these events are exposed on external internet facing site http://msevents.microsoft.com to the users who might be interested in registering and attending the events. Team is working on renovating the Web UI and Middle Tier. In addition to the current features, next generation system includes streaming videos and rich UX via Silverlight, integration with adCenter, contextual display of events on third party sites, communities integration, pluggable controls for other Microsoft.com properties etc. This is a great opportunity to impact the external customers with first hand code. Some of the highlights of the project includes Web UI instrumentation for analyzing user’s cognitive behavior and collecting usage, performance and error data directly from the client side XMLHTTP calls, Web UI and Middle Tier based on modern design patterns, WCF (Indigo) and Web Services based contracts between Middle Tier and the adopters, individually testable and scalable layered architecture. &lt;BR&gt;&lt;BR&gt;The required skills for this opening are: proficiency in OOP and C# (2.0), ASP.NET (Controls, Life cycle, Integration, Performance and Payload optimizations), DHTML, XML/XSL, JavaScript (Object Oriented), Web Services, WSE, AJAX (strong custom and Atlas/’ASP.NET AJAX’ implementations). &lt;BR&gt;&lt;BR&gt;Knowledge of KAF/ECHO Automation, XAML/Silverlight, SQL Server 2005 (TSQL, Profiler) is desirable. A BA/BS degree in Computer Science, Electronics or Mathematics, 8+ years or an MS in similar fields with 7+ years of professional experience is required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;If it interests you and you have desired qualification, please contact me.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7215221" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author></entry><entry><title>Basic C# coding guidelines</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2007/03/15/basic-c-coding-guidelines.aspx" /><id>http://blogs.msdn.com/samar/archive/2007/03/15/basic-c-coding-guidelines.aspx</id><published>2007-03-16T06:35:00Z</published><updated>2007-03-16T06:35:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;C# 2.0&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;Use generic collections instead of Hashtables and ArrayList types&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;If using Generic types, then refrain from using foreach loop on the collection. Rather use ForEach method to loop through via an anonymous method predicate (much faster because doesn’t create the Iterator). For non generic types try to use for loop instead of foreach if the data being traversed is huge&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;List&amp;lt;string&amp;gt; list = new List&amp;lt;string&amp;gt;();&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;list.Add("aa"); &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;list.Add("bb");&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;//option 1:&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;foreach(string str in list)&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine(str);&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;//option 2: RECOMMENDED&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;list.ForEach(delegate(string str) {&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Console.WriteLine(str);&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;&lt;FONT size=3&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;Nullify unused objects (doesn’t collect, but marks for collection and ceases from getting promoted into next generation)&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;IF conditions having just one item in if and else, should be used as ternary operator (? Sign)&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;e.g. instead of the code:&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;int i;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;if(someConditionTrue)&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;i = 3;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;else&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;i = 4;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;It is better to write the above 5 lines into just one:&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;int i = someConditionTrue ? 3 : 4;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;Use ‘as’ operator instead of direct typecast using parenthesis with the exception of overloaded explicit cast operator, it saves from NullReferenceException and InvalidCastException&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;Refrain from XmlDocument usage for navigational purpose, please either use XmlTextReader for sequential access or XPathDocument for XPath based data retrieval&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;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;For server side XSL transformation, Use XslCompiledTransform instead of XslTransform (Please check &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;A href="http://blogs.msdn.com/antosha/archive/2006/07/24/677560.aspx" mce_href="http://blogs.msdn.com/antosha/archive/2006/07/24/677560.aspx"&gt;&lt;SPAN style="COLOR: purple; FONT-FAMILY: 'Calibri','sans-serif'"&gt;http://blogs.msdn.com/antosha/archive/2006/07/24/677560.aspx&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt; ). For client side transformation, try to load Xsl file asynchronously whenever possible via XMLDOM or XsltProcessor (Geckos)&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;Always join your threads in a web page, if used (otherwise the page will be rendered and workers will continue operating at the server cost, and ofcourse the results will be unpredictable)&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;Let's say you opened two threads in a web page using the following:&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;Thread AThread&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;= new Thread(new ThreadStart(CallProcOne));&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;AThread.Start();&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;Thread CThread&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;= new Thread(new ThreadStart(CallProcTwo));&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;CThread.Start();&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;//Now it is recommended to do this:&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;AThread.Join();&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: Arial"&gt;&lt;FONT size=3&gt;CThread.Join();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;Always do NULL checking before operating on an object, NullReferenceException is widely occurring exception in most applications and only a preventive programming can help us get the real error&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;-&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial"&gt;Handle most specific (expected) exceptions in the catch blocks before deciding towards general Exception, and please don’t use catch without an exception object if you’re not really writing P/Invoke in C#&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1891716" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author></entry><entry><title>Creating custom wrapper for all JavaScript functions</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2006/10/05/Creating-custom-wrapper-for-all-JavaScript-functions.aspx" /><id>http://blogs.msdn.com/samar/archive/2006/10/05/Creating-custom-wrapper-for-all-JavaScript-functions.aspx</id><published>2006-10-06T07:03:00Z</published><updated>2006-10-06T07:03:00Z</updated><content type="html">There might be scenarios when all JavaScript side initiated function calls need to be intercepted for logging and error reporting purposes on the client. Two approaches exist, one, calling an intermediary function and then initiating call to real function, but that could be harder to manage. Since JavaScript allows real flexibility in extending its base objects (such as String, Array, Function etc), it is quite manageable to create a custom wrapper in the base Function object and all functions will go through this route. You might decide to use this feature on as-needed basis.&lt;br&gt;&lt;br&gt;In the example below, a custom wrapper known by its name is created under Function by extending the prototype property. Normal JavaScript functions (such as func and printObjects in following example) don't need to change their implementation. Only at the time of calling the real function, just replace the real function name with function name + .wrapper and pass arguments as you would normally do, starting with the "this" which is required for remembering who is the original caller of this function. e.g. a sample call could be &lt;br&gt;&lt;br&gt;onclick="myFunction.wrapper(this,'x','arg2',{2,2});"&lt;br&gt;&lt;br&gt;&amp;lt;!-- #### Code below --&amp;gt;&lt;br&gt;&amp;lt;script&amp;gt;&lt;br&gt;Function.prototype.wrapper = function(sender)&lt;br&gt;{&lt;br&gt;&amp;nbsp;alert("In Wrapper function first; Logging starts here");&lt;br&gt;&amp;nbsp;alert(arguments.length &amp;gt; 1 ? "First argument of real function is " + arguments[1] : "no additional args")&lt;br&gt;&amp;nbsp;try {&lt;br&gt;&amp;nbsp; this.apply(sender,arguments); //real function call&lt;br&gt;&amp;nbsp;}catch(exception)&lt;br&gt;&amp;nbsp;{&lt;br&gt;&amp;nbsp; //log exception on server side using XMLHTTP and/or display a generic message to user&lt;br&gt;&amp;nbsp;}&lt;br&gt;&amp;nbsp;alert("In Wrapper function; Logging ends here");&lt;br&gt;}&lt;br&gt;&lt;br&gt;function func(sender)&lt;br&gt;{&lt;br&gt;&amp;nbsp;alert("Real function called");&lt;br&gt;}&lt;br&gt;&lt;br&gt;function printObjects(sender)&lt;br&gt;{&lt;br&gt;&amp;nbsp;document.write("&amp;lt;pre&amp;gt;");&lt;br&gt;&amp;nbsp;for(var i in document)&lt;br&gt;&amp;nbsp; document.writeln(i + " &amp;lt;&amp;lt; " + typeof(i));&lt;br&gt;}&lt;br&gt;&amp;lt;/script&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;input onclick='func.wrapper(this,"hello",new Object());' type=button id=b value=Press NAME="b"/&amp;gt;&lt;br&gt;&amp;lt;input onclick=printObjects.wrapper(this); value=PrintObjects type=button ID="Button1" NAME="Button1"/&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=795232" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="JavaScript" scheme="http://blogs.msdn.com/samar/archive/tags/JavaScript/default.aspx" /></entry><entry><title>Auxiliary Saver Technique in Web Forms</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2006/02/17/534593.aspx" /><id>http://blogs.msdn.com/samar/archive/2006/02/17/534593.aspx</id><published>2006-02-18T05:20:00Z</published><updated>2006-02-18T05:20:00Z</updated><content type="html">&lt;P&gt;As we all know state management is a big deal in web applications. We might have web forms that send important data to the server where might lie some validations in addition to the client side JavaScript validations. General challenge is&amp;nbsp;to restore all the client controls to their previous selections. ViewState use can help, however there are two issues in controling state&lt;/P&gt;
&lt;P&gt;1. If you're conservative to keep your page size to low, you may not use ViewState.&lt;BR&gt;2. The controls were built using client side script and/or their data was populated dynamically (such as AJAX or XML DSO etc), these bindings will need to happen once again when page is rendered back after the error or the status check&lt;/P&gt;
&lt;P&gt;Is it really needed to Postback when saving data using webforms? Answer is No. Because we can utilize an auxilliary "form saver" page/handler that will be posted data from the client using XMLHTTP asynchronously, and whenever it finishes processing, it can return back the&amp;nbsp;XML&amp;nbsp;as a response metadata. This XML response will tell whether the operation to save form data succeeded or not. Also we can customize it to return some&amp;nbsp;status codes (may be used to redirect after saving data etc)&amp;nbsp;and meta language to perform post-save processing on the client side using JavaScript.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=534593" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="S/AJAX" scheme="http://blogs.msdn.com/samar/archive/tags/S_2F00_AJAX/default.aspx" /></entry><entry><title>True Asynchronous Payload</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/09/24/473550.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/09/24/473550.aspx</id><published>2005-09-24T10:53:00Z</published><updated>2005-09-24T10:53:00Z</updated><content type="html">&lt;P&gt;For rendering content and feature rich web pages, here are the questions that we have in front of us:&lt;/P&gt;
&lt;P&gt;1. How to speed up the process of data fetch/load at the server to rendering it to the web client.&lt;BR&gt;2. Reduce the markup&lt;/P&gt;
&lt;P&gt;I discussed point 2 in my previous post (another way to reduce markup is to not "Generate" X/HTML on the server, do it using XSLT on client). Anyhow 2. is also indirectly correlated to 1. &lt;/P&gt;
&lt;P&gt;As a proposed solution, what we need here is the &lt;EM&gt;true asynchronous loading &lt;/EM&gt;of the web page that is feature/content rich. So how do we achieve that!? Ironically the answer lies in both the developer's mind (what data to async) and the methodology I'm about to discuss. Here is my thought process for manually dividing the payload distribution&lt;/P&gt;
&lt;P&gt;1. Logically separate the different data units of the web page (viz. in a news site, breaking news, stock ticker and weather information can be considered isolated if they all come from different data sources or in other words they have be explicitly loaded by using a DB call)&lt;BR&gt;2. Render the page from server with placeholder markup for these logical data units (i.e. no data, no DB calls have been made so far) and a small JavaScript block containing boolean variables values set to true for which [data units] content needs to be loaded later.&lt;BR&gt;3. After the server request has returned lightweight payload (missing data) and quicker response (server didn't have to do much processing cause most importantly DB calls were skipped), go through the JavaScript boolean variables set by the server, each of them signifies a data units. which ever is set to true, make AJAX call to grab data from the server and populate in the respective&amp;nbsp;placeholders of data units.&lt;BR&gt;4. Next is upto the developer to either render X/HTML out of the data retrieved using plain JavaScript or XSLT. Tip: If using XSL, remember they can also be loaded asynchronously! So higher performance can be achieved if the XSL is large and heavy markup is rendered out of it.&lt;BR&gt;5. In the end, page will appear as being loaded asynchronously and much faster than it would have using a single server send. It's like using multiple small funnels instead of a big one, that is sequential.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=473550" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="S/AJAX" scheme="http://blogs.msdn.com/samar/archive/tags/S_2F00_AJAX/default.aspx" /></entry><entry><title>Determine the Payload division</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/09/22/472649.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/09/22/472649.aspx</id><published>2005-09-22T15:21:00Z</published><updated>2005-09-22T15:21:00Z</updated><content type="html">&lt;P&gt;Lately I've been thinking about devising a mechanism to determine the division of the Payload between the content that is rendered to client web browser (including markup) and the one that client browser can load, hold and process in its memory. The logic behind this idea is to reduce the network traffic on the wire in PLT-1. And then grab the rest of the [required] data using hidden XMLHTTP calls and keep in browser's memory variables. Certain ActiveX (such as XMLHTTP, XMLDOM) can process the data received through AJAX (XMLHTTP/WinHTTP) call and render to the screen. It saves us two things&lt;/P&gt;
&lt;P&gt;1. Processing these records on the web server (saving CPU)&lt;BR&gt;2. Rendering markup from server on the HTTP wire (which can be processed and rendered by a cheaper mechanism on the client browser such as XSLT/JS)&lt;/P&gt;
&lt;P&gt;And costs us this&lt;/P&gt;
&lt;P&gt;1. More server requests (lightweight though)&lt;/P&gt;
&lt;P&gt;However to partially get around the cost mentioned above, we need to keep once loaded data into browser memory variables and not make the request if same thing is being requested again.&lt;/P&gt;
&lt;P&gt;Coming back to the main issue, to determine how much data should be rendered by the server, and how much responsibility can be&amp;nbsp;given&amp;nbsp;to the client to load (XML) and process without causing IE memory leaks/overruns. Next is to devise an algorithm to determine this division factor on the basis of size of total renderable data.&lt;/P&gt;
&lt;P&gt;let d=data; t=time&lt;/P&gt;
&lt;P&gt;d(c) + d(s) = d(tl)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;... (1)&lt;/P&gt;
&lt;P&gt;t(c) + t(s) = t(tl)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;... (2)&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;However, in (2) t(s) is a variable and t(c) is constant [assuming all clients have as usual near about high amount of memory and CPU available]. In order to find the value of d, use of induction could be handy, if performance can be optimized or at least standardized as acceptable. I'll post what I find out of this experiment.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=472649" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="S/AJAX" scheme="http://blogs.msdn.com/samar/archive/tags/S_2F00_AJAX/default.aspx" /></entry><entry><title>Encrypt at client side and decrypt at server</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/17/430254.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/17/430254.aspx</id><published>2005-06-17T23:17:00Z</published><updated>2005-06-17T23:17:00Z</updated><content type="html">&lt;P&gt;There might be situations where the content from thin client that is accessible via internet, needs to be encrypted (without storing the encryption logic at the client) and subsequently be decrypted on the server side code that doesn't run on SSL. Here is one thought how to do that with help of JavaScript and XMLHTTP ActiveX object (replacement available for Mozilla family browsers as well). &lt;/P&gt;
&lt;P&gt;First we'll write a JavaScript function that makes a synchronous POST call to a web page(Reform.aspx) that contains the encryption logic and returns the encrypted value to client and this web page should run on&amp;nbsp;SSL. This function thus provides encryption for parameters on need basis without putting the whole location/webpage on SSL that will include the overhead of encryption for all form data including the hefty ViewState (if not being stored in Session using &lt;EM&gt;Page.&lt;/EM&gt;&lt;FONT size=2&gt;&lt;EM&gt;SavePageStateToPersistenceMedium.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#008000 size=2&gt;
&lt;P&gt;//########JavaScript for calling ASPX page and encrypting ###########&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;function&lt;/FONT&gt;&lt;FONT size=2&gt; changeParam(str)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;str = "dataToReform="+escape(str);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size=2&gt;(window.XMLHttpRequest) {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp; request = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; XMLHttpRequest();&lt;BR&gt;&amp;nbsp; } &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;else&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt;(window.ActiveXObject) {&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;request = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; ActiveXObject("Microsoft.XMLHTTP");&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size=2&gt;(request)&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;request.open("POST", "Reform.aspx",&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;false&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;BR&gt;&amp;nbsp; request.setRequestHeader("Content-type","application/x-www-form-urlencoded");&lt;BR&gt;&amp;nbsp; request.setRequestHeader("Content-length",str.length);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=2&gt;request.send(str);&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; request.responseText;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=3&gt;Above function call be called by passing a string to be encrypted. Now let's have a look at the server page that contains the logic to encrypt and decrypt. It can by any custom encryption logic depending upon developer's choice.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT size=3&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;//######## C# class that defines encrypting/decrypting&amp;nbsp;###########&lt;/P&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Collections;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.ComponentModel;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Data;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Drawing;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Web;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Web.SessionState;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Web.UI;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Web.UI.WebControls;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Web.UI.HtmlControls;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Collections.Specialized; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Xml;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.IO;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Text;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Security.Cryptography;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Text.RegularExpressions;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;namespace&lt;/FONT&gt;&lt;FONT size=2&gt; YourNamespace&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; Reform : Page&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;override&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Page_Load(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; sender, System.EventArgs e)&lt;BR&gt;{&lt;BR&gt;Response.Write(Encrypt(Request["dataToReform"]));&lt;BR&gt;Response.End();&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; Encrypt(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; source)&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] initializer = Encoding.ASCII.GetBytes("@1B2c3D4e5F6g7H8");&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] stringiation = Encoding.ASCII.GetBytes("5uM1+4m4~"); //flavor for the encryption&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;FONT size=2&gt; size = 192;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] bytStr = Encoding.UTF8.GetBytes(source);&lt;BR&gt;PasswordDeriveBytes pwdItem = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; PasswordDeriveBytes("p455W0~d*(*)",stringiation,"SHA1",5); //password code for encrypting in SHA1 or anything else&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] bytKeys = pwdItem.GetBytes(size/8);&lt;BR&gt;RijndaelManaged rmEncryption = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; RijndaelManaged();&lt;BR&gt;rmEncryption.Mode = CipherMode.CBC; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;//cipher block chaining&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;ICryptoTransform encryptor = rmEncryption.CreateEncryptor(bytKeys,initializer);&lt;BR&gt;MemoryStream stream = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; MemoryStream();&lt;BR&gt;CryptoStream cryptoStream = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; CryptoStream(stream,encryptor,CryptoStreamMode.Write);&lt;BR&gt;cryptoStream.Write(bytStr, 0, bytStr.Length);&lt;BR&gt;cryptoStream.FlushFinalBlock();&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] bytSource = stream.ToArray();&lt;BR&gt;stream.Close();&lt;BR&gt;cryptoStream.Close();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; ciphered = Convert.ToBase64String(bytSource);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; ciphered;&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; Decrypt(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; ciphered)&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] initializer = Encoding.ASCII.GetBytes("@1B2c3D4e5F6g7H8");&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] stringiation = Encoding.ASCII.GetBytes("5uM1+4m4~");&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] bytStr = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;FONT size=2&gt; size = 192;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;BR&gt;try&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;bytStr = Convert.FromBase64String(ciphered.Replace(" ","+"));&lt;BR&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;catch&lt;/FONT&gt;&lt;FONT size=2&gt;(Exception ex){System.Diagnostics.Debug.WriteLine(ex.Message);}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;PasswordDeriveBytes pwdItem = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; PasswordDeriveBytes("p455W0~d*(*)",stringiation,"SHA1",5);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] bytKeys = pwdItem.GetBytes(size/8);&lt;BR&gt;RijndaelManaged rmEncryption = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; RijndaelManaged();&lt;BR&gt;rmEncryption.Mode = CipherMode.CBC; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;//cipher block chaining&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;ICryptoTransform decryptor = rmEncryption.CreateDecryptor(bytKeys,initializer);&lt;BR&gt;MemoryStream stream = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; MemoryStream(bytStr);&lt;BR&gt;CryptoStream cryptoStream = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; CryptoStream(stream,decryptor,CryptoStreamMode.Read);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[] plainTextBytes = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;byte&lt;/FONT&gt;&lt;FONT size=2&gt;[bytStr.Length];&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;FONT size=2&gt; decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);&lt;BR&gt;stream.Close();&lt;BR&gt;cryptoStream.Close();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;BR&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; plainText = Encoding.UTF8.GetString(plainTextBytes,0,decryptedByteCount);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; plainText;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;BR&gt;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Now at the server side where the parameter encrypted by calling &lt;EM&gt;changeParam(str) &lt;/EM&gt;was sent, can be decrypted by making a static call to &lt;EM&gt;Reform.Decrypt(string)&lt;/EM&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=430254" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="S/AJAX" scheme="http://blogs.msdn.com/samar/archive/tags/S_2F00_AJAX/default.aspx" /></entry><entry><title>Web Services: Revolutionize your business</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425971.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425971.aspx</id><published>2005-06-07T10:58:00Z</published><updated>2005-06-07T10:58:00Z</updated><content type="html">Industry is talking of Web Services to the height of Petronas Towers. For an IT &lt;BR&gt;professional unaware of Web Services following questions come up, &lt;BR&gt;1. How practical is it when it comes to implementation? &lt;BR&gt;2. Are they real, or hype? &lt;BR&gt;3. Why Web Services? &lt;BR&gt;4. Who will be benefited? &lt;BR&gt;&lt;BR&gt;Before answering the above questions, let’s present a small scenario, when some &lt;BR&gt;ISV or an organization had to sell their services in the form of components, they &lt;BR&gt;would write component compile it and make available on the stores (websites). &lt;BR&gt;Potential consumers of the product, needed to know where the product is available, &lt;BR&gt;after they search it, they incorporate it in their business application. It sounds quite &lt;BR&gt;straightforward, but the story is not over yet. Proceeding with the change in the &lt;BR&gt;product, provider had to modify the component and remarket with changes. This is &lt;BR&gt;a perfect example of providing reusable components that could be used by varying &lt;BR&gt;enterprises. &lt;BR&gt;&lt;BR&gt;Coming on to intra enterprise application management scenario, where locations are &lt;BR&gt;spread physically and geographically, application required remote access to services &lt;BR&gt;running on physically distributed terminals. It evolved the concept that’s known with &lt;BR&gt;varying names in various technologies viz. “Remote Method Invocation”, “Remote &lt;BR&gt;Procedure Call”, “Distributed Component Object Model”, “Common Object Request &lt;BR&gt;Broker Architecture” and many more. Making remote calls phenomenon added great &lt;BR&gt;value to the distributed computing. However, all of these technologies required a &lt;BR&gt;dedicated connection to be maintained to bind, listen, send and receive data. &lt;BR&gt;&lt;BR&gt;Considering the limitations of two different approaches discussed above, industry felt &lt;BR&gt;the need of having some mechanism that would allow &lt;BR&gt;1. Remote Method Calls without maintaining dedicated connections &lt;BR&gt;2. A centralized way of managing the change in components &lt;BR&gt;3. Better advertising and selling perspectives &lt;BR&gt;4. Cross platform, Robust and Extensible access&amp;nbsp;&lt;BR&gt;&lt;BR&gt;Microsoft, IBM, Sun, Ariba along with other companies came up with an extension to a &lt;BR&gt;common data exchange mechanism that was already being used for data &lt;BR&gt;interchange in EDI and EFT, namely XML. The standard was first named as SDL &lt;BR&gt;(Service Description Language) by MS, but the industry agreed upon a common &lt;BR&gt;name of WSDL (Web SDL). Theoretically, a web application running on any platform, &lt;BR&gt;container or server needed to generate a common format of data for response to a &lt;BR&gt;service request. WSDL is a SOAP (Simple Object Access Protocol) based standard &lt;BR&gt;that encapsulates the functionality within an XML document. &lt;BR&gt;&lt;BR&gt;What are Web Services after all? Web Services are web applications available &lt;BR&gt;through HTTP (that is a stateless protocol and allows asynchronous requests), and &lt;BR&gt;can be requested by any client running on any platform and application, and in &lt;BR&gt;response to the request WS will return data in the form of WSDL, which can then be &lt;BR&gt;utilized to generate a “proxy” or representation library of the web service. &lt;BR&gt;Subsequently, this library can be used in the implementing application and web &lt;BR&gt;service’s methods can be invoked. The mechanism sounds quite similar to RPC and &lt;BR&gt;&lt;BR&gt;RMI, but with significant differences of being operated on stateless protocol HTTP &lt;BR&gt;and being able to execute on any platform. Web Services have solution to all the desired functionalities stated as desired. &lt;BR&gt;&lt;BR&gt;We’ll now see the answers to questions discussed at the start: &lt;BR&gt;How practical are web services when it comes to implementation: Despite of short &lt;BR&gt;span of Web Services inception, most of the corporates, ISVs and other entities have &lt;BR&gt;started to provide some of their business components’ functionalities through Web &lt;BR&gt;Services. Bablefish Translation provider is a perfect example, which is provided by &lt;BR&gt;legendry search engine Alta Vista. Other examples include WhenU.com’s world &lt;BR&gt;weather service. The benefit implementer gets is the ease of use and freedom to use &lt;BR&gt;in any kind of software. &lt;BR&gt;&lt;BR&gt;Are they real, or hype? Whenever a new technology is introduced in the market, it’s &lt;BR&gt;nothing but hype. But as the time grows and technology matures stakeholders &lt;BR&gt;understand the real stand of the technology. Since Web Services concept was &lt;BR&gt;support by industry legends like MS, IBM, Sun, it started in its winning spree within &lt;BR&gt;these organizations, but in a short span all of the other stakeholders understood the &lt;BR&gt;benefits it provides. Oracle.com published a massive article in Oracle magazine that &lt;BR&gt;was titled “Web Services are Real”. The objective was of course to market their &lt;BR&gt;Oracle Portal Server in context of Web Services, but it provided insights of actual &lt;BR&gt;implementation of a Secure Architecture that uses J2EE and Oracle to provide robust &lt;BR&gt;business services. Since the industry is adopting Web Services at a geometric rate, it &lt;BR&gt;is relevant to say “They are Real !” &lt;BR&gt;&lt;BR&gt;Why Web Services: It provides an independent, flexible, robust, scalable and &lt;BR&gt;industry wide standard that makes distributed computing peanuts. More benefits are &lt;BR&gt;already discussed. &lt;BR&gt;&lt;BR&gt;Who is benefited? : Web Services provide one stop solution to businesses, &lt;BR&gt;developers, consumers and UDDI business registry nodes that “host” the “logical &lt;BR&gt;repository” of web services. Businesses feel more comfortable in version control of &lt;BR&gt;the component/service while developers just have to know the URI of the WSDL of &lt;BR&gt;web services. More significantly they can programmatically search the UDDI registry &lt;BR&gt;using simple SDKs provided by most of the vendors. Ultimate consumers of the web &lt;BR&gt;service can make a SOAP request to the WSDL, ROPE (Remote Object Proxy Engine) &lt;BR&gt;generates a proxy on the fly and remotely methods of the service can be invoked, &lt;BR&gt;there are no hiccups of installation, registration and distribution of the components. &lt;BR&gt;&lt;BR&gt;At last we can conclude that Web Services are all set to revolutionize the modern &lt;BR&gt;businesses that deal with distributed computing. &lt;BR&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425971" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="Web Services" scheme="http://blogs.msdn.com/samar/archive/tags/Web+Services/default.aspx" /></entry><entry><title>Retrieving SOAP Envelope from WebException</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425969.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425969.aspx</id><published>2005-06-07T10:55:00Z</published><updated>2005-06-07T10:55:00Z</updated><content type="html">Web Services might be invoked using HttpWebRequest. If the invocation raises a service specific exception, the WebException’s Message property gives “Internal Server Error (500)”. There exists a need to parse the WebException object to retrieve the original SOAP Envelope with fault details. Here is the solution: &lt;BR&gt;&lt;BR&gt;catch(WebException wEx) &lt;BR&gt;{ &lt;BR&gt;string str=wEx.ToString(); &lt;BR&gt;if(wEx.Response == null ) //If not SOAP Exception &lt;BR&gt;throw new Exception(wEx.Message); &lt;BR&gt;WebResponse webResp = wEx.Response; &lt;BR&gt;Stream receiveStream = webResp.GetResponseStream(); &lt;BR&gt;System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8"); &lt;BR&gt;StreamReader readStream = new StreamReader(receiveStream, encode); &lt;BR&gt;&lt;BR&gt;XmlDocument xmlResponseDoc = new XmlDocument(); &lt;BR&gt;xmlResponseDoc.Load(readStream); &lt;BR&gt;Debug.Write(readStream.ReadToEnd()); &lt;BR&gt;readStream.Close(); &lt;BR&gt;webResp.Close(); &lt;BR&gt;str = xmlResponseDoc.InnerXml; //str contains the SOAP Envelope &lt;BR&gt;&lt;BR&gt;//parse the str using LoadXml method of XmlDocument class &lt;BR&gt;// … &lt;BR&gt;} &lt;BR&gt;catch(Exception otherException) &lt;BR&gt;{ &lt;BR&gt;//do something else &lt;BR&gt;} &lt;BR&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425969" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.msdn.com/samar/archive/tags/ASP.NET/default.aspx" /><category term="Web Services" scheme="http://blogs.msdn.com/samar/archive/tags/Web+Services/default.aspx" /></entry><entry><title>Publish, Discover and Invoke Web Services using SOAP and UDDI</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425968.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425968.aspx</id><published>2005-06-07T10:55:00Z</published><updated>2005-06-07T10:55:00Z</updated><content type="html">&lt;STRONG&gt;Introduction&lt;/STRONG&gt; &lt;BR&gt;The project contains code that allows to Describe, Discover and Invoke a web service in .NET using SOAP SDK 3.0 and UDDI SDK 2.0 beta on .NET SDK 1.1. &lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Background&lt;/STRONG&gt; &lt;BR&gt;UDDI (Universal Description Discovery and Integration) is a standard that defines common registry where web service providers register themselves and describe/publish their services and details thereof including the URIs to access services. The authority that provides centralised UDDI services is known as Business Registry Node. There could be a public or private node, public being accessible to everyone over the internet. Some commonly used public nodes include microsoft (uddi.microsoft.com), IBM, SAP and others. We'll be making use of Microsoft Test UDDI node (test.uddi.microsoft.com) for our testing purposes. The public UDDI node can be searched by an API that conforms with a UDDI specification set by UDDI.org. e.g. Microsoft's UDDI SDK 2.0 beta can be used in .NET environment to make inquiry and publish requests to microsoft uddi site. &lt;BR&gt;&lt;BR&gt;SOAP (Simple Object Access Protocol) is a communication standard based on XML and used in communications between web service calls. Microsoft's SOAP SDK facilitates to invoke web service methods without creating a proxy class for the web service. We'll be making use of SOAP SDK 3.0 for our testing environment. &lt;BR&gt;&lt;STRONG&gt;&lt;BR&gt;Code Usage&lt;/STRONG&gt; &lt;BR&gt;As discussed earlier, we'll communicate with microsoft's test uddi node, in order to publish our business and services we need to have a passport ID and need to register ourselves as a service provider manually at the https://test.uddi.microsoft.com/register.aspx . I'm going to use a web service written by someone that converts/translates the supplied string to a funny word. &lt;BR&gt;&lt;BR&gt;Following are related to UDDI and SOAP SDKs &lt;BR&gt;&lt;BR&gt;using Microsoft.Uddi; &lt;BR&gt;using Microsoft.Uddi.Api; &lt;BR&gt;using MSSOAPLib30; &lt;BR&gt;&lt;BR&gt;After including the appropriate namespaces, define the initial parameters. &lt;BR&gt;&lt;BR&gt;string passportUserId="uddisoap@hotmail.com", &lt;BR&gt;passportPassword=@"/find?\//", &lt;BR&gt;inquireUrl="http://test.uddi.microsoft.com/inquire", &lt;BR&gt;publishUrl="https://test.uddi.microsoft.com/publish", //mind the HTTPS for &lt;BR&gt;publishing &lt;BR&gt;webService= &lt;BR&gt;"http://www.aspxpressway.com/maincontent/webservices/piglatin.asmx"; string serviceProvider= "SOAP UDDI WS &lt;BR&gt;Testers"; &lt;BR&gt;//our test service provider name &lt;BR&gt;&lt;BR&gt;Publishing a service provider and the service. &lt;BR&gt;&lt;BR&gt;private void publish_Click(object sender, System.EventArgs e) &lt;BR&gt;{ &lt;BR&gt;try &lt;BR&gt;{ &lt;BR&gt;Publish.Url = publishUrl; &lt;BR&gt;Publish.User = passportUserId; &lt;BR&gt;Publish.Password = passportPassword; &lt;BR&gt;&lt;BR&gt;SaveBusiness sb = new SaveBusiness(); &lt;BR&gt;&lt;BR&gt;sb.BusinessEntities.Add(); &lt;BR&gt;sb.BusinessEntities[0].Names.Add(serviceProvider); &lt;BR&gt;&lt;BR&gt;sb.BusinessEntities[0].Descriptions.Add("en", "This business is all about testing web services."); &lt;BR&gt;&lt;BR&gt;sb.BusinessEntities[0].CategoryBag.Add("Washington", "US-WA", "uuid:4e49a8d6-d5a2-4fc2-93a0-0411d8d19e88"); &lt;BR&gt;&lt;BR&gt;// Add contact details for responsible/support people &lt;BR&gt;sb.BusinessEntities[0].Contacts.Add(); &lt;BR&gt;sb.BusinessEntities[0].Contacts[0].PersonName = "Sumit Amar"; &lt;BR&gt;sb.BusinessEntities[0].Contacts[0].UseType = "Programmer"; &lt;BR&gt;sb.BusinessEntities[0].Contacts[0].Addresses.Add("#code", "PBMS"); &lt;BR&gt;sb.BusinessEntities[0].Contacts[0].Addresses[0].AddressLines.Add("35 Downing Street"); &lt;BR&gt;sb.BusinessEntities[0].Contacts[0].Addresses[0].AddressLines.Add("New London"); &lt;BR&gt;sb.BusinessEntities[0].Contacts.Add("Veronica","CTO"); //UseType specified in IInd parameter &lt;BR&gt;&lt;BR&gt;// Add service details &lt;BR&gt;sb.BusinessEntities[0].BusinessServices.Add(); &lt;BR&gt;sb.BusinessEntities[0].BusinessServices[0].Names.Add("pigLatin"); &lt;BR&gt;sb.BusinessEntities[0].BusinessServices[0].Descriptions.Add("Pig Latin funny!"); &lt;BR&gt;&lt;BR&gt;// Specify a binding where the service can be located &lt;BR&gt;sb.BusinessEntities[0].BusinessServices[0].BindingTemplates.Add(); &lt;BR&gt;sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].AccessPoint.Text = webService; &lt;BR&gt;sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].AccessPoint.URLType = Microsoft.Uddi.Api.URLType.Http; &lt;BR&gt;sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].Descriptions.Add("Converts the text to funny pig latin"); &lt;BR&gt;&lt;BR&gt;// Send the built save business request &lt;BR&gt;BusinessDetail businessDetail = sb.Send(); &lt;BR&gt;&lt;BR&gt;// Print the generated business key &lt;BR&gt;Response.Write("Business: " + businessDetail.BusinessEntities[0].Names[0].Text); &lt;BR&gt;Response.Write("Key: " + businessDetail.BusinessEntities[0].BusinessKey); &lt;BR&gt;Response.Write("Service published in Microsoft test UDDI site"); &lt;BR&gt;} &lt;BR&gt;catch (UddiException ex) &lt;BR&gt;{ &lt;BR&gt;if(ex.Number==UddiException.ErrorType.E_accountLimitExceeded) &lt;BR&gt;Response.Write("UDDI Exception: Service Provider "+serviceProvider+" already exists"); &lt;BR&gt;else if(ex.Number==UddiException.ErrorType.E_unknownUser) &lt;BR&gt;Response.Write("UDDI Exception: Passport authentication failed, double check your userId ("+passportUserId+") and password ("+passportPassword+")"); &lt;BR&gt;else &lt;BR&gt;Response.Write("UDDI exception: " + ex.Number + " - " + ex.Message); } &lt;BR&gt;catch (Exception ex) &lt;BR&gt;{Response.Write("Other exception: " + ex.Message);} &lt;BR&gt;&lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;Discovering the web service provider and service &lt;BR&gt;private void discover_Click(object sender, System.EventArgs e) &lt;BR&gt;{ &lt;BR&gt;try &lt;BR&gt;{ &lt;BR&gt;&lt;BR&gt;Inquire.Url = inquireUrl; &lt;BR&gt;&lt;BR&gt;// Create an object to find a business &lt;BR&gt;FindBusiness fb = new FindBusiness(); &lt;BR&gt;fb.Names.Add(serviceProvider); &lt;BR&gt;&lt;BR&gt;// Send the prepared find business request &lt;BR&gt;BusinessList businessList = fb.Send(); &lt;BR&gt;&lt;BR&gt;if (businessList.BusinessInfos.Count&amp;gt;0) &lt;BR&gt;{ &lt;BR&gt;GetBusinessDetail detailObject = new GetBusinessDetail(); &lt;BR&gt;&lt;BR&gt;// Associate the business key with detailObject, returned by fb.Send call &lt;BR&gt;detailObject.BusinessKeys.Add(businessList.BusinessInfos[0].BusinessKey); &lt;BR&gt;// Send the request to the UBR node &lt;BR&gt;BusinessDetail businessDetail = detailObject.Send(); &lt;BR&gt;&lt;BR&gt;//Scan through all business entities returned &lt;BR&gt;if (businessDetail.BusinessEntities.Count&amp;gt;0) &lt;BR&gt;{ &lt;BR&gt;// Scan categories specified for this business &lt;BR&gt;for (int i=0; i &amp;lt; businessDetail.BusinessEntities[0].CategoryBag.Count; i++) &lt;BR&gt;{ &lt;BR&gt;Response.Write(" Categories: "); &lt;BR&gt;Response.Write("Name : " + businessDetail.BusinessEntities[0].CategoryBag[i].KeyName); &lt;BR&gt;Response.Write("Value : " + businessDetail.BusinessEntities[0].CategoryBag[i].KeyValue); &lt;BR&gt;Response.Write("tModel : " + businessDetail.BusinessEntities[0].CategoryBag[i].TModelKey); &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;// Scan identifiers for the same &lt;BR&gt;for (int j=0; j &amp;lt; businessDetail.BusinessEntities[0].IdentifierBag.Count; j++) &lt;BR&gt;{ &lt;BR&gt;Response.Write("Identifiers:"); &lt;BR&gt;Response.Write("Name : " + businessDetail.BusinessEntities[0].IdentifierBag[j].KeyName); &lt;BR&gt;Response.Write("Value : " + businessDetail.BusinessEntities[0].IdentifierBag[j].KeyValue); &lt;BR&gt;Response.Write("tModel : " + businessDetail.BusinessEntities[0].IdentifierBag[j].TModelKey); &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;// scan contacts &lt;BR&gt;for (int k=0; k &amp;lt; businessDetail.BusinessEntities[0].Contacts.Count; k++) &lt;BR&gt;{ &lt;BR&gt;Response.Write("Contact ("+(k+1)+"):" ); &lt;BR&gt;Response.Write("Name : " + businessDetail.BusinessEntities[0].Contacts[k].PersonName); &lt;BR&gt;Response.Write("Type : " + businessDetail.BusinessEntities[0].Contacts[k].UseType); &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;// Scan through business services &lt;BR&gt;for (int m=0; m &amp;lt; businessDetail.BusinessEntities[0].BusinessServices.Count; m++) &lt;BR&gt;{ &lt;BR&gt;Response.Write("Services:"); &lt;BR&gt;Response.Write("Name : " + businessDetail.BusinessEntities[0].BusinessServices[m].Names[0].Text); &lt;BR&gt;// There might be multiple access points for this service &lt;BR&gt;for (int n=0; n &amp;lt; businessDetail.BusinessEntities[0].BusinessServices[m].BindingTemplates.Count; n++) &lt;BR&gt;{ &lt;BR&gt;//display and put the AccessPoint in variable wsUri &lt;BR&gt;Response.Write("Access point : " + (businessDetail.BusinessEntities[0].BusinessServices[m].BindingTemplates[n].AccessPoint.Text)); &lt;BR&gt;wsUri=businessDetail.BusinessEntities[0].BusinessServices[m].BindingTemplates[n].AccessPoint.Text; &lt;BR&gt;} &lt;BR&gt;} &lt;BR&gt;} &lt;BR&gt;} &lt;BR&gt;} &lt;BR&gt;catch (UddiException er) &lt;BR&gt;{Response.Write("UDDI exception: (" + er.Number + ") - " + er.Message);} &lt;BR&gt;catch (Exception er) &lt;BR&gt;{Response.Write("Other exception: " + er.Message);} &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Invoking the web service: Now we'll invoke the web service method using the SOAP SDK provided by microsoft. Invoking services using SoapClient(n) class is fairly easy. Here n means the major version appended to the classes. this number is not associated with SOAP SDK's previous versions than 3.0. &lt;BR&gt;MSSoapInit method in SoapClient(n) class initialises the web service for the given WSDL and accepts service name and service port. &lt;BR&gt;&lt;BR&gt;private void invoke_Click(object sender, System.EventArgs e) &lt;BR&gt;{ &lt;BR&gt;SoapClient30 sc = new SoapClient30(); &lt;BR&gt;string translateText=textToTran.Text; &lt;BR&gt;string wsdl=null; &lt;BR&gt;try &lt;BR&gt;{ &lt;BR&gt;if(wsUri==null) &lt;BR&gt;throw new Exception("Please Discover the service first"); &lt;BR&gt;if((new Regex("(wsdl)$")).IsMatch(wsUri)) //check if it's the real WSDL &lt;BR&gt;wsdl=wsUri; &lt;BR&gt;else &lt;BR&gt;wsdl=wsUri+"?wsdl"; //otherwise append WSDL to the service &lt;BR&gt;&lt;BR&gt;sc.MSSoapInit(wsdl, "piglatin", "piglatinSoap",""); //specify the service name and port name &lt;BR&gt;Type type =sc.GetType(); &lt;BR&gt;&lt;BR&gt;object []args = {translateText}; //specified service accepts just one argument (textToTranslate) &lt;BR&gt;Response.Write("Invoking method using MS SOAP SDK ..."); &lt;BR&gt;object ox = type.InvokeMember("toPigLatin", BindingFlags.InvokeMethod,null,sc,args); //Dynamic Invocation No Proxy class, no web reference &lt;BR&gt;Response.Write("Translated String "+ox.ToString()); &lt;BR&gt;} &lt;BR&gt;catch(Exception sEx){Response.Write("Exception occurred "+sEx.Message);} &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Further Enhancements&lt;/STRONG&gt; &lt;BR&gt;This sample code might be further enhanced to present a dashboard for testing web services and it's methods in UDDI registry. &lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Sumit Amar&lt;/STRONG&gt; &lt;BR&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425968" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.msdn.com/samar/archive/tags/ASP.NET/default.aspx" /><category term="Web Services" scheme="http://blogs.msdn.com/samar/archive/tags/Web+Services/default.aspx" /></entry><entry><title>Granting EXECUTE privilege on group of stored procedures to a specified user</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425967.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425967.aspx</id><published>2005-06-07T10:54:00Z</published><updated>2005-06-07T10:54:00Z</updated><content type="html">CREATE proc grants(@procs varchar(100),@user varchar(100)) as &lt;BR&gt;declare curse cursor for select name from sysobjects where type='P' and name like @procs &lt;BR&gt;&lt;BR&gt;OPEN CURSE &lt;BR&gt;declare @proc varchar(100) &lt;BR&gt;declare @stmt nvarchar(200) &lt;BR&gt;&lt;BR&gt;fetch next from curse into @proc &lt;BR&gt;while @@fetch_status=0 &lt;BR&gt;begin &lt;BR&gt;set @stmt='grant execute on '+@proc+' to '+@user &lt;BR&gt;exec SP_EXECUTESQL @STMT &lt;BR&gt;print @stmt &lt;BR&gt;fetch next from curse into @proc &lt;BR&gt;end &lt;BR&gt;&lt;BR&gt;close curse &lt;BR&gt;deallocate curse &lt;BR&gt;GO &lt;BR&gt;&lt;BR&gt;grants 'sptest%','bnbuser' &lt;BR&gt;go &lt;BR&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425967" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="SQL/Server" scheme="http://blogs.msdn.com/samar/archive/tags/SQL_2F00_Server/default.aspx" /></entry><entry><title>Working with custom sections in app|web.config</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425964.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425964.aspx</id><published>2005-06-07T10:52:00Z</published><updated>2005-06-07T10:52:00Z</updated><content type="html">Requirement may arise to define a custom section in app.config or web.config configuration file(s), to load a related but dynamic data for configuration purpose. &lt;BR&gt;&lt;BR&gt;Following is an example of how this can be achieved; &lt;CONFIGURATION&gt;element contains a sub element &lt;CONFIGSECTIONS&gt;where sections can be declared with &lt;SECTION&gt;element. The important thing about custom sections is the ability to define multiple name-value pairs and load’em at once in the .NET code. Here is the sample configuration file with aforementioned (and henceforth defined custom) elements. &lt;BR&gt;&lt;BR&gt;&lt;CODE&gt;&lt;BR&gt;&lt;BR&gt;&amp;lt;configuration&amp;gt; &lt;BR&gt;&amp;lt;configSections&amp;gt; &lt;BR&gt;&amp;lt;section name="Partners" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&amp;gt; &lt;BR&gt;&amp;lt;/configSections&amp;gt; &lt;BR&gt;&amp;lt;Partners&amp;gt; &amp;lt;!-- custom section--&amp;gt; &lt;BR&gt;&amp;lt;add key="000001" value="eBay Inc."/&amp;gt; &lt;BR&gt;&amp;lt;add key="000002" value="Amars Inc."/&amp;gt; &lt;BR&gt;&amp;lt;/Partners&amp;gt; &lt;BR&gt;&lt;BR&gt;&amp;lt;appSettings&amp;gt; &lt;BR&gt;&amp;lt;add key="dbStr" value="Data Source=localhost;uid=user;pwd=password;database=master"/&amp;gt; &lt;BR&gt;&amp;lt;/appSettings&amp;gt; &lt;BR&gt;&amp;lt;/configuration&amp;gt; &lt;/CODE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425964" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.msdn.com/samar/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Intercepting Downloads in ASP.NET</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425963.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425963.aspx</id><published>2005-06-07T10:51:00Z</published><updated>2005-06-07T10:51:00Z</updated><content type="html">&lt;BLOCKQUOTE class=postBody style="COLOR: #777"&gt;There might be general situations when developer needs to provide a download link to users for any kind of document that may include but not limited to doc, pdf, zip etc. However, the scenarios do exist when developer wants to authenticate the users before they could even reach at the source of the document, or there might be a requirement to log all the downloads performed on the website. Also the developer might not wish to give a direct URL of the document to any user at any time. Direct URLs may lead to unnecessary overhead, as the authors of other websites may provide a direct link of the document on their website. &lt;BR&gt;&lt;BR&gt;It arises the need of a download interceptor that could control, record and monitor the activities of the downloads performed. &lt;BR&gt;&lt;BR&gt;For implementing such an interceptor, all we need is the data entity for the documents to be presented to download and an ASPX page that will be requested instead of the original name of the document. &lt;BR&gt;&lt;BR&gt;The provided URL for the document to download might look like the following on port 80, where documentId is the document ID or number, which the interceptor will use as reference to lookup the document name from the documents table. &lt;BR&gt;&lt;BR&gt;http://yourHost/yourApp/download.aspx?documentId=1 &lt;BR&gt;&lt;BR&gt;Assuming the document table contains at least two fields, one the document’s ID and the other one its Name. Now let’s see how do we code the download.aspx and its code behind. The front end page doesn’t include anything, just leave it intact. &lt;BR&gt;&lt;BR&gt;public class download : System.Web.UI.Page &lt;BR&gt;{ &lt;BR&gt;SqlConnection con; &lt;BR&gt;SqlCommand cmd; &lt;BR&gt;string document; &lt;BR&gt;&lt;BR&gt;//retrieve static strings from the configuration file. &lt;BR&gt;string connStr=System.Configuration.ConfigurationSettings.AppSettings["dbStr"]; &lt;BR&gt;protected string absUploadPath=System.Configuration.ConfigurationSettings.AppSettings["absPath"]+"\\upload", &lt;BR&gt;uploadUrl=System.Configuration.ConfigurationSettings.AppSettings["siteUrl"]+"/upload"; &lt;BR&gt;&lt;BR&gt;private void Page_Load(object sender, System.EventArgs e) &lt;BR&gt;{ &lt;BR&gt;//Authentication routine goes here. You can put your authentication checks here so that no one other than the allowed user accesses this section &lt;BR&gt;if(!IsPostBack) &lt;BR&gt;{ &lt;BR&gt;try &lt;BR&gt;{ &lt;BR&gt;con=new SqlConnection(connStr); &lt;BR&gt;con.Open(); &lt;BR&gt;cmd=new SqlCommand("select documentPath from tblDocuments where dId=@dId",con); &lt;BR&gt;cmd.Parameters.Add("@dId",Request.QueryString["documentId"]); &lt;BR&gt;&lt;BR&gt;object obj=cmd.ExecuteScalar(); &lt;BR&gt;document=(obj!=null)?obj.ToString():null; &lt;BR&gt;//Authorisation routine can also be put to validate the user against individual documents, just as ACLs &lt;BR&gt;&lt;BR&gt;if(System.IO.File.Exists(absUploadPath+"\\"+document) &amp;amp;&amp;amp; document.Length!=0) &lt;BR&gt;{ &lt;BR&gt;Response.ContentType="application/unknown"; &lt;BR&gt;Response.AppendHeader("Content-Disposition","attachment; filename="+document); //attach the file to force download &lt;BR&gt;Response.WriteFile(absUploadPath+"\\"+document); &lt;BR&gt;Response.Flush(); &lt;BR&gt;//User user=(User)Session["userDetails"]; //custom class that stores user information in the session &lt;BR&gt;} &lt;BR&gt;else &lt;BR&gt;{ &lt;BR&gt;Response.Write("&amp;lt;font face=tahoma size=-1&amp;gt;&amp;lt;b&amp;gt;The file you requested doesn't exist &amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; Sit tight, You're being taken back to the User Section."); &lt;BR&gt;Response.AddHeader ("Refresh", "3; URL=previousPage.aspx"); //redirect to the previous page after a delay of 3 seconds &lt;BR&gt;} &lt;BR&gt;} &lt;BR&gt;//In case of any trouble redirect! &lt;BR&gt;catch(SqlException sEx){Response.Write(sEx.Number + " " + sEx.Message); Response.AddHeader ("Refresh", "3; URL=previousPage.aspx");} &lt;BR&gt;catch(Exception ex){Response.Write(ex.Message); Response.AddHeader ("Refresh", "3; URL=previousPage.aspx");} &lt;BR&gt;finally{con.Close();} &lt;BR&gt;} &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;The above discussed practice can be customised as per the requirements. The authentication and authorisation routines can be put into operation by retrieving the user information from the session or other state maintenance utility. &lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Sumit Amar&lt;/STRONG&gt; &lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425963" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.msdn.com/samar/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Selecting XML nodes defined with namespaces</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425970.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425970.aspx</id><published>2005-06-07T01:56:00Z</published><updated>2005-06-07T01:56:00Z</updated><content type="html">&lt;BLOCKQUOTE class=postBody&gt;While isolating nodes with custom namespace definition, it might be problematic to retrieve the nodes using XPath (SelectSingleNode or SelectNodes methods). Because if the target XML document contains a URN prefix in the node, that has to be defined and explicitly and specified in the SelectSingleNode call. Here is the way to get it into work. &lt;BR&gt;&lt;BR&gt;XmlNamespaceManager nsmgr=null; //Declare Namespace manager to track all URNs and prefixes used in target document. &lt;BR&gt;&lt;BR&gt;try &lt;BR&gt;{ &lt;BR&gt;nsmgr=new XmlNamespaceManager(xdoc.NameTable); //xdoc contains the returned SOAP envelope if successful &lt;BR&gt;&lt;BR&gt;nsmgr.AddNamespace("prfx", "http://MyURN.com/"); //add entry about the custom prefix &lt;BR&gt;&lt;BR&gt;nsmgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/"); //add entry about default soap prefix available in the SOAP envelope. &lt;BR&gt;&lt;BR&gt;} &lt;BR&gt;catch(NullReferenceException nex){Console.WriteLine(nex.Message);} //In case the XML doc wasn’t accessible &lt;BR&gt;&lt;BR&gt;XmlNode result = xdoc.SelectSingleNode("//prfx:Operation",nsmgr); //result will now contain the prfx:Operation element or attribute as the case may be. &lt;BR&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425970" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author></entry><entry><title>HTA (HyperText Applications): Caveats and Features</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/samar/archive/2005/06/07/425965.aspx" /><id>http://blogs.msdn.com/samar/archive/2005/06/07/425965.aspx</id><published>2005-06-07T01:53:00Z</published><updated>2005-06-07T01:53:00Z</updated><content type="html">&lt;BLOCKQUOTE class=postBody&gt;Caveats: &lt;BR&gt;1. Security: HTAs bypass the Internet Explorer's advanced settings to disable/enable active scripting, which leads to vulnerability in system to malfunction. However, since the HTAs interact with local system (using ActiveXObjects) for file/DB manipulation, the caveat is limited to the user's system. Also because browser doesn't come into picture for HTAs, use of SSL is not taken into consideration, unless the HTA is loaded with a remote frame (which perhaps defeats the purpose of HTA). &lt;BR&gt;2. Icon: Individual HTA can not be associated with *an icon, if it's modified the icon takes over for all the HTAs in the system. However an icon can be put in the control menu of the title bar. &lt;BR&gt;3. Porting: HTAs may NOT be transferred through email, because most of the antivirus systems consider HTAs as scripts that contain malicious code. It is so, because of HTAs' capabilities to have full control on system's file system (where they are being kept). &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Features: &lt;BR&gt;1. File System: HTAs provide strong file manipulation capabilities. VBScript users can make use Scripting.FileSystemObject in CreateObject method while J/avaScript users may instantiate ActiveXObject with the same component name to control file system. &lt;BR&gt;2. WSH Support: HTAs are open to make use of Windows Scripting Host just as the direct VBS or JS files would. Common WSH operations (WScript.Shell) include Reading/writing file system, windows registry and devices (In case of WMI). Other WSH operations (WScript.Network) include Reading network information and mapping drives etc. &lt;BR&gt;3. DB Access: HTAs can manipulate databases using SQLOLEDB or OLEDB Jet interfaces for almost all databases and text files (using text/csv drivers). &lt;BR&gt;4. MS Office: HTAs can make use of COM to manipulate MS Office documents such as Excel, Word, Outlook. Manipulations include porting and formatting data, charts and images etc. &lt;BR&gt;5. FTP Access: Seem less FTP Support is provided. &lt;BR&gt;6. Splash Screen: HTA can be used to display a splash screen for few seconds while the whole application loads. &lt;BR&gt;7. Context Menus: Regulation right click context menu (as appears in IE) can be disabled in HTA and a custom context menu can be displayed instead. &lt;BR&gt;8. HTA:Application: element allows us to customise the HTA application, customisation includes setting/unsetting/modifying a control/sys menu, border specifications, icon, version, title/caption bar, scrolling, context menu and others. Making it all very handy. &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&amp;lt;HTA:APPLICATION &lt;BR&gt;ID = "objApp" &lt;BR&gt;APPLICATIONNAME = "HTA App Name" &lt;BR&gt;BORDER = "thick" &lt;BR&gt;CAPTION = "yes" &lt;BR&gt;ICON = "any.ico" &lt;BR&gt;SHOWINTASKBAR = "yes" &lt;BR&gt;SINGLEINSTANCE = "yes" &lt;BR&gt;SYSMENU = "yes" &lt;BR&gt;WINDOWSTATE = "normal" &lt;BR&gt;SCROLL = "yes" &lt;BR&gt;SCROLLFLAT = "yes" &lt;BR&gt;VERSION = "1.0" &lt;BR&gt;INNERBORDER = "yes" &lt;BR&gt;SELECTION = "no" &lt;BR&gt;MAXIMIZEBUTTON = "yes" &lt;BR&gt;MINIMIZEBUTTON = "yes" &lt;BR&gt;NAVIGABLE = "yes" &lt;BR&gt;CONTEXTMENU = "yes" &lt;BR&gt;BORDERSTYLE = "normal" &lt;BR&gt;&amp;gt; &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;As you can see above, the HTA:Application element is an empty element and contains numerous useful attributes. Most of the attributes are self-explanatory. Setting SCROLLFLAT to true causes HTAs use Internet Explorer style of flat scrollbars. Elements, like frames, that have their own scrollbars inherit this style. For normal scrollbars this attribute can be set to false. ID objApp can be used in scripting language to manipulate the attributes etc. &lt;BR&gt;&lt;BR&gt;Icon appears in the control/sys bar or the application. SINGLEINSTANCE will not allow users to spawn another window if one is already open. CAPTION, BORDER and INNERBORDER can be reset to create a splash screen like window. &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Sumit Amar&lt;/STRONG&gt; &lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=425965" width="1" height="1"&gt;</content><author><name>samar</name><uri>http://blogs.msdn.com/members/samar.aspx</uri></author></entry></feed>