<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8708580038372285785</id><updated>2024-09-08T23:58:51.725+05:30</updated><title type='text'>SHAWINDER SEKHON</title><subtitle type='html'>.NET/PHP/ColdFusion Web Developer</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-7378373874405369156</id><published>2008-09-23T15:30:00.003+05:30</published><updated>2011-02-12T09:33:03.164+05:30</updated><title type='text'>DYNAMIC IFRAME HEIGHT</title><content type='html'>Following code sample is taken from dynmaicdrive.com to get rid of IFRAME scrollbars. It will also adjust the Frame height automatically&lt;br /&gt;&lt;br /&gt;/***********************************************&lt;br /&gt;* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)&lt;br /&gt;* Visit DynamicDrive.com for hundreds of original DHTML scripts&lt;br /&gt;* This notice must stay intact for legal use&lt;br /&gt;***********************************************/&lt;br /&gt;&lt;br /&gt;//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:&lt;br /&gt;//Separate each ID with a comma. Examples: [&quot;myframe1&quot;, &quot;myframe2&quot;] or [&quot;myframe&quot;] or [] for none:&lt;br /&gt;var iframeids=[&quot;IFReports&quot;]&lt;br /&gt;&lt;br /&gt;//Should script hide iframe from browsers that don&#39;t support this script (non IE5+/NS6+ browsers. Recommended):&lt;br /&gt;var iframehide=&quot;yes&quot;&lt;br /&gt;&lt;br /&gt;var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf(&quot;Firefox&quot;)).split(&quot;/&quot;)[1]&lt;br /&gt;var FFextraHeight=parseFloat(getFFVersion)&gt;=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers&lt;br /&gt;&lt;br /&gt;function resizeCaller() {&lt;br /&gt;var dyniframe=new Array()&lt;br /&gt;for (i=0; i&lt;iframeids.length;&gt;&lt;br /&gt;if (document.getElementById)&lt;br /&gt;resizeIframe(iframeids[i])&lt;br /&gt;//reveal iframe for lower end browsers? (see var above):&lt;br /&gt;if ((document.all || document.getElementById) &amp;amp;&amp;amp; iframehide==&quot;no&quot;){&lt;br /&gt;var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])&lt;br /&gt;tempobj.style.display=&quot;block&quot;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function resizeIframe(frameid){&lt;br /&gt;var currentfr=document.getElementById(frameid)&lt;br /&gt;if (currentfr &amp;amp;&amp;amp; !window.opera){&lt;br /&gt;currentfr.style.display=&quot;block&quot;&lt;br /&gt;if (currentfr.contentDocument &amp;amp;&amp;amp; currentfr.contentDocument.body.offsetHeight) //ns6 syntax&lt;br /&gt;currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;&lt;br /&gt;else if (currentfr.Document &amp;amp;&amp;amp; currentfr.Document.body.scrollHeight) //ie5+ syntax&lt;br /&gt;currentfr.height = currentfr.Document.body.scrollHeight;&lt;br /&gt;if (currentfr.addEventListener)&lt;br /&gt;currentfr.addEventListener(&quot;load&quot;, readjustIframe, false)&lt;br /&gt;else if (currentfr.attachEvent){&lt;br /&gt;currentfr.detachEvent(&quot;onload&quot;, readjustIframe) // Bug fix line&lt;br /&gt;currentfr.attachEvent(&quot;onload&quot;, readjustIframe)&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function readjustIframe(loadevt) {&lt;br /&gt;var crossevt=(window.event)? event : loadevt&lt;br /&gt;var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement&lt;br /&gt;if (iframeroot)&lt;br /&gt;resizeIframe(iframeroot.id);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function loadintoIframe(iframeid, url){&lt;br /&gt;if (document.getElementById)&lt;br /&gt;document.getElementById(iframeid).src=url&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (window.addEventListener)&lt;br /&gt;window.addEventListener(&quot;load&quot;, resizeCaller, false)&lt;br /&gt;else if (window.attachEvent)&lt;br /&gt;window.attachEvent(&quot;onload&quot;, resizeCaller)&lt;br /&gt;else&lt;br /&gt;window.onload=resizeCaller&lt;/iframeids.length;&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/7378373874405369156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/7378373874405369156' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/7378373874405369156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/7378373874405369156'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/09/dynamic-iframe-height.html' title='DYNAMIC IFRAME HEIGHT'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-4132143553740593630</id><published>2008-09-23T15:17:00.005+05:30</published><updated>2008-09-23T16:09:09.802+05:30</updated><title type='text'>ReportViewer Height + Scrollbars</title><content type='html'>&lt;p style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;If the output is mushed height-wise, add this to the ReportServices.css  file which can be located under ReportManager/styles:&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt; /&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana;font-size:85%;color:#008000;&quot;  &gt;* Fix report IFRAME height for Firefox  */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;.DocMapAndReportFrame&lt;br /&gt;{&lt;br /&gt;    min-height:  860px;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;}&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;br /&gt;Following code uses javascript to get rid of multiple scrollbars in VS2005 reportviewer control&lt;br /&gt;&lt;br /&gt;   window.onload=function RemoveScrollbars()&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       document.getElementById(&quot;&lt;%=ReportViewer1.ClientID %&gt;&quot;).lastChild.firstChild.style.overflow = &quot;visible&quot;;&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;         &amp;lt;rsweb:ReportViewer&lt;br /&gt;&lt;br /&gt;           ID=&quot;ReportViewer1&quot;&lt;br /&gt;&lt;br /&gt;           runat=&quot;server&quot;&lt;br /&gt;&lt;br /&gt;           ProcessingMode=&quot;Remote&quot;&lt;br /&gt;&lt;br /&gt;           AsyncRendering=&quot;false&quot;&lt;br /&gt;&lt;br /&gt;           SizeToReportContent=&quot;true&quot; /&amp;gt;  &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/4132143553740593630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/4132143553740593630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/4132143553740593630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/4132143553740593630'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/09/reportviewer-height-scrollbars.html' title='ReportViewer Height + Scrollbars'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-1618224192407522359</id><published>2008-09-03T10:39:00.001+05:30</published><updated>2008-09-03T18:36:51.253+05:30</updated><title type='text'>Journey From NDoc To SandCastle</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://davidhayden.com/blog/dave/archive/2004/05/17/257.aspx&quot;&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;NDoc&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt; was Source Forge tool for generating MSDN style documentation based on XML comments in your  .NET 1.0 or 1.1 code. Now with the evolution of 2.0 XML Comments with &quot;///&quot; no revised NDoc version is available till date.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Microsoft has stepped in an provided SandCastle,  which allows you to generate documentation and help files based on your .NET 2.0  code. It is still in CTP, but has the following features:&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;“Sandcastle produces accurate, MSDN style,  comprehensive documentation by reflecting over the source assemblies and  optionally integrating XML Documentation Comments. Sandcastle has the following  key features:&lt;/span&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Works with or without authored comments&lt;/span&gt;  &lt;/li&gt;&lt;li&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Supports Generics and .NET Framework 2.0&lt;/span&gt;  &lt;/li&gt;&lt;li&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Sandcastle has 2 main components (MrefBuilder and  Build Assembler)&lt;/span&gt;  &lt;/li&gt;&lt;li&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;MrefBuilder generates reflection xml file for  Build Assembler&lt;/span&gt;  &lt;/li&gt;&lt;li&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Build Assembler includes syntax generation,  transformation..etc&lt;/span&gt;  &lt;/li&gt;&lt;li&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Sandcastle is used internally to build .Net  Framework documentation“&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;You can download SandCastle &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyId=E82EA71D-DA89-42EE-A715-696E3A4873B2&amp;amp;displaylang=en&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Following resources can provide you additional information about Sandcastle:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.codeplex.com/Wiki/View.aspx?ProjectName=SandCastleHelper&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Sandcastle Helper&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/sandcastle/archive/2006/07/30/683352.aspx&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;FAQ&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt; &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.codeplex.com/Wiki/View.aspx?ProjectName=SandcastleAddIn&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;;font-family:Verdana;font-size:85%;&quot;  &gt;Sandcastle Visual Studio 2005  Add-In&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h2&gt;Creating a Chm build using Sandcastle&lt;/h2&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-weight: normal; font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Here  are the steps to create a Chm build using Sandcastle. Please see the atatchment  for the steps in text format.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;h3 style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/h3&gt; &lt;h3 style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Prerequisites:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/h3&gt; &lt;h3 style=&quot;margin: 0in 0in 0pt 0.5in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-weight: normal; font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;1.     &lt;/span&gt;&lt;span style=&quot;font-weight: normal; font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;.Net  Framework 2.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt; &lt;h3 style=&quot;margin: 0in 0in 0pt 0.5in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-weight: normal; font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;2.     &lt;/span&gt;&lt;span style=&quot;font-weight: normal; font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;For  Chm generation download HTML Help Workshop - &lt;a href=&quot;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp&quot; mce_href=&quot;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp&quot;&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt; &lt;h3 style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/h3&gt; &lt;h3 style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt; &lt;h3 style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;How do Reference  Build From /// Comments using Sandcastle V2.0:&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Sandcastle can read  authored triple-slash comments embedded in source files.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Sandcastle by    default is installed at c:\Program files\Sandcastle. Open a command prompt and    type the following: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 8pt; font-family: &#39;MS Reference Serif&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;cd \Program  Files\Sandcastle\Examples\Sandcastle &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;In this directory,  you will find only a single C# file called test.cs under Examples\sandcastle  directory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;2&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Begin by compiling    the C# file and extracting the /// comments.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;csc /t:library  /doc:comments.xml test.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;3&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;This creates not    only test.dll, but also comments.xml file that contains the extracted ///    comments&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;4&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Next, run    MRefBuilder:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;MRefBuilder test.dll  /out:reflection.org&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;5&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Transform the    output&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0.5in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;For building using  VS2005 transforms please use the following:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0.5in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;em&gt;&lt;strong&gt;X&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;em&gt;&lt;strong&gt;slTransform  /xsl:&quot;..\..\ProductionTransforms\ApplyVSDocModel.xsl&quot; reflection.org  /xsl:&quot;..\..\ProductionTransforms\AddFriendlyFilenames.xsl&quot;  /out:reflection.xml&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;For building using  prototype transforms please use the following&lt;/span&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0.5in 0pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;/span&gt;&lt;em&gt;XslTransform  /xsl:..\..\ProductionTransforms\ApplyPrototypeDocModel.xsl reflection.org  /xsl:..\..\ProductionTransforms\AddGuidFilenames.xsl  /out:reflection.xml&lt;/em&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;6&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Generate a topic    manifest&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;XslTransform  /xsl:..\..\ProductionTransforms\ReflectionToManifest.xsl&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;reflection.xml /out:manifest.&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot; lang=&quot;FR&quot;&gt;xml&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot; lang=&quot;FR&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;7&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Create an output    directory structure&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;For building using  VS2005 transforms please use the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;call  ..\..\Presentation\vs2005\copyOutput.bat&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;For building using  prototype transforms please use the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;call  ..\..\Presentation\Prototype\copyOutput.bat&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;8&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Run BuildAssembler    using the sandcastle component stack (&lt;strong&gt;&lt;span style=&quot;font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Note:&lt;/span&gt;&lt;/strong&gt; We are    providing &lt;em&gt;&lt;b&gt;&lt;span style=&quot;font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;VS 2005    transforms&lt;/span&gt;&lt;/b&gt;&lt;/em&gt; under Presentation/VS2005 folder and the transforms    shipped with the previous versions under Presentation/Prototype folder. For    building VS2005 format please use sandcastle.config file from C:\Program    Files\Sandcastle\Presentation\vs2005\Configuration folder as it uses shared    content from C:\Program Files\Sandcastle\Presentation\vs2005\Content and    transforms from C:\Program    Files\Sandcastle\Presentation\vs2005\Transforms)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;BuildAssembler  /config:sandcastle.config manifest.xml&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;to generate topic  files in HTM.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;9&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Generate HTML help    project&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;XslTransform  /xsl:..\..\ProductionTransforms\ReflectionToChmProject.xsl reflection.xml  /out:Output\test.hhp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;10&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Generate    intermediate table of contents &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;For building using  VS2005 transforms please use the following:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;strong&gt;&lt;em&gt;XslTransform  /xsl:..\..\ProductionTransforms\createvstoc.xsl reflection.xml  /out:toc.xml&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;For building using  prototype transforms please use the  following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;XslTransform  /xsl:..\..\ProductionTransforms\createPrototypetoc.xsl reflection.xml  /out:toc.xml&lt;/em&gt;&lt;/strong&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;11&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;Generate HTML    help project information&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;XslTransform  /xsl:..\..\ProductionTransforms\TocToChmContents.xsl toc.xml  /out:Output\test.hhc&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt; &lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;XslTransform  /xsl:..\..\ProductionTransforms\ReflectionToChmIndex.xsl reflection.xml  /out:Output\test.hhk&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style=&quot;margin-top: 0in;&quot; start=&quot;12&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;Run hhc (HTML Help    1.x Compiler) to generate Chm, hhc compiles the Sandcastle target files into a    CHM file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt 0.5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;em&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &#39;Lucida Sans Unicode&#39;;&quot;&gt;hhc  output\test.hhp&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/1618224192407522359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/1618224192407522359' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/1618224192407522359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/1618224192407522359'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/09/journey-from-ndoc-to-sandcastle.html' title='Journey From NDoc To SandCastle'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-8906110183859852747</id><published>2008-08-12T22:35:00.001+05:30</published><updated>2008-08-12T22:40:40.794+05:30</updated><title type='text'>Securing Web Services With Username and Password</title><content type='html'>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;keithelder&#39;s Blog.......&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The article is short and doesn&#39;t give any  examples of one of the methods I use a lot.  I thought I would  elaborate on one of the topics it touches on which is securing a web service  with a Username and a Password.  While there are other ways to secure web  services I find this particular method works really well when dealing with  internal systems that may not speak .Net.  It is also simple to implement  on both sides.  These systems could be in Java, PHP or even 4GL.  If  you are a .Net developer and want to secure a web service with a username,  password, or even other information, here is what you need to get going.&lt;/span&gt; &lt;h2&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;1.  Create an object that extends SoapHeader&lt;/span&gt;&lt;/h2&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;The first thing you need to do is create an object that extends the  built-in SoapHeader object.   The object can be simple or complex. Add  the tokens you want to authenticate against.  Here is a sample:&lt;/span&gt;&lt;/p&gt; &lt;div    style=&quot;border: 1pt solid windowtext; padding: 0pt; background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:courier new;font-size:10pt;color:black;&quot;&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    1&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;&lt;summary&gt;&lt;/summary&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    2&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; Extends from  SoapHeader and provides a username / password&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    3&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; for web methods that  need authentication.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    4&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    5&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;ServiceAuthHeader&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; : &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;SoapHeader&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    6&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    7&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  Username;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    8&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  Password;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    9&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; }&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;h2&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;2.  Add a property to your service class that uses the class above&lt;/span&gt;&lt;/h2&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;Once you&#39;ve created your base soap header class, add it as a property to  your service class.&lt;/span&gt;&lt;/p&gt; &lt;div    style=&quot;border: 1pt solid windowtext; padding: 0pt; background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:courier new;font-size:10pt;color:black;&quot;&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;    &lt;span style=&quot;font-size:85%;color:green;&quot;&gt;//  SoapHeader for authentication&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;    &lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;ServiceAuthHeader&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; CustomSoapHeader;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;h2&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;3.  Attribute the method you want to secure&lt;/span&gt;&lt;/h2&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;Add the SoapHeader attribute to each or certain methods you wish to  secure pass in the name of the property that is defined as the SoapHeader object  in step 2.&lt;/span&gt;&lt;/p&gt; &lt;div    style=&quot;border: 1pt solid windowtext; padding: 0pt; background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:courier new;font-size:10pt;color:black;&quot;&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    1&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      [&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;WebMethod&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;]&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    2&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      [&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;SoapHeader&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;CustomSoapHeader&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;)]&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    3&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  AddTwoNumbers(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; x, &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; y) &lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    4&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    5&lt;/span&gt;          &lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    6&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; x + y;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    7&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      }&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;h2&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;4.  Create a method to process your SoapHeader for authentication&lt;/span&gt;&lt;/h2&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;The last big step is to create a static method that will take in your custom  soap header class and process it for validation.  The first thing we want  to do is make sure that some type of credentials were passed in the SoapHeader  and that the properties we are looking for are not null.  Finally we want  to validate each property contains the information we are looking for. This  could be read from the web.config file, database, or other places.&lt;/span&gt;&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;div    style=&quot;border: 1pt solid windowtext; padding: 0pt; background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:courier new;font-size:10pt;color:black;&quot;&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    1&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;ServiceAuthHeaderValidation&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    2&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    3&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;&lt;summary&gt;&lt;/summary&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    4&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; Validates the  credentials of the soap header.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    5&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    6&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:gray;&quot;&gt;&lt;returns&gt;&lt;/returns&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    7&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; Validate(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;ServiceAuthHeader&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; soapHeader)&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    8&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    9&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; (soapHeader == &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;)&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   10&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   11&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;NullReferenceException&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;No soap header was specified.&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   12&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          }&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   13&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; (soapHeader.Username ==  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;)&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   14&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   15&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;NullReferenceException&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;Username was not supplied for authentication in  SoapHeader.&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   16&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          }&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   17&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; (soapHeader.Password ==  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;)&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   18&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   19&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;NullReferenceException&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;Password was not supplied for authentication in  SoapHeader.&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   20&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          }&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   21&lt;/span&gt; &lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   22&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; (soapHeader.Username !=  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;myusername&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; || soapHeader.Password != &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;mypassword&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;)&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   23&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   24&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;Please pass  the proper username and password for this service.&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   25&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          }&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   26&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   27&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;     }&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   28&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; }&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;h2&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;5.  Add validation to service method&lt;/span&gt;&lt;/h2&gt; &lt;p&gt; &lt;/p&gt; &lt;div    style=&quot;border: 1pt solid windowtext; padding: 0pt; background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:courier new;font-size:10pt;color:black;&quot;&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    1&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      [&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;WebMethod&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;]&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    2&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      [&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;SoapHeader&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;CustomSoapHeader&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;)]&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    3&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  AddTwoNumbers(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; x, &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; y) &lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    4&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    5&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt;// Test to see if the proper  credentials were passed in.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    6&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;ServiceAuthHeaderValidation&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;.Validate(CustomSoapHeader);&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    7&lt;/span&gt; &lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    8&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:green;&quot;&gt;// If we get this far the user has  been validated.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    9&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; x + y;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   10&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      }&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;That&#39;s it. You now have all the pieces of the puzzle to process a request and  validate the credentials of the calling client via a username and or  password.  If we launch the solution we will see that our XML for our  service has been updated and now contains an XML Node called ServiceAuthHeader  which contains two sub nodes: username, password.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://keithelder.net/blog/images/keithelder_net/blog/WindowsLiveWriter/SecuringWebServicesWithUsernameandPasswo_B306/image%7B0%7D%5B4%5D.png&quot; atomicselection=&quot;true&quot;&gt;&lt;img style=&quot;border-width: 0px;&quot; alt=&quot;&quot; src=&quot;file:///C:/Documents%20and%20Settings/SHAWINDER%20SEKHON/Desktop/WEB_SERVICE_SECURITY/Securing%20Web%20Services%20With%20Username%20and%20Password_files/image%7B0%7D_thumb%5B2%5D.png&quot; border=&quot;0&quot; width=&quot;640&quot; height=&quot;395&quot; /&gt;&lt;/a&gt;&lt;/span&gt; &lt;/p&gt; &lt;h2&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Passing SoapHeader Credentials To Your Service&lt;/span&gt;&lt;/h2&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Now that we have our service secured, we need to now call the service and  pass the credentials expected from a client.  Based on the example  above, once you add a web reference to the service and instantiate the  service in code, the thing you want to look for is a new property of your  service proxy called ServiceAuthHeader. This is converted into a  property called ServiceAuthHeaderValue.  This property needs to  be an instantiation of the ServiceAuthHeader class where you set the  username and password properties.  Here is an example of a console  application calling our service and passing the required information to  authenticate.&lt;/span&gt;&lt;/p&gt; &lt;div    style=&quot;border: 1pt solid windowtext; padding: 0pt; background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:courier new;font-size:10pt;color:black;&quot;&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    1&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; System;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    2&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; System.Collections.Generic;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    3&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; System.Text;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    4&lt;/span&gt; &lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    5&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; ConsoleApplication1&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    6&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    7&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;Program&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    8&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;      {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;    9&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; Main(&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;[]  args)&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   10&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          {&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   11&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              localhost.&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; service = &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; ConsoleApplication1.localhost.&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;();&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   12&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              localhost.&lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;ServiceAuthHeader&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; header = &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;new&lt;/span&gt; ConsoleApplication1.localhost.&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;ServiceAuthHeader&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;();&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   13&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              header.Username = &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;myusername&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   14&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              header.Password = &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:maroon;&quot;&gt;&quot;mypassword&quot;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   15&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              service.ServiceAuthHeaderValue =  header;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   16&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; x =  service.AddTwoNumbers(1, 1);&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   17&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;.WriteLine(x);&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   18&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;              &lt;/span&gt;&lt;span style=&quot;font-size:85%;color:teal;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;.ReadLine();&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   19&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;          }&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   20&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;     }&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-size:85%;&quot; &gt;   21&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; }&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt; The return result will be 2 of course and from the client side it is  rather trivial to pass the credentials as you see.   That&#39;s  it.   Happy authenticating!&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;strong&gt;[Related Link]&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;To take authenticating one step  further with a custom SoapExtension read this follow up article.&lt;br /&gt;&lt;/strong&gt;&lt;a href=&quot;http://keithelder.net/blog/archive/2007/01/09/Take-Securing-Web-Services-With-Username-and-Password-One-Step.aspx&quot;&gt;http://keithelder.net/blog/archive/2007/01/09/Take-Securing-Web-Services-With-Username-and-Password-One-Step.aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/8906110183859852747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/8906110183859852747' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/8906110183859852747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/8906110183859852747'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/08/securing-web-services-with-username-and.html' title='Securing Web Services With Username and Password'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-3218528535651318488</id><published>2008-08-12T14:09:00.000+05:30</published><updated>2008-08-12T14:15:26.869+05:30</updated><title type='text'>Error 8152: &quot;String or binary data would be truncated&quot;</title><content type='html'>&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;Following could be the possible reasons:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;This error usually comes because of incorrect length of table fields.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;1. check if there are triggers on the table, if so, you should check out the code of those as well. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;2. Check field length of your table and any foreign key tables if exist&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/3218528535651318488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/3218528535651318488' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/3218528535651318488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/3218528535651318488'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/08/error-8152-string-or-binary-data-would.html' title='Error 8152: &quot;String or binary data would be truncated&quot;'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-2573559533056618190</id><published>2008-08-10T20:13:00.000+05:30</published><updated>2008-08-10T20:17:51.069+05:30</updated><title type='text'>Merging New Rows to an Existing DataSet</title><content type='html'>&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;We can merge new records to an existing fillled dataset. Following is the example code:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#009900;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;&lt;span style=&quot;color:#009900;&quot;&gt;//Existing Dataset&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;DataSet ds = code to fill dataset;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;DataTable dt = reports.Tables[0];&lt;br /&gt;foreach (DataRow dr in dt.Rows)&lt;br /&gt;{&lt;br /&gt;DataRow newRow = ds.Tables[0].NewRow();&lt;br /&gt;newRow[&quot;name&quot;] = dr[&quot;DisplayName&quot;];&lt;br /&gt;newRow[&quot;path&quot;] = dr[&quot;ID&quot;];&lt;br /&gt;newRow[&quot;rolename&quot;] = dr[&quot;Roles&quot;];&lt;br /&gt;newRow[&quot;username&quot;] = HttpContext.Current.User.Identity.Name.ToString();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;&lt;span style=&quot;color:#009900;&quot;&gt;//Appending newly generated row to existing table in the dataset&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;ds.Tables[0].Rows.Add(newRow);&lt;br /&gt;}&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/2573559533056618190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/2573559533056618190' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/2573559533056618190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/2573559533056618190'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/08/merging-new-rows-to-existing-dataset.html' title='Merging New Rows to an Existing DataSet'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-305809756591695964</id><published>2008-08-07T18:24:00.000+05:30</published><updated>2008-08-07T21:02:40.193+05:30</updated><title type='text'>C# Dynamic object instantiation and Method Calls</title><content type='html'>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Following is the code to load any assembly and reading its classes to make dynamic instances out of them. You can further call the dynamic methods as well.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;//Loading an assembly&lt;/span&gt;&lt;br /&gt;Assembly objAssembly = Assembly.LoadFrom(Server.MapPath(@&quot;bin\test.dll&quot;)); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;//Getting list of all types in a the assembly&lt;/span&gt;&lt;br /&gt;Type[] type = objAssembly.GetTypes();&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;// You can also define a typename if that is already known&lt;br /&gt;//Type t = objAssembly.GetType(&quot;testnamespace.testclass&quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;//********************************************************&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;//Making Instance of object by passing a particular type&lt;/span&gt;&lt;br /&gt;object newInstance = Activator.CreateInstance(type[0]);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;//Calling the method of the newly created instance by using type name&lt;/span&gt;&lt;br /&gt;string str = (string)type[0].GetMethod(&quot;testmethod&quot;).Invoke(newInstance, null);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;&lt;strong&gt;Your test.dll will look something like this.....&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;namespace testnamespace&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;public class testclass &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;public static string testmethod() &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;return &quot;hello&quot;; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/305809756591695964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/305809756591695964' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/305809756591695964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/305809756591695964'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/08/c-dynamic-object-instantiation-and.html' title='C# Dynamic object instantiation and Method Calls'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-583592965716499579</id><published>2008-08-02T21:27:00.002+05:30</published><updated>2008-10-16T01:24:51.742+05:30</updated><title type='text'>Using ReportViewer control with SQL Server 2005 Reporting Services  Custom Security Extension</title><content type='html'>&lt;h2&gt;Russell&#39;s Blog&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;I&#39;ve been playing around with using different forms of authentication / impersonation with the Report Viewer controls, and I thought I&#39;d post the fruits of my efforts. Here we go:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;Using Forms Authentication with the &lt;strong&gt;Winform Report Viewer&lt;/strong&gt; control is easy -- Just pass in the creds and you&#39;re all done:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;reportViewer1.ServerReport.ReportServerCredentials.SetFormsCredentials(null, &quot;userName&quot;, &quot;password&quot;, &quot;domainName&quot;);&lt;br /&gt;this.reportViewer1.RefreshReport();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;Doing the same thing with the &lt;strong&gt;Webform Report Viewer&lt;/strong&gt; control is kind of a pain in the tail. You actually have to implement an interface called &lt;strong&gt;IReportServerCredentials&lt;/strong&gt; and write/borrow another subclass that handles all the cookie related stuff when dealing with Forms Auth.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;I took most of the following code from the following help topic, btw:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials.aspx&quot;&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials.aspx&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;&lt;br /&gt;Anyway, first create the code for your Forms Auth Login page:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;MyReportingService svc = new MyReportingService();&lt;br /&gt;svc.Url = &quot;&lt;/span&gt;&lt;a href=&quot;http://myserver/reportserver/reportexecution2005.asmx&quot;&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;http://myServer/reportserver/reportexecution2005.asmx&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;&quot;;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;svc.LogonUser(&quot;myUserName&quot;, &quot;MyPassword&quot;, null);&lt;br /&gt;Cookie myAuthCookie = svc.AuthCookie;&lt;br /&gt;if (myAuthCookie == null)&lt;br /&gt;{&lt;br /&gt;Message.Text = &quot;Logon failed&quot;;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;HttpCookie cookie = new HttpCookie(myAuthCookie.Name, myAuthCookie.Value);&lt;br /&gt;Response.Cookies.Add(cookie);&lt;br /&gt;string returnUrl = Request.QueryString[&quot;ReturnUrl&quot;];&lt;br /&gt;if (returnUrl == null !returnUrl.StartsWith(&quot;/&quot;))&lt;br /&gt;Message.Text = &quot;Return url is missing or invalid!&quot;;&lt;br /&gt;else&lt;br /&gt;Response.Redirect(&quot;&lt;/span&gt;&lt;a href=&quot;http://myserver/appFolder/default.aspx&quot;&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;http://myServer/appFolder/default.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;&quot;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;Message.Text = &quot;Logon failed: &quot; + ex.Message;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;The code above calls &lt;strong&gt;LogonUser()&lt;/strong&gt; against the SSRS web service so that we can get the Forms Auth cookie back from SSRS itself. Then, we stick the cookie into Response.Cookies, and forward the user to a page which has a ReportViewer control on it (in this case, &lt;/span&gt;&lt;a href=&quot;http://myserver/appFolder/default.aspx&quot;&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;http://myServer/appFolder/default.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;OK, so now we&#39;re sitting on the page which has the Report Viewer control itself. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;In Page_Load, we first see if the previous cookie exists...if it doesn&#39;t, we send you right back to the logon form:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;HttpCookie cookie = Request.Cookies[&quot;sqlAuthCookie&quot;];&lt;br /&gt;if (cookie == null)&lt;br /&gt;{&lt;br /&gt;Response.Redirect(&quot;/appFolder/logon.aspx?ReturnUrl=&quot; + HttpUtility.UrlEncode(Request.RawUrl));&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;ReportViewer1.ProcessingMode = ProcessingMode.Remote;&lt;br /&gt;ReportViewer1.ServerReport.ReportServerUrl = new Uri(&quot;&lt;/span&gt;&lt;a href=&quot;http://myserver/reportserver&quot;&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;http://myServer/reportserver&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;&quot;);&lt;br /&gt;ReportViewer1.ServerReport.ReportPath = &quot;/Report Project2/Report1&quot;;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;Cookie authCookie = new Cookie(cookie.Name, cookie.Value);&lt;br /&gt;authCookie.Domain = &quot;myServer&quot;;&lt;br /&gt;ReportViewer1.ServerReport.ReportServerCredentials =&lt;br /&gt;new MyReportServerCredentials(authCookie);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;If the cookie IS there, we set a few properties on the Report Viewer control, then set the &lt;strong&gt;ReportServerCredentials&lt;/strong&gt; property of the control equal to our authCookie. Here is where the implementation of &lt;strong&gt;IReportServerCredentials&lt;/strong&gt; and that other &quot;cookie-handling class&quot; come in.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;First, here&#39;s the implementation of IReportServerCredentials. It allows us to create a &lt;strong&gt;MyReportServerCredentials&lt;/strong&gt; object:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;class MyReportServerCredentials : IReportServerCredentials&lt;br /&gt;{&lt;br /&gt;private Cookie m_authCookie;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;public MyReportServerCredentials(Cookie authCookie)&lt;br /&gt;{&lt;br /&gt;m_authCookie = authCookie;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;public WindowsIdentity ImpersonationUser&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return null; // Use default identity.&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;public ICredentials NetworkCredentials&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return null; // Not using NetworkCredentials to authenticate.&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;public bool GetFormsCredentials(out Cookie authCookie,&lt;br /&gt;out string user, out string password, out string authority)&lt;br /&gt;{&lt;br /&gt;authCookie = m_authCookie;&lt;br /&gt;user = password = authority = null;&lt;br /&gt;return true; // Use forms credentials to authenticate.&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;As I mentioned earlier, we also have to subclass the myServer.ReportExecutionService class and override a few methods in order to do the cookie-related work:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;public class MyReportingService : myServer.ReportExecutionService&lt;br /&gt;{&lt;br /&gt;private Cookie m_authCookie;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;public Cookie AuthCookie&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return m_authCookie;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;protected override WebRequest GetWebRequest(Uri uri)&lt;br /&gt;{&lt;br /&gt;HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);&lt;br /&gt;request.Credentials = base.Credentials;&lt;br /&gt;request.CookieContainer = new CookieContainer();&lt;br /&gt;if (m_authCookie != null)&lt;br /&gt;request.CookieContainer.Add(m_authCookie);&lt;br /&gt;return request;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;protected override WebResponse GetWebResponse(WebRequest request)&lt;br /&gt;{&lt;br /&gt;WebResponse response = base.GetWebResponse(request);&lt;br /&gt;string cookieName = response.Headers[&quot;RSAuthenticationHeader&quot;];&lt;br /&gt;if (cookieName != null)&lt;br /&gt;{&lt;br /&gt;HttpWebResponse webResponse = (HttpWebResponse)response;&lt;br /&gt;m_authCookie = webResponse.Cookies[cookieName];&lt;br /&gt;}&lt;br /&gt;return response;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Parameters can also be passed to ReportViewer and we can also Show/Hide them as needed:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;Cookie authCookie = new Cookie(cookie.Name, cookie.Value);&lt;br /&gt;authCookie.Domain = ConfigurationManager.AppSettings[&quot;serverName&quot;].ToString();&lt;br /&gt;reportViewer1.ServerReport.ReportServerCredentials = new MyReportServerCredentials(authCookie);&lt;br /&gt;//Checking available parameter list&lt;br /&gt;ReportParameterInfoCollection rparams = reportViewer1.ServerReport.GetParameters();&lt;br /&gt;List&lt;microsoft.reporting.webforms.reportparameter&gt; paramList = new List&lt;microsoft.reporting.webforms.reportparameter&gt;();&lt;br /&gt;//Hide parameters if user is External user i.e not Internal&lt;br /&gt;if (isClientID != &quot;false&quot;)&lt;br /&gt;{&lt;br /&gt;foreach (ReportParameterInfo rpinfo in rparams)&lt;br /&gt;{&lt;br /&gt;switch (rpinfo.Name)&lt;br /&gt;{&lt;br /&gt;case &quot;ClientID&quot;:&lt;br /&gt;paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter(&quot;ClientID&quot;, isClientID, false));&lt;br /&gt;break;&lt;br /&gt;case &quot;IsExported&quot;:&lt;br /&gt;paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter(&quot;IsExported&quot;,&quot;true&quot;, false));&lt;br /&gt;break;&lt;br /&gt;case &quot;ServerType&quot;:&lt;br /&gt;paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter(&quot;ServerType&quot;, &quot;true&quot;, false));&lt;br /&gt;break;&lt;br /&gt;case &quot;IsReleased&quot;:&lt;br /&gt;paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter(&quot;IsReleased&quot;, &quot;true&quot;, false));&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;this.reportViewer1.ServerReport.SetParameters(paramList);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;span style=&quot;font-family:Arial;&quot;&gt;...and that&#39;s it. You may actually have better luck using the URL at the top of the page for your code copying and pasting as it contains HTML you can use for you logon page, too.&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:&#39;Courier New&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;span style=&quot;font-family:Arial;&quot;&gt;My biggest problem with this whole scenario was actually *finding* the help topic I needed...It would have nice if I could have searched on &quot;forms authentication report viewer control&quot; and been directed to the topic in question (grump, grump).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/583592965716499579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/583592965716499579' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/583592965716499579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/583592965716499579'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/08/using-reportviewer-control-with-sql.html' title='Using ReportViewer control with SQL Server 2005 Reporting Services  Custom Security Extension'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8708580038372285785.post-5702482147360083116</id><published>2008-08-02T21:18:00.010+05:30</published><updated>2008-10-12T13:12:12.909+05:30</updated><title type='text'>Forms Authentication in SQL Server 2005 Reporting Services</title><content type='html'>&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;Form authentication extension can be easily implemented. Here&#39;s how...&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms160724.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/ms160724.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can find all the extensions for RS2005 at &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms160911.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/ms160911.aspx&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;So once you have sample projects then you need to compile it and get the required custom security dll.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;Above output dll needs to be placed at two places.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;1. &amp;lt;system-drive&gt;&lt;system&gt;:/&amp;lt;path to reportingservices&gt;&lt;path&gt;/reportserver/bin&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;2. &amp;lt;system-drive&gt;:/&amp;lt;path to reportingservices&gt;&lt;path&gt;/reportmanager/bin&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;you also need to place two .aspx files for creating cutom interface in reporting services. These two files should be placed as following:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;1. &amp;lt;system-drive&gt;:/&amp;lt;path to reportingservices&gt;&lt;path&gt;/reportserver/logon.aspx&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;2. &amp;lt;system-drive&gt;:/&amp;lt;path to reportingservices&gt;&lt;path&gt;/reportmanager/pages/UILogon.aspx&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;After placing above files at desired locations. We need to edit RS configuration files to make them start using our custom dll extension. These editings should be done at both ReportServer and ReportManager as follows:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;color:#ff0000;&quot;&gt;Important : Dont forget to take backup of all config files before making changes. Otherwise in case of errors, RS will be corrupt and you need to re-install reporting services&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;- Report Server&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;1. rsreportserver.config&lt;/span&gt;&lt;br /&gt;- &lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;your custom report server url should be given with &lt;machine-name&gt;instead of &#39;localhost&#39;:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;color:#009900;&quot;&gt;&lt;urlroot&gt;http://&lt;span style=&quot;color:#ff0000;&quot;&gt;EXTREME-MACHINE&lt;/span&gt;/ReportServer&lt;/urlroot&gt;&lt;/span&gt;&lt;br /&gt;- &lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;Authentication and Authorization should be modified as :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:#009900;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;color:#009900;&quot;&gt;&amp;lt;Security&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;security&gt;&lt;extension name=&quot;Forms&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;color:#009900;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;&lt;span style=&quot;font-size:85%;color:#009900;&quot;&gt;&amp;lt;Extension Name=&quot;Forms&quot; Type=&quot;ReportingServices.CustomSecurity.Authorization,ReportingServices.CustomSecurity&quot; &gt;&lt;br /&gt;&amp;lt;Configuration&gt;&lt;br /&gt;&amp;lt;AdminConfiguration&gt;&lt;br /&gt;&amp;lt;UserName&gt;testuser&lt;/username&gt;&lt;br /&gt;&amp;lt;/AdminConfiguration&gt;&lt;br /&gt;&amp;lt;/Configuration&gt;&lt;br /&gt;&amp;lt;/Extension&gt;&lt;br /&gt;&amp;lt;/Security&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;color:#009900;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;&lt;span style=&quot;font-size:85%;color:#009900;&quot;&gt;&lt;br /&gt;&amp;lt;Authentication&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color:#009900;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&amp;lt;Extension Name=&quot;Forms&quot; Type=&quot;ReportingServices.CustomSecurity.AuthenticationExtension, ReportingServices.CustomSecurity&quot;&gt;&lt;br /&gt;&amp;lt;Configuration&gt;&lt;br /&gt;&amp;lt;ConnectionString&gt;server=localhost;user id=sa;password=123;database=BenmarkIS&lt;/connectionstring&gt;&lt;br /&gt;&amp;lt;/Configuration&gt;&lt;br /&gt;&amp;lt;/Extension&gt;&lt;br /&gt;&amp;lt;/Authentication&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;color:#009900;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;2. rssrvpolicy.config&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;span style=&quot;font-size:85%;color:#000000;&quot;&gt;- &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:arial;color:#000000;&quot;&gt;Trust levels should be defined as highlighted:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;color:#009900;&quot;&gt;class=&quot;FirstMatchCodeGroup&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;PermissionSetName=&quot;&lt;span style=&quot;color:#ff0000;&quot;&gt;FullTrust&lt;/span&gt;&quot;&lt;br /&gt;Description=&quot;This code group grants MyComputer code Execution permission. &quot;&gt;&lt;br /&gt;&amp;lt;IMembershipCondition&lt;br /&gt;class=&quot;ZoneMembershipCondition&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;Zone=&quot;MyComputer&quot; /&gt;&lt;br /&gt;&amp;lt;CodeGroup&lt;br /&gt;class=&quot;UnionCodeGroup&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;PermissionSetName=&quot;&lt;span style=&quot;color:#ff0000;&quot;&gt;FullTrust&lt;/span&gt;&quot;&lt;br /&gt;Name=&quot;Microsoft_Strong_Name&quot;&lt;br /&gt;Description=&quot;This code group grants code signed with the Microsoft strong name full trust. &quot;&gt;&lt;br /&gt;&lt;/codegroup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;- &lt;span style=&quot;font-family:arial;&quot;&gt;A new Code Group should be inserted for security extenstion as given:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;font-size:85%;&quot;&gt;&lt;span style=&quot;color:#009900;&quot;&gt;&lt;imembershipcondition class=&quot;UrlMembershipCondition&quot; version=&quot;1&quot; url=&quot;$CodeGen$/*&quot;&gt;&lt;/codegroup&gt;&lt;!--NEW CODE POLICY--&gt;&lt;codegroup class=&quot;UnionCodeGroup&quot; description=&quot;Code group for the sample security extension&quot; name=&quot;SecurityExtensionCodeGroup&quot; version=&quot;1&quot; permissionsetname=&quot;FullTrust&quot;&gt;&lt;imembershipcondition class=&quot;UrlMembershipCondition&quot; version=&quot;1&quot; url=&quot;C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\ReportingServices.CustomSecurity.dll&quot;&gt;&lt;/codegroup&gt;&lt;!--NEW CODE POLICY--&gt;&lt;codegroup class=&quot;UnionCodeGroup&quot; description=&quot;Code group for the sample security extension&quot; name=&quot;SecurityExtensionCodeGroup&quot; version=&quot;1&quot; permissionsetname=&quot;FullTrust&quot;&gt;&lt;imembershipcondition class=&quot;UrlMembershipCondition&quot; version=&quot;1&quot; url=&quot;C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\ReportingServices.CustomSecurity.dll&quot;&gt;&lt;/codegroup&gt;&lt;br /&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&amp;lt;CodeGroup&lt;br /&gt;class=&quot;UnionCodeGroup&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;Name=&quot;SecurityExtensionCodeGroup&quot;&lt;br /&gt;Description=&quot;Code group for the sample security extension&quot;&lt;br /&gt;PermissionSetName=&quot;FullTrust&quot;&gt;&lt;br /&gt;&amp;lt;IMembershipCondition&lt;br /&gt;class=&quot;UrlMembershipCondition&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;Url=&quot;C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\ReportingServices.CustomSecurity.dll&quot;&lt;br /&gt;/&gt;&lt;br /&gt;&amp;lt;/CodeGroup&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;CodeGroup&lt;br /&gt;class=&quot;UnionCodeGroup&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;PermissionSetName=&quot;&lt;span style=&quot;color:#009900;&quot;&gt;FullTrust&lt;/span&gt;&quot;&lt;br /&gt;Name=&quot;SharePoint_Server_Strong_Name&quot;&lt;br /&gt;&lt;codegroup class=&quot;UnionCodeGroup&quot; description=&quot;This code group grants SharePoint Server code full trust. &quot; name=&quot;SharePoint_Server_Strong_Name&quot; version=&quot;1&quot; permissionsetname=&quot;FullTrust&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;3. Web.config&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;- Following highlighted changes should be made:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;authentication mode=&quot;Forms&quot;&gt;&lt;forms path=&quot;/&quot; timeout=&quot;60&quot; name=&quot;sqlAuthCookie&quot; loginurl=&quot;logon.aspx&quot; slidingexpiration=&quot;true&quot;&gt;&lt;/forms&gt;&lt;/authentication&gt;&lt;authorization&gt;&lt;deny users=&quot;?&quot;&gt;&lt;/authorization&gt;&lt;identity impersonate=&quot;false&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-size:85%;color:#009900;&quot;&gt;&amp;lt;authentication mode=&quot;Forms&quot;&gt;&lt;br /&gt;&amp;lt;forms loginUrl=&quot;logon.aspx&quot; name=&quot;sqlAuthCookie&quot; timeout=&quot;60&quot; slidingExpiration=&quot;true&quot; path=&quot;/&quot;&gt;&amp;lt;/forms&gt;&lt;br /&gt;&amp;lt;/authentication&gt;&lt;br /&gt;&amp;lt;authorization&gt;&lt;br /&gt;&amp;lt;deny users=&quot;?&quot; /&gt;&lt;br /&gt;&amp;lt;/authorization&gt;&lt;br /&gt;&amp;lt;identity impersonate=&quot;false&quot; /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;color:#009900;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;- Report Manager&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;1. rsmgrpolicy.config &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;- Trust levels should be changed in rsmgrpolicy.config as highlighted &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;color:#009900;&quot;&gt;class=&quot;FirstMatchCodeGroup&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;PermissionSetName=&quot;&lt;span style=&quot;color:#ff0000;&quot;&gt;FullTrust&lt;/span&gt;&quot;&lt;br /&gt;Description=&quot;This code group grants MyComputer code Execution permission. &quot;&gt;&lt;br /&gt;&amp;lt;IMembershipCondition&lt;br /&gt;class=&quot;ZoneMembershipCondition&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;Zone=&quot;MyComputer&quot; /&gt;&lt;br /&gt;&amp;lt;CodeGroup&lt;br /&gt;class=&quot;UnionCodeGroup&quot;&lt;br /&gt;version=&quot;1&quot;&lt;br /&gt;PermissionSetName=&quot;&lt;span style=&quot;color:#ff0000;&quot;&gt;FullTrust&lt;/span&gt;&quot;&lt;br /&gt;Name=&quot;Microsoft_Strong_Name&quot;&lt;br /&gt;Description=&quot;This code group grants code signed with the Microsoft strong name full trust. &quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;color:#009900;&quot;&gt;&lt;span style=&quot;span: &quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:arial;color:#000000;&quot;&gt;2. RSWebApplication.config&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;span style=&quot;font-family:Arial;font-size:85%;&quot;&gt;- Basic report manager redirection to the custome made .aspx page&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:Arial;&quot;&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;*Note: Use &lt;machine-name&gt;instead of &#39;localhost&#39; in the ReportServerUrl&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ui&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;color:#009900;&quot;&gt;&amp;lt;CustomAuthenticationUI&gt;&lt;br /&gt;&amp;lt;loginUrl&gt;/Pages/UILogon.aspx&amp;lt;/loginUrl&gt;&lt;br /&gt;&amp;lt;UseSSL&gt;False&amp;lt;/UseSSL&gt;&lt;br /&gt;&amp;lt;/CustomAuthenticationUI&gt;&lt;br /&gt;&amp;lt;ReportServerUrl&gt;http://extreme-machine/ReportServer&amp;lt;/ReportServerUrl&gt;&lt;br /&gt;&amp;lt;/UI&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;&quot;&gt;Once you are done with above changes then you need to setup IIS for anonymous access. So in the &#39;security&#39; tab of &#39;reportserver&#39; and &#39;reports&#39; web folders, set security level as &#39;anonymous&#39;. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;&quot;&gt;Here you go, you are done with the settings.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Arial;&quot;&gt;:) Happy Reporting!!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;color:#009900;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;color:#009900;&quot;&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://shawindersekhon.blogspot.com/feeds/5702482147360083116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8708580038372285785/5702482147360083116' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/5702482147360083116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8708580038372285785/posts/default/5702482147360083116'/><link rel='alternate' type='text/html' href='http://shawindersekhon.blogspot.com/2008/08/forms-authentication-in-sql-server-2005.html' title='Forms Authentication in SQL Server 2005 Reporting Services'/><author><name>Shawinder Sekhon</name><uri>http://www.blogger.com/profile/14872283651489736502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx4Zmq2R7hE0stCfxUWlVRiI6SQtvOPJctkwfmO9L1ABxPKOi9Rp4tb0IHGpqevSbN9JRUk04PpgsLJZOGBXTUg-K_rMrffRAzgEHx-VLYD3TSvkYkm_Y2rkMl5TphOA/s220/eagle.jpg'/></author><thr:total>0</thr:total></entry></feed>