<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-5990140650016020298</atom:id><lastBuildDate>Fri, 10 Feb 2012 06:31:44 +0000</lastBuildDate><category>scrolling news</category><category>how to show row number in grid view</category><category>web application</category><category>business intelligence in sql server 2008</category><category>news</category><category>Application Security</category><category>Interview Questions</category><category>signup</category><category>OnError</category><category>user name</category><category>scenario</category><category>not null constraint</category><category>MS SSIS</category><category>BCP with column headers</category><category>MSMQ in dotnet</category><category>blink</category><category>SSIS</category><category>image quality</category><category>datagridview</category><category>how to use silverlight</category><category>mysql stored procedure</category><category>winforms</category><category>media player control</category><category>check user name availability</category><category>error handling</category><category>identity column</category><category>loop through</category><category>example</category><category>generate stored procedure</category><category>how to use query execution plan</category><category>text</category><category>IIS application</category><category>SSIS ontaskfailed</category><category>asp.net</category><category>asp.net tutorials</category><category>error declaring variable</category><category>project design</category><category>T-SQL</category><category>migrate data from multiple tables</category><category>efficient architecture</category><category>how to connect Mysql in SSIS</category><category>SSIS OnError Vs OnTaskFailed</category><category>page refresh</category><category>SQL server 2005</category><category>.Net Tutorial</category><category>SQL Server Integration Services</category><category>Mysql</category><category>SQL query</category><category>Tutorial</category><category>Tutorials</category><category>c#.net project architecture</category><category>BLL</category><category>insert statement with column name and values</category><category>Mysql provider for SSIS</category><category>SSIS error handling</category><category>use common master page</category><category>get value of identity column</category><category>tuning</category><category>asp.net 2.0</category><category>server.transfer</category><category>code</category><category>fast response</category><category>DAL</category><category>mp3 player</category><category>call page method from usercontrol</category><category>application architecture</category><category>.net tutorials</category><category>preserve original url after post back</category><category>SQL Server 2008</category><category>which component to use</category><category>check</category><category>fine tune application</category><category>slow application</category><category>resize image in asp.net 3.5</category><category>scrolling</category><category>which control to use</category><category>UML interview questions</category><category>checkboxlist items</category><category>declare variable</category><category>duplicate rows</category><category>membership provider for mysql</category><category>datagrid</category><category>query execution plan in sql server</category><category>user control</category><category>problem with mysql provider</category><category>CTE</category><category>mozzilla</category><category>row number in gridview</category><category>scrolling text</category><category>move data</category><category>.Net providers for Mysql</category><category>execution plan</category><category>problem</category><category>column headers</category><category>check availability</category><category>SQL</category><category>how to play mp3 songs</category><category>row number in grid view</category><category>implement MSMQ</category><category>intervie questions UML</category><category>post back problem</category><category>gridview</category><category>web.config settings</category><category>latest gadget</category><category>implement MSMQ in dotnet</category><category>c#</category><category>firefox</category><category>Call Method ASPX Page from UserControl</category><category>problem with web.config</category><category>SQL Server 2008 Interview Questions</category><category>Console to internet</category><category>url mapping</category><category>prformance</category><category>how to scroll news</category><category>Comapre OnError and ontaskfailed</category><category>Share master page</category><category>.net</category><category>problem with unicode on web form</category><category>features of sql server 2008</category><category>delete duplicate rows</category><category>genearate insert statements</category><category>Surface computing</category><category>SQL script</category><category>customize image resize asp.net 3.5</category><category>performance tuning</category><category>create insert statement for a table with column name and values</category><category>microsoft surface computing</category><category>QA</category><category>SSIS interview questions</category><category>meta tag</category><category>Delpoy SSIS</category><category>UML</category><category>uery execution plan</category><category>image resize quality problem</category><category>data grid</category><category>Unicode character</category><category>ontaskfailure</category><category>c# console</category><category>asp.net interview questions</category><category>html</category><category>Dynamic</category><category>n tier</category><category>scroll</category><category>tuning tips</category><category>asp.net security</category><category>Coding Practices</category><category>common master page</category><category>architecture</category><category>advantages of query ececution plan</category><category>Not null</category><category>javascript</category><category>difference between onerror and ontaskfailed</category><category>BIDS</category><category>SQL Server</category><category>Image resize asp.net</category><category>project architecture</category><category>Microsoft Silverlight</category><category>business intelligence</category><category>row number</category><category>Common Table Expression</category><category>scenario based</category><category>url rewriting</category><category>checkboxlist</category><category>BCP</category><category>blinking text</category><category>CTE for deleting duplicate rows</category><category>call container page method from user control</category><category>.Net project architecture</category><category>mysql role provider</category><category>Presentation layer</category><category>whats new in sql server 2008</category><category>security vulnerabilities</category><category>database integrity</category><category>web pages</category><category>stored procedure</category><category>internet explorer</category><category>how to get value of identity column in sql server</category><category>programming</category><category>MSMQ</category><category>problem in declaring variable</category><category>£ in textbox</category><category>website</category><category>automatic page refresh</category><category>export to excel</category><category>TSQL</category><category>communicate with internet from console application</category><category>textbox</category><category>Checkpoints</category><category>Copy data from source to destination</category><category>question and answers</category><category>sign up</category><category>check integrity</category><category>difference between server.transfer and response.redirect</category><category>how to implement MSMQ</category><category>Best Coding Practices</category><category>IE</category><category>import data from MySQL to SQL Server</category><category>usercontrol</category><category>ASP.Net tutorial</category><title>.Net and Business Intelligence</title><description>The single place to get answer to your .net and business Intelligence Questions</description><link>http://dotnetkeeda.blogspot.com/</link><managingEditor>noreply@blogger.com (Blog Admin)</managingEditor><generator>Blogger</generator><openSearch:totalResults>40</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/netAndBusinessIntelligence" /><feedburner:info uri="netandbusinessintelligence" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-1712761149722771865</guid><pubDate>Tue, 12 Apr 2011 13:09:00 +0000</pubDate><atom:updated>2011-04-12T06:18:21.494-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">firefox</category><category domain="http://www.blogger.com/atom/ns#">internet explorer</category><category domain="http://www.blogger.com/atom/ns#">checkboxlist</category><category domain="http://www.blogger.com/atom/ns#">loop through</category><category domain="http://www.blogger.com/atom/ns#">mozzilla</category><category domain="http://www.blogger.com/atom/ns#">check</category><category domain="http://www.blogger.com/atom/ns#">checkboxlist items</category><title>Loop through checklistbox items using Javascript</title><description>I was almost loosing my patience when I did'nt get the items of checkboxlist using javascript in Mozilla Firefox&lt;br /&gt;&lt;br /&gt;I got the items in internet explorer by using the table approach and fetching the items of table, but there was a problem with firefox so got this solution.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            var elementRef=document.getElementById("&lt;%=chkListNOs.ClientID%&gt;");&lt;br /&gt;            var checkBoxArray = elementRef.getElementsByTagName('input');&lt;br /&gt;            &lt;br /&gt;             for (var i=0;i&lt;checkBoxArray.length; i++)&lt;br /&gt;             {&lt;br /&gt;              var listControl = checkBoxArray[i];&lt;br /&gt;               if(listControl.type =="checkbox")&lt;br /&gt;               if ( listControl.checked == true )&lt;br /&gt;                {&lt;br /&gt;                    &lt;br /&gt;                    isChecked=true;&lt;br /&gt;                }&lt;br /&gt;               &lt;br /&gt;             }&lt;br /&gt;&lt;br /&gt;Hope this helps.&lt;br /&gt;Enjoy&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-1712761149722771865?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2011/04/loop-through-checklistbox-items-using.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-8288874786279383986</guid><pubDate>Fri, 07 Jan 2011 06:02:00 +0000</pubDate><atom:updated>2011-01-06T22:11:34.242-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">insert statement with column name and values</category><category domain="http://www.blogger.com/atom/ns#">genearate insert statements</category><category domain="http://www.blogger.com/atom/ns#">create insert statement for a table with column name and values</category><category domain="http://www.blogger.com/atom/ns#">TSQL</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><title>Stored Procedure to Generate Insert Statements with Columns and values for a Table in SQL Server</title><description>Requirement-&lt;br /&gt;&lt;br /&gt;I wanted to generate Insert statements for all the rows in the table with the column name and their values.&lt;br /&gt;&lt;br /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="--"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-qformat:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:"Times New Roman";  mso-fareast-theme-font:minor-fareast;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;For example,&lt;/p&gt;  &lt;p class="MsoNormal"&gt;If the Table name is Emp and with following structure and data&lt;/p&gt;  &lt;table class="MsoNormalTable" style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="width: 0.95in; border: 1pt solid black; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;EmpId&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;EmpName&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 74.65pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="100"&gt;   &lt;p class="MsoNormal"&gt;EmpLastName&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Department&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color black black; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;1&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Amit&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 74.65pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="100"&gt;   &lt;p class="MsoNormal"&gt;Gupta&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Technical&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color black black; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;2&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Sumit&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 74.65pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="100"&gt;   &lt;p class="MsoNormal"&gt;Verma&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Functional&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color black black; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;3&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Ritesh&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 74.65pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="100"&gt;   &lt;p class="MsoNormal"&gt;Sharma&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Financial&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color black black; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;4&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Hitesh&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 74.65pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="100"&gt;   &lt;p class="MsoNormal"&gt;Dubey&lt;/p&gt;   &lt;/td&gt;   &lt;td style="width: 0.95in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; padding: 0in 5.4pt;" valign="top" width="91"&gt;   &lt;p class="MsoNormal"&gt;Sales&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt; &lt;/p&gt;  &lt;p class="MsoNormal"&gt;On calling the Stored procedure&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;;"&gt;GetInsertStatement 'Emp'&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt; &lt;/p&gt;  &lt;p class="MsoNormal"&gt;It should generate the following&lt;/p&gt;  &lt;p class="MsoNormal"&gt; &lt;/p&gt;  &lt;p class="MsoNormal"&gt;Insert into Emp(EmpId, EmpName, EmpLastName, Department) values (‘1’, ‘Amit’, ’Gupta’, ’Technical’)&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Insert into Emp(EmpId, EmpName, EmpLastName, Department) values (‘2’, ‘Sumit, ’Verma’, ’Functional’)&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Insert into Emp(EmpId, EmpName, EmpLastName, Department) values (‘3’, ‘Ritesh’ ,Sharma’, ’Financial’)&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Insert into Emp(EmpId, EmpName, EmpLastName, Department) values (‘4’, ‘Hitesh’, ’Dubey’, ’Sales’)&lt;/p&gt;  Following is the stored procedure to generate the desired result.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;NOTE- Currently it includes identity column also in the Insert Statement since that was the requirement, but you can see the other version also without Identity column in Insert statement.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;SET ANSI_NULLS ON&lt;br /&gt;GO&lt;br /&gt;SET QUOTED_IDENTIFIER ON&lt;br /&gt;GO&lt;br /&gt;CREATE PROCEDURE [dbo].[GetInsertStatement]&lt;br /&gt;&lt;br /&gt;(@tableName varchar(100)) as&lt;br /&gt;&lt;br /&gt;--Declare a cursor to retrieve column specific information&lt;br /&gt;--for the specified table&lt;br /&gt;&lt;br /&gt;DECLARE cursCol CURSOR FAST_FORWARD FOR&lt;br /&gt;SELECT column_name,data_type FROM information_schema.columns&lt;br /&gt;    WHERE table_name = @tableName&lt;br /&gt;&lt;br /&gt;OPEN cursCol&lt;br /&gt;&lt;br /&gt;DECLARE @string nvarchar(3000) --for storing the first half&lt;br /&gt;                               --of INSERT statement&lt;br /&gt;DECLARE @stringData nvarchar(3000) --for storing the data&lt;br /&gt;                                   --(VALUES) related statement&lt;br /&gt;DECLARE @dataType nvarchar(1000) --data types returned&lt;br /&gt;                                 --for respective columns&lt;br /&gt;&lt;br /&gt;SET @string='INSERT INTO '+@tableName+'('&lt;br /&gt;SET @stringData=''&lt;br /&gt;&lt;br /&gt;DECLARE @colName nvarchar(50)&lt;br /&gt;&lt;br /&gt;FETCH NEXT FROM cursCol INTO @colName,@dataType&lt;br /&gt;&lt;br /&gt;IF @@fetch_status&lt;&gt;0&lt;br /&gt;    begin&lt;br /&gt;    print 'Table '+@tableName+' not found, processing skipped.'&lt;br /&gt;    close curscol&lt;br /&gt;    deallocate curscol&lt;br /&gt;    return&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;WHILE @@FETCH_STATUS=0&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;IF @dataType in ('varchar','char','nchar','nvarchar')&lt;br /&gt;BEGIN&lt;br /&gt;    SET @stringData=@stringData+'''''''''+&lt;br /&gt;            isnull('+@colName+','''')+'''''',''+'&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;ELSE&lt;br /&gt;if @dataType in ('text','ntext') --if the datatype&lt;br /&gt;                                 --is text or something else&lt;br /&gt;BEGIN&lt;br /&gt;    SET @stringData=@stringData+'''''''''+&lt;br /&gt;          isnull(cast('+@colName+' as varchar(2000)),'''')+'''''',''+'&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;ELSE&lt;br /&gt;&lt;br /&gt;IF @dataType = 'money' --because money doesn't get converted&lt;br /&gt;                       --from varchar implicitly&lt;br /&gt;BEGIN&lt;br /&gt;    SET @stringData=@stringData+'''''''''+&lt;br /&gt;        isnull(cast('+@colName+' as varchar(200)),''0.0000'')+'''''',''+'&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;ELSE&lt;br /&gt;IF @dataType='datetime'&lt;br /&gt;BEGIN&lt;br /&gt;    SET @stringData=@stringData+'''''''''+&lt;br /&gt;        isnull(cast('+@colName+' as varchar(200)),''0'')+'''''',''+'&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;ELSE&lt;br /&gt;IF @dataType='image'&lt;br /&gt;BEGIN&lt;br /&gt;    SET @stringData=@stringData+'''''''''+&lt;br /&gt;       isnull(cast(convert(varbinary,'+@colName+')&lt;br /&gt;       as varchar(6)),''0'')+'''''',''+'&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;ELSE --presuming the data type is int,bit,numeric,decimal&lt;br /&gt;BEGIN&lt;br /&gt;    SET @stringData=@stringData+'''''''''+&lt;br /&gt;          isnull(cast('+@colName+' as varchar(200)),''0'')+'''''',''+'&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;SET @string=@string+@colName+','&lt;br /&gt;&lt;br /&gt;FETCH NEXT FROM cursCol INTO @colName,@dataType&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;DECLARE @Query nvarchar(4000) -- provide for the whole query,&lt;br /&gt;                              -- you may increase the size&lt;br /&gt;&lt;br /&gt;SET @query ='SELECT '''+substring(@string,0,len(@string)) + ')&lt;br /&gt;    VALUES(''+ ' + substring(@stringData,0,len(@stringData)-2)+'''+'')''&lt;br /&gt;    FROM '+@tableName&lt;br /&gt;exec sp_executesql @query --load and run the built query&lt;br /&gt;&lt;br /&gt;CLOSE cursCol&lt;br /&gt;DEALLOCATE cursCol&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-8288874786279383986?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2011/01/stored-procedure-to-generate-insert.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-3703814521746093554</guid><pubDate>Mon, 03 Jan 2011 10:45:00 +0000</pubDate><atom:updated>2011-01-03T03:03:05.500-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">call container page method from user control</category><category domain="http://www.blogger.com/atom/ns#">Call Method ASPX Page from UserControl</category><category domain="http://www.blogger.com/atom/ns#">call page method from usercontrol</category><category domain="http://www.blogger.com/atom/ns#">usercontrol</category><category domain="http://www.blogger.com/atom/ns#">user control</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><title>How to Call a Method on container ASPX Page from a UserControl in C# and ASP.Net ?</title><description>&lt;span style="font-weight: bold;"&gt;Invoking a Page Method from User control in C#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Scenario:&lt;br /&gt;&lt;br /&gt;Calling a method defined in the page CodeBehind file from a user control.&lt;br /&gt;&lt;br /&gt;For example, if you want to refresh some controls in page when you saved some data in user control through an event in the user control.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To do this, we can define an event handler in the CodeBehind and it can be invoked from user control whenever required. From the event in the page we can call the page method which can refresh the page controls.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This sample code explains how to create event handler for page events and invoking the event in User Control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;WebUserControl.ascx&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs"      Inherits="WebUserControl" %&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;asp:Button ID="btnSave" runat="server" Text="btnSave" OnClick="btnSave_Click" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;WebUserControl.ascx.cs&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public partial class WebUserControl : System.Web.UI.UserControl&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   public event EventHandler ehClick;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   protected void btnSave_Click(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       ehClick.Invoke(this, new EventArgs());&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Default.aspx.cs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public partial class _Default : System.Web.UI.Page&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       //Register an event handler which will be invoked from the user control&lt;br /&gt;&lt;br /&gt;       this.WebUserControl1.ehClick += new EventHandler(this.btnPageButton_Click);&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   public void SaveData()&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       //Page Method&lt;br /&gt;&lt;br /&gt;       /*&lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;&lt;br /&gt;           Code&lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;&lt;br /&gt;       */&lt;br /&gt;&lt;br /&gt;       //Displaying Current Date&lt;br /&gt;&lt;br /&gt;       Response.Write(System.DateTime.Now.ToString());&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   protected void btnPageButton_Click(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       SaveData();&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-3703814521746093554?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2011/01/how-to-call-method-on-container-aspx.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-5056282743847704003</guid><pubDate>Tue, 28 Dec 2010 12:04:00 +0000</pubDate><atom:updated>2010-12-28T04:08:33.396-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">difference between onerror and ontaskfailed</category><category domain="http://www.blogger.com/atom/ns#">error handling</category><category domain="http://www.blogger.com/atom/ns#">SSIS ontaskfailed</category><category domain="http://www.blogger.com/atom/ns#">SSIS error handling</category><category domain="http://www.blogger.com/atom/ns#">ontaskfailure</category><category domain="http://www.blogger.com/atom/ns#">OnError</category><category domain="http://www.blogger.com/atom/ns#">SSIS OnError Vs OnTaskFailed</category><category domain="http://www.blogger.com/atom/ns#">Comapre OnError and ontaskfailed</category><title>SSIS OnError Vs OnTaskFailed</title><description>&lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;There are lots of event/event  handlers which we can make use of during the package execution. Among all those  events/event handlers, two of them are very important for &lt;strong&gt;logging the  custom errors; &lt;/strong&gt;which may occur due to failure of some of the tasks of a  package.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;We may be required to log such  errors once upon the failure of the complete package or we may want it for each  &amp;amp; every task failed during the package execution.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;So depending upon these  requirements we have two types of event handlers in SSIS:&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px 0px 0px 0.75in; text-indent: -0.25in;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;&lt;span&gt;1.&lt;span style="font: 7pt '';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;OnError&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px 0px 0px 0.75in; text-indent: -0.25in;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;&lt;span&gt;2.&lt;span style="font: 7pt '';"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;OnTaskFailed&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;strong&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;OnError:  &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;This  event is raised when an executable gets some errors due to any reason. This may  be due to failure of any of the tasks included in the package.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;strong&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;OnTaskFailed:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; This event is raised when a task  is failed irrespective of the complete package failure.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;The important difference between  these two is explained below:&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;Let’s suppose we have a package  (&lt;strong&gt;Package 1&lt;/strong&gt;) which has many tasks; one of them is  &lt;strong&gt;ExecutePackage&lt;/strong&gt; task. Now this ExecutePackage task executes  another package (&lt;strong&gt;Package 2&lt;/strong&gt;) which in turn contains some  tasks.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px 0px 0px 81pt; text-indent: -1in;"&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;Pacakge 1:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;&lt;span&gt;  &lt;/span&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="color:blue;"&gt;Data Flow  Task&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt; -&gt; Execute SQL&lt;span style="text-decoration: underline;"&gt; Task&lt;/span&gt; -&gt; &lt;span style="text-decoration: underline;"&gt;ExecutePacakge Task (Package  2)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px 0px 0px 81pt; text-indent: -1in;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px 0px 0px 1in; text-indent: -63pt;"&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;Package 2:&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;color:blue;"   &gt;Execute SQL Task&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px 0px 0px 1in; text-indent: -63pt;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;Now suppose Script task of the  package 2 gets failed due to some errors (like with some wrong code inside).  Then &lt;strong&gt;OnError&lt;/strong&gt; Event of the package 1 will be raised only  once.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;But &lt;strong&gt;OnTaskFailed&lt;/strong&gt;  event of the package 1 will be raised twice; once due to the failure of Script  Task of the package 2 and second time due to the failure of the ExecutePackage  task of the package 1 (which gets failed due to failure of package  2).&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0px;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;Observations:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style="margin-top: 0px;" type="1"&gt;&lt;li class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;OnError&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt; event is raised when ever there  are some errors occurring in any task of the package. These errors may be more  than one for a single executable/component like in case of DFT components. And  thus OnError event will be raised multiple times, but as explained in the  example we took Script Task which is raising only one error.&lt;/span&gt;  &lt;/li&gt;&lt;li class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;OnTaskFailed &lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;event is raised when a task is  completely failed. And this will be raised for &lt;span style="text-decoration: underline;"&gt;each &amp;amp; every task&lt;/span&gt; involved in that  package/parent task.&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:10pt;"  &gt;This can be checked by putting a  Script Task in the OnTaskFailed event handler of “package 2” with displaying the  Source of the failure by using a System variable  “&lt;strong&gt;SourceName&lt;/strong&gt;”.&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt; &lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-5056282743847704003?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/12/ssis-onerror-vs-ontaskfailed.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-3301532293901786470</guid><pubDate>Fri, 24 Dec 2010 06:22:00 +0000</pubDate><atom:updated>2010-12-23T23:16:12.072-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">migrate data from multiple tables</category><category domain="http://www.blogger.com/atom/ns#">BIDS</category><category domain="http://www.blogger.com/atom/ns#">move data</category><category domain="http://www.blogger.com/atom/ns#">business intelligence in sql server 2008</category><category domain="http://www.blogger.com/atom/ns#">Copy data from source to destination</category><category domain="http://www.blogger.com/atom/ns#">Delpoy SSIS</category><title>Migrate data from multiple tables from source db to destinatin db</title><description>Hi friends,&lt;br /&gt;&lt;br /&gt;After searching the web for couple of days i managed to do this along with one of my friend, so thought i should make it available for all the stragglers.&lt;br /&gt;&lt;br /&gt;The scenario is- I have a source DB (i have SQL server, you may have different) and a destination DB (again SQL server). I wanna copy data from all the tables in the source to the destination DB which has identical tables.&lt;br /&gt;&lt;br /&gt;The main issue is when we have multiple tables to be copied from source to destination and we put this in the simple data flow task under for each loop, the metadata does not get refreshed so it gives error of column mappings.&lt;br /&gt;&lt;br /&gt;And another issue is we may not have SQL server always as source and destination.&lt;br /&gt;&lt;br /&gt;so this has to be done programatically using script task, or if you want you may build a custom component also, but i found this approach easier.&lt;br /&gt;&lt;br /&gt;I took a user variable to store table names and mapped it with the for each loop container.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_sINvh8Ncl78/TRRHzBqZdtI/AAAAAAAAAC8/kUeWb3o-86c/s1600/variable.JPG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 287px;" src="http://4.bp.blogspot.com/_sINvh8Ncl78/TRRHzBqZdtI/AAAAAAAAAC8/kUeWb3o-86c/s320/variable.JPG" alt="" id="BLOGGER_PHOTO_ID_5554143182399829714" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Assigned the values to the variable (table names), you can do it with a separate task which supplies the table names from the source DB.&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_sINvh8Ncl78/TRRH__LVI3I/AAAAAAAAADE/ekplZQg08vc/s1600/Collection.JPG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 310px;" src="http://3.bp.blogspot.com/_sINvh8Ncl78/TRRH__LVI3I/AAAAAAAAADE/ekplZQg08vc/s320/Collection.JPG" alt="" id="BLOGGER_PHOTO_ID_5554143405070951282" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_sINvh8Ncl78/TRRIGrzvn5I/AAAAAAAAADM/jMJqea-vVSM/s1600/Variable%2Bmapping.JPG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 310px;" src="http://4.bp.blogspot.com/_sINvh8Ncl78/TRRIGrzvn5I/AAAAAAAAADM/jMJqea-vVSM/s320/Variable%2Bmapping.JPG" alt="" id="BLOGGER_PHOTO_ID_5554143520130834322" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;add a script task inside the for each loop container.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_sINvh8Ncl78/TRRIMF0ILBI/AAAAAAAAADU/NTcFGp5hg6Y/s1600/Control%2BFlow.JPG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 239px; height: 275px;" src="http://3.bp.blogspot.com/_sINvh8Ncl78/TRRIMF0ILBI/AAAAAAAAADU/NTcFGp5hg6Y/s320/Control%2BFlow.JPG" alt="" id="BLOGGER_PHOTO_ID_5554143613011110930" border="0" /&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/_sINvh8Ncl78/TRRIRb07EtI/AAAAAAAAADc/Fwx8Zo-1PUo/s1600/Script%2BTask%2BSettings.JPG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 310px;" src="http://3.bp.blogspot.com/_sINvh8Ncl78/TRRIRb07EtI/AAAAAAAAADc/Fwx8Zo-1PUo/s320/Script%2BTask%2BSettings.JPG" alt="" id="BLOGGER_PHOTO_ID_5554143704819372754" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The most important part is the programming / code inside the script task.&lt;br /&gt;&lt;br /&gt;For this you need to take reference of these&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;DTSRuntimeWrap&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;DTSPipelineWrap&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using Microsoft.SqlServer.Dts.Runtime;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using Microsoft.SqlServer.Dts.Pipeline;&lt;br /&gt;using Microsoft.SqlServer.Dts.Pipeline.Wrapper;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;namespace ST_5c5e95d7b5ce4b3c91c2a82c79477980.csproj&lt;br /&gt;{&lt;br /&gt;[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]&lt;br /&gt;public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; #region VSTA generated code&lt;br /&gt; enum ScriptResults&lt;br /&gt; {&lt;br /&gt;     Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,&lt;br /&gt;     Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure&lt;br /&gt; };&lt;br /&gt; #endregion&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public void Main()&lt;br /&gt; {&lt;br /&gt;     // TODO: Add your code here&lt;br /&gt;     String tablename = Dts.Variables["User::TableName"].Value.ToString();&lt;br /&gt;&lt;br /&gt;     Package package = new Package();&lt;br /&gt;     MainPipe dataFlow = ((TaskHost)package.Executables.Add("SSIS.Pipeline.2")).InnerObject as MainPipe;&lt;br /&gt;&lt;br /&gt;     //Add a SQL Server connection manager that will be used later.&lt;br /&gt;     ConnectionManager cm = package.Connections.Add("OLEDB");&lt;br /&gt;     cm.Name = "Source ConnectionManager";&lt;br /&gt;     cm.ConnectionString = "Data Source=SQL source;Initial Catalog=DBName;User ID=USER;Password=PWD;provider=SQLNCLI10.1;";     &lt;br /&gt;&lt;br /&gt;     //Add a SQL Server connection manager that will be used later.&lt;br /&gt;     ConnectionManager cm1 = package.Connections.Add("OLEDB");&lt;br /&gt;     cm1.Name = "Destination ConnectionManager";&lt;br /&gt;     cm1.ConnectionString = "Data Source=SQL source;Initial Catalog=DBName;User ID=USER;Password=PWD;provider=SQLNCLI10.1;";     &lt;br /&gt;&lt;br /&gt;     //Adding source component for Cache Database.&lt;br /&gt;     IDTSComponentMetaData100 component = dataFlow.ComponentMetaDataCollection.New();&lt;br /&gt;     //component.Name = "ADONETSource";&lt;br /&gt;     //component.ComponentClassID = "Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter, Microsoft.SqlServer.ADONETSrc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";&lt;br /&gt;     component.Name = "SQL Server Source";&lt;br /&gt;     component.ComponentClassID = "DTSAdapter.OLEDBSource.2";&lt;br /&gt;     CManagedComponentWrapper instance = component.Instantiate();&lt;br /&gt;     instance.ProvideComponentProperties();&lt;br /&gt;     if (component.RuntimeConnectionCollection.Count &gt; 0)&lt;br /&gt;     {&lt;br /&gt;         //component.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(package.Connections["Source ConnectionManager"]);&lt;br /&gt;         component.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(cm);&lt;br /&gt;         component.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     }&lt;br /&gt;     instance.SetComponentProperty("AccessMode", 0);&lt;br /&gt;     instance.SetComponentProperty("OpenRowset", tablename);&lt;br /&gt;&lt;br /&gt;     // Reinitialize the metadata.&lt;br /&gt;     instance.AcquireConnections(null);&lt;br /&gt;     instance.ReinitializeMetaData();&lt;br /&gt;     instance.ReleaseConnections();&lt;br /&gt;&lt;br /&gt;     // Adding destination component for SQL Server&lt;br /&gt;     IDTSComponentMetaData100 component1 = dataFlow.ComponentMetaDataCollection.New();&lt;br /&gt;     component1.Name = "SQL Server Destination";&lt;br /&gt;     component1.ComponentClassID = "DTSAdapter.OLEDBDestination.2";&lt;br /&gt;     CManagedComponentWrapper instance1 = component1.Instantiate();&lt;br /&gt;     instance1.ProvideComponentProperties();&lt;br /&gt;     if (component1.RuntimeConnectionCollection.Count &gt; 0)&lt;br /&gt;     {&lt;br /&gt;         //component1.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(package.Connections["Destination ConnectionManager"]);&lt;br /&gt;         component1.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(cm1);&lt;br /&gt;         component1.RuntimeConnectionCollection[0].ConnectionManagerID = cm1.ID;&lt;br /&gt;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     instance1.SetComponentProperty("AccessMode", 0);&lt;br /&gt;     instance1.SetComponentProperty("OpenRowset", tablename);&lt;br /&gt;&lt;br /&gt;     //instance1.SetComponentProperty("BulkInsertTableName","[DimAccount]");&lt;br /&gt;     //instance1.SetComponentProperty("BulkInsertKeepIdentity", true);&lt;br /&gt;     //instance1.SetComponentProperty("BulkInsertKeepNulls", true);&lt;br /&gt;&lt;br /&gt;     // Reinitialize the metadata.&lt;br /&gt;     instance1.AcquireConnections(null);&lt;br /&gt;     instance1.ReinitializeMetaData(); //Throws exception. Message: "Exception from HRESULT: 0xC0202072" . Even if I reinitialize metadata after iterating through inputs of the component, the same exception is thrown at this statement.&lt;br /&gt;     instance1.ReleaseConnections();&lt;br /&gt;&lt;br /&gt;     //set path between components&lt;br /&gt;     IDTSPath100 path = dataFlow.PathCollection.New();&lt;br /&gt;     path.AttachPathAndPropagateNotifications(component.OutputCollection[0], component1.InputCollection[0]); //Assuming this is correct&lt;br /&gt;&lt;br /&gt;     // Iterate through the inputs of the component.&lt;br /&gt;     foreach (IDTSInput100 input in component1.InputCollection)&lt;br /&gt;     {&lt;br /&gt;         // Get the virtual input column collection for the input.&lt;br /&gt;         IDTSVirtualInput100 vInput = input.GetVirtualInput();&lt;br /&gt;&lt;br /&gt;         // Iterate through the virtual column collection.&lt;br /&gt;         foreach (IDTSVirtualInputColumn100 vColumn in vInput.VirtualInputColumnCollection)&lt;br /&gt;         {&lt;br /&gt;             // Call the SetUsageType method of the design time instance of the component.&lt;br /&gt;             IDTSInputColumn100 vCol = instance1.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READONLY);&lt;br /&gt;             instance1.MapInputColumn(input.ID, vCol.ID, input.ExternalMetadataColumnCollection[vColumn.Name].ID);&lt;br /&gt;&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     // Save the package&lt;br /&gt;     string pkgPath = @"C:\My Documents\Visual Studio 2008\Projects\package.dtsx";&lt;br /&gt;&lt;br /&gt;     Microsoft.SqlServer.Dts.Runtime.Application appl = new Microsoft.SqlServer.Dts.Runtime.Application();&lt;br /&gt;&lt;br /&gt;     appl.SaveToXml(pkgPath, package, null);&lt;br /&gt;&lt;br /&gt;     package.Execute();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     Dts.TaskResult = (int)ScriptResults.Success;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-3301532293901786470?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/12/migrate-data-from-multiple-tables-from.html</link><author>noreply@blogger.com (Blog Admin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_sINvh8Ncl78/TRRHzBqZdtI/AAAAAAAAAC8/kUeWb3o-86c/s72-c/variable.JPG" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-7352577474902543255</guid><pubDate>Wed, 22 Dec 2010 11:28:00 +0000</pubDate><atom:updated>2010-12-22T04:21:06.025-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">asp.net</category><category domain="http://www.blogger.com/atom/ns#">asp.net interview questions</category><category domain="http://www.blogger.com/atom/ns#">Interview Questions</category><title>ASP.Net Interview Questions</title><description>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;Globalization -&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is Globalization? &lt;/strong&gt;&lt;br /&gt;Globalization  is the process of creating an application that meets the needs of users  from multiple cultures. This process involves translating the user  interface elements of an application into multiple languages, using the  correct currency, date and time format, calendar, writing direction,  sorting rules, and other issues. Accommodating these cultural  differences in an application is called localization.&lt;br /&gt;&lt;br /&gt;The  Microsoft .NET Framework simplifies localization tasks substantially by  making its formatting, date/time, sorting, and other classes culturally  aware. Using classes from the System.Globalization namespace, you can  set the application’s current culture, and much of the work is done  automatically!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the 3 different ways to globalize web applications?&lt;br /&gt;&lt;br /&gt;Detect and redirect approach :&lt;/strong&gt;  In this approach we create a separate Web application for each  supported culture, and then detect the user’s culture and redirect the  request to the appropriate application. This approach is best for  applications with lots of text content that requires translation and few  executable components.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Run-time adjustment approach : &lt;/strong&gt;In  this approach we create a single Web application that detects the  user’s culture and adjusts output at run time using format specifiers  and other tools. This approach is best for simple applications that  present limited amounts of content.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Satellite assemblies approach :&lt;/strong&gt;  In this approach we create a single Web application that stores  culture-dependent strings in resource files that are compiled into  satellite assemblies. At run time, detect the user’s culture and load  strings from the appropriate assembly. This approach is best for  applications that generate content at run time or that have large  executable components.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In ASP.NET, how do you detect the user's language preference on his/her computer? &lt;/strong&gt;&lt;br /&gt;Use  the Request object’s UserLanguages property to return a list of the  user’s language preferences. The first element of the array returned by  UserLanguages is the user’s current language on his/her computer.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the steps to follow to get user's culture at run time?&lt;br /&gt;&lt;/strong&gt;To get the user’s culture at run time, follow these steps:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Get the Request object’s UserLanguages property.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Use the returned value with the CultureInfo class to create an object representing the user’s current culture.&lt;br /&gt;&lt;br /&gt;For  example, the following code gets the user’s culture and displays the  English name and the abbreviated name of the culture in a label the  first time the page is displayed:&lt;br /&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;// Run the first time the page is displayed&lt;br /&gt;if (!IsPostBack)&lt;br /&gt;{&lt;br /&gt;// Get the user's preferred language.&lt;br /&gt;string sLang = Request.UserLanguages[0];&lt;br /&gt;// Create a CultureInfo object from it.&lt;br /&gt;CultureInfo CurrentCulture = new CultureInfo(sLang);&lt;br /&gt;lblCulture.Text = CurrentCulture.EnglishName + ": " +&lt;br /&gt;CurrentCulture.Name;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the advantages of using detect and redirect approach to globalizing web applications? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt;  Content is maintained separately, so this approach allows the different  applications to present very different information, if needed.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Users can be automatically directed to sites that are likely to be geographically close, and so can better meet their needs.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt;  Content files (Web forms and HTML pages, for example) can be authored  in the appropriate natural language without the complexity of including  resource strings.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the disadvantages of using detect and redirect approach to globalizing web applications? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt;  Using this approach requires that the executable portion of the Web  application be compiled and deployed separately to each culture-specific  Web site.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; This approach requires more effort to maintain consistency and to debug problems across Web sites.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the use of culture attribute of the globalization element in web.config?&lt;br /&gt;&lt;/strong&gt;The  Web.config file’s globalization element is used to create a  culture-specific Web application. The culture attribute of the  globalization element specifies how the Web application deals with  various culture-dependent issues, such as dates, currency, and number  formatting.&lt;br /&gt;&lt;br /&gt;Web.config globalization settings in subordinate  folders override the globalization settings in the application’s root  Web.config file. You can store content for various cultures in  subfolders within your application, add Web.config files with the  globalization settings for each culture, then direct users to the  appropriate folder based on the user’s CurrentCulture.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The text on the webform is usually written from left to right. How do you change the writing direction to "right to left"? &lt;/strong&gt;&lt;br /&gt;The wrting direction of a webform can be changed using the HTML dir attribute as shown below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You  can use the dir attribute individually in panels, text boxes, or other  controls as well. Setting the dir attribute on the body element applies  right-to-left formatting to the entire page.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What do you mean by neutral cultures?&lt;br /&gt;&lt;/strong&gt;Neutral  cultures represent general languages, such as English or Spanish,  rather than a specific language and region. When you set the culture  attribute for a Web application in Web.config, ASP.NET assigns that  culture to all the threads running for that Web application. Threads are  the basic unit to which the server allocates processor time. ASP.NET  maintains multiple threads for a Web application within the  aspnet_wp.exe worker process.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are advantages of  setting the culture dynamically at the thread level over creating  separate Web applications for each culture? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; All cultures share the same application code, so the application doesn’t have to be compiled and deployed for each culture.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; The application resides at a single Web address, you don’t need to redirect users to other Web applications.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; The user can choose from a full array of available cultures.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For what type of web applications setting the culture dynamically is best suited?&lt;br /&gt;&lt;/strong&gt;Setting  the culture dynamically is best suited for simple Web applications that  don’t contain large amounts of text that must be translated into  different languages.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;DataSet&lt;/span&gt;-&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is a DataSet?&lt;br /&gt;&lt;/strong&gt;DataSet is an in-memory cache of data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In which namespace is the DataSet class present? &lt;/strong&gt;&lt;br /&gt;System.Data&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you add more than one table to a dataset?&lt;br /&gt;&lt;/strong&gt;Yes&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you enforce constarints and relations on tables inside a DataSet?&lt;br /&gt;&lt;/strong&gt;Yes,  the DataSet consists of a collection of DataTable objects that you can  relate to each other with DataRelation objects. You can also enforce  data integrity in the DataSet by using the UniqueConstraint and  ForeignKeyConstraint objects.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What happens when you invoke AcceptChanges() method on a DataSet? &lt;/strong&gt;&lt;br /&gt;Invoking AcceptChanges() method on the DataSet causes AcceptChanges() method to be called on each table within the DataSet.&lt;br /&gt;&lt;br /&gt;Both  the DataRow and DataTable classes also have AcceptChanges() methods.  Calling AcceptChanges() at the DataTable level causes the AcceptChanges  method for each DataRow to be called.&lt;br /&gt;&lt;br /&gt;When you call AcceptChanges  on the DataSet, any DataRow objects still in edit-mode end their edits  successfully. The RowState property of each DataRow also changes. Added  and Modified rows become Unchanged, and Deleted rows are removed.&lt;br /&gt;&lt;br /&gt;If  the DataSet contains ForeignKeyConstraint objects, invoking the  AcceptChanges method also causes the AcceptRejectRule to be enforced.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Is there a way to clear all the rows from all the tables in a DataSet at once?&lt;br /&gt;&lt;/strong&gt;Yes, use the DataSet.Clear() method to clear all the rows from all the tables in a DataSet at once.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between DataSet.Copy() and DataSet.Clone()? &lt;/strong&gt;&lt;br /&gt;DataSet.Clone()  copies the structure of the DataSet, including all DataTable schemas,  relations, and constraints. Does not copy any data.&lt;br /&gt;&lt;br /&gt;DataSet.Copy() copies both the structure and data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you get a copy of the DataSet containing all changes made to it since it was last loaded? &lt;/strong&gt;&lt;br /&gt;Use DataSet.GetChanges() method&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the use of DataSet.HasChanges() Method? &lt;/strong&gt;&lt;br /&gt;DataSet.HasChanges  method returns a boolean true if there are any changes made to the  DataSet, including new, deleted, or modified rows. This method can be  used to update a DataSource only if there are any changes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you roll back all the changes made to a DataSet since it was created? &lt;/strong&gt;Invoke the DataSet.RejectChanges() method to undo or roll back all the changes made to a DataSet since it was created.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What happnes when you invoke RejectChanges method, on a DataSet that contains 3 tables in it? &lt;/strong&gt;&lt;br /&gt;RejectChanges()  method will be automatically invoked on all the 3 tables in the dataset  and any changes that were done will be rolled back for all the 3  tables.&lt;br /&gt;&lt;br /&gt;When the DataTable.RejectChanges method is called, any  rows that are still in edit-mode cancel their edits. New rows are  removed. Modified and deleted rows return back to their original state.  The DataRowState for all the modified and deleted rows will be flipped  back to unchanged.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the DataSet.CaseSensitive property used for? &lt;/strong&gt;&lt;br /&gt;When  you set the CaseSensitive property of a DataSet to true, string  comparisons for all the DataTables within dataset will be case  sensitive. By default the CaseSensitive property is false&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;HTTP Modules and HTTP Handlers -&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is an HTTP Handler? &lt;/strong&gt;&lt;br /&gt;An ASP.NET &lt;strong&gt;HTTP handler &lt;/strong&gt;is  the process (frequently referred to as the "endpoint") that runs in  response to a request made to an ASP.NET Web application. The most  common handler is an ASP.NET page handler that processes .aspx files.  When users request an .aspx file, the request is processed by the page  through the page handler. You can create your own HTTP handlers that  render custom output to the browser.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is HTTP module?&lt;br /&gt;&lt;/strong&gt;An &lt;strong&gt;HTTP module&lt;/strong&gt;  is an assembly that is called on every request that is made to your  application. HTTP modules are called as part of the ASP.NET request  pipeline and have access to life-cycle events throughout the request.  HTTP modules let you examine incoming and outgoing requests and take  action based on the request.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the interface that you have to implement if you have to create a Custom HTTP Handler? &lt;/strong&gt;&lt;br /&gt;Implement &lt;strong&gt;IHttpHandler&lt;/strong&gt; interface to create a synchronous handler.&lt;br /&gt;Implement &lt;strong&gt;IHttpAsyncHandler &lt;/strong&gt;to create an asynchronous handler.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between asynchronous and synchronous HTTP Handlers?&lt;br /&gt;&lt;/strong&gt;A &lt;strong&gt;synchronous handler &lt;/strong&gt;does not return until it finishes processing the HTTP request for which it is called.&lt;br /&gt;&lt;br /&gt;An &lt;strong&gt;asynchronous handler&lt;/strong&gt;  runs a process independently of sending a response to the user.  Asynchronous handlers are useful when you must start an application  process that might be lengthy and the user does not have to wait until  it finishes before receiving a response from the server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Which class is responsible for receiving and forwarding a request to the appropriate HTTP handler? &lt;/strong&gt;&lt;br /&gt;IHttpHandlerFactory Class&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you create your own custom HTTP handler factory class?&lt;br /&gt;&lt;/strong&gt;Yes, we can create a custom &lt;strong&gt;HTTP handler &lt;/strong&gt;factory class by creating a class that implements the IHttpHandlerFactory interface.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the use of HTTP modules? &lt;/strong&gt;&lt;br /&gt;HTTP  modules are used to implement various application features, such as  forms authentication, caching, session state, and client script  services.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between HTTP modules and HTTP handlers?&lt;br /&gt;&lt;/strong&gt;An &lt;strong&gt;HTTP handler&lt;/strong&gt;  returns a response to a request that is identified by a file name  extension or family of file name extensions. In contrast, an HTTP module  is invoked for all requests and responses. It subscribes to event  notifications in the request pipeline and lets you run code in  registered event handlers. The tasks that a module is used for are  general to an application and to all requests for resources in the  application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the common way to register an HTTP module?&lt;br /&gt;&lt;/strong&gt;The common way to register an HTTP module is to have an entry in the application's Web.config file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Much  of the functionality of a module can be implemented in a global.asax  file. When do you create an HTTP module over using Global.asax File? &lt;/strong&gt;&lt;br /&gt;You create an &lt;strong&gt;HTTP module&lt;/strong&gt; over using Global.asax file if the following conditions are true&lt;br /&gt;&lt;br /&gt;1. You want to re-use the module in other applications.&lt;br /&gt;2. You want to avoid putting complex code in the Global.asax file.&lt;br /&gt;3. The module applies to all requests in the pipeline.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Data Access Security-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;What are the best practices to follow to secure connection strings in an ASP.NET web application?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1. &lt;/strong&gt;Always  store connection strings in the site's Web.config file. Web.config is  very secure. Users will not be able to access web.config from the  browser.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Do not store connection strings as plain  text. To help keep the connection to your database server secure, it is  recommended that you encrypt connection string information in the  configuration file.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Never store connection strings in an aspx page.&lt;br /&gt;&lt;strong&gt;4. &lt;/strong&gt;Never set connection strings as declarative properties of the SqlDataSource control or other data source controls.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;Why is "Connecting to SQL Server using Integrated Security" considered a best practice?&lt;br /&gt;&lt;/strong&gt;Connecting  to SQL Server using integrated security instead of using an explicit  user name and password, helps avoid the possibility of the connection  string being compromised and your user ID and password being exposed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the advantage of storing an XML file in the applications App_Data folder? &lt;/strong&gt;The contents of the App_Data folder will not be returned in response to direct HTTP requests.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is Script injection? &lt;/strong&gt;&lt;br /&gt;A  script injection attack attempts to send executable script to your  application with the intent of having other users run it. A typical  script injection attack sends script to a page that stores the script in  a database, so that another user who views the data inadvertently runs  the code.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;What is SQL injection?&lt;br /&gt;&lt;/strong&gt;A  SQL injection attack attempts to compromise your database by creating  SQL commands that are executed instead of, or in addition to, the  commands that you have built into your application.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;What are the best practices to keep in mind when accepting user input on a web application?&lt;br /&gt;1.&lt;/strong&gt; Always use validation controls whenever possible to limit user input to acceptable values.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt;  Always check the IsValid property of the aspx page. Run the server side  code only if the IsValid property value is true. A value of false means  that one or more validation controls have failed a validation check.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt;  Always perform server side validation irrespective of client side  validation being performed or not. This will protect your web  application even if the client has by passed the client side validation  by disabling javascript in the web browser.&lt;br /&gt;&lt;strong&gt;4. &lt;/strong&gt;Also make sure to re validate user input in the business logic layer of your application.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;What are the steps to follow to avoid Script Injection attacks?&lt;br /&gt;1.&lt;/strong&gt; Encode user input with the HtmlEncode method. This method turns HTML into its text representation.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt;  If you are using the GridView control with bound fields, set the  BoundField object's HtmlEncode property to true. This causes the  GridView control to encode user input when the row is in edit mode.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;What are the steps to follow to avoid SQL Injection attacks?&lt;br /&gt;&lt;/strong&gt;Always use parameterized queries or stored procedures instead of creating SQL commands by concatenating strings together.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you encrypt view state data of an aspx page? &lt;/strong&gt;&lt;br /&gt;Yes, you encrypt view state data of an aspx page by setting the page's ViewStateEncryptionMode property to true.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Master Pages-&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are Master Pages in ASP.NET? or What is a Master Page?&lt;/strong&gt;&lt;br /&gt;ASP.NET  master pages allow you to create a consistent layout for the pages in  your application. A single master page defines the look and feel and  standard behavior that you want for all of the pages (or a group of  pages) in your application. You can then create individual content pages  that contain the content you want to display. When users request the  content pages, they merge with the master page to produce output that  combines the layout of the master page with the content from the content  page.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the 2 important parts of a master page?&lt;/strong&gt;&lt;br /&gt;The following are the 2 important parts of a master page&lt;br /&gt;1. The Master Page itself&lt;br /&gt;2. One or more Content Pages&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can Master Pages be nested?&lt;/strong&gt;&lt;br /&gt;Yes, Master Pages be nested.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the file extension for a Master Page?&lt;/strong&gt;&lt;br /&gt;.master&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you identify a Master Page?&lt;/strong&gt;&lt;br /&gt;The  master page is identified by a special @ Master directive that replaces  the @ Page directive that is used for ordinary .aspx pages.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can a Master Page have more than one ContentPlaceHolder?&lt;/strong&gt;&lt;br /&gt;Yes, a Master Page can have more than one ContentPlaceHolder&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is a ContentPlaceHolder?&lt;/strong&gt;&lt;br /&gt;ContentPlaceHolder is a region where replaceable content will appear.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you bind a Content Page to a Master Page?&lt;/strong&gt;&lt;br /&gt;MasterPageFile attribute of a content page's @ Page directive is used to bind a Content Page to a Master Page.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can the content page contain any other markup outside of the Content control?&lt;/strong&gt;&lt;br /&gt;No.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the advantages of using Master Pages?&lt;/strong&gt;&lt;br /&gt;1. They allow you to centralize the common functionality of your pages so that you can make updates in just one place.&lt;br /&gt;2.  They make it easy to create one set of controls and code and apply the  results to a set of pages. For example, you can use controls on the  master page to create a menu that applies to all pages.&lt;br /&gt;3. They give  you fine-grained control over the layout of the final page by allowing  you to control how the placeholder controls are rendered.&lt;br /&gt;4. They provide an object model that allows you to customize the master page from individual content pages.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the 3 levels at which content pages can be attached to Master Page?&lt;/strong&gt;&lt;br /&gt;At the page level - You can use a page directive in each content page to bind it to a master page&lt;br /&gt;&lt;br /&gt;At  the application level - By making a setting in the pages element of the  application's configuration file (Web.config), you can specify that all  ASP.NET pages (.aspx files) in the application automatically bind to a  master page.&lt;br /&gt;&lt;br /&gt;At the folder level - This strategy is like binding  at the application level, except that you make the setting in a  Web.config file in one folder only. The master-page bindings then apply  to the ASP.NET pages in that folder.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is @MasterType directive used for?&lt;/strong&gt;&lt;br /&gt;@MasterType directive is used to create a strongly typed reference to the master page.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Are controls on the master page accessible to content page code?&lt;/strong&gt;&lt;br /&gt;Yes, controls on the master page are accessible to content page code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;At what stage of page processing master page and content page are merged?&lt;/strong&gt;&lt;br /&gt;During the initialization stage of page processing, master page and content page are merged.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you dynaimically assign a Master Page?&lt;/strong&gt;&lt;br /&gt;Yes,  you can assign a master page dynamically during the PreInit stage using  the Page class MasterPageFile property as shown in the code sample  below.&lt;br /&gt;void Page_PreInit(Object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;this.MasterPageFile = "~/MasterPage.master";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you access non public properties and non public methods of a master page inside a content page?&lt;/strong&gt;&lt;br /&gt;No, the properties and methods of a master page must be public in order to access them on the content page.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;From the content page code how can you reference a control on the master page?&lt;/strong&gt;&lt;br /&gt;Use the FindControl() method as shown in the code sample below.&lt;br /&gt;void Page_Load()&lt;br /&gt;{&lt;br /&gt;// Gets a reference to a TextBox control inside&lt;br /&gt;// a ContentPlaceHolder&lt;br /&gt;ContentPlaceHolder ContPlaceHldr = (ContentPlaceHolder)Master.FindControl ("ContentPlaceHolder1");&lt;br /&gt;if(ContPlaceHldr != null)&lt;br /&gt;{&lt;br /&gt;TextBox TxtBox = (TextBox)ContPlaceHldr.FindControl("TextBox1");&lt;br /&gt;if(TxtBox != null)&lt;br /&gt;{&lt;br /&gt;TxtBox.Text = "TextBox Present!";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;// Gets a reference to a Label control that not in&lt;br /&gt;// a ContentPlaceHolder&lt;br /&gt;Label Lbl = (Label)Master.FindControl("Label1");&lt;br /&gt;if(Lbl != null)&lt;br /&gt;{&lt;br /&gt;Lbl.Text = "Lable Present";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you access controls on the Master Page without using FindControl() method?&lt;/strong&gt;&lt;br /&gt;Yes, by casting the Master to your MasterPage as shown in the below code sample.&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;MyMasterPage MMP = this.Master;&lt;br /&gt;MMP.MyTextBox.Text = "Text Box Found";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Passport Authentication-&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is Passport Authentication?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Passport authentication &lt;/strong&gt;identifies  users via Microsoft Passport’s single sign-on service. Microsoft  Passport is meant to provide Internet users with a single identity that  they can use to visit a wide variety of Web sites that require  authentication. Information about the user is available to your  application through a profile that is stored with Microsoft.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the advantages of Passport authentication?&lt;/strong&gt;&lt;br /&gt;The  advantages of Passport authentication are that the user doesn’t have to  remember separate user names and passwords for various Web sites and  that the user can maintain his or her profile information in a single  location. Passport authentication also provides access to other  Microsoft services, such as Passport Express Purchase.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is passport software development kit (passport SDK)?&lt;/strong&gt;&lt;br /&gt;To  use Passport authentication in your Web application, you must install  the Passport SDK. The Passport SDK is free for preproduction development  and testing. To deploy a site for public use, you must obtain an annual  license from Microsoft.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How does Passport authentication work?&lt;/strong&gt;&lt;br /&gt;When  a user accesses an application that implements Passport authentication,  ASP.NET checks the user’s machine for a current passport authentication  cookie. If none is found, ASP.NET directs the user to a Passport  sign-on page. Once the user signs in, the Passport service authenticates  the user, stores an authentication cookie on the user’s computer, and  directs the user back to the originally requested Web page.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the steps to follow to use Passport authentication?&lt;/strong&gt;&lt;br /&gt;1.  Install the Passport SDK. Passport is not included with Visual Studio,  although the .NET Framework does include classes for working with the  Passport SDK once it is installed.&lt;br /&gt;2. Set the application’s authentication mode to Passport in Web.config. Set authorization to deny unauthenticated users.&lt;br /&gt;3. Use the PassportAuthentication_OnAuthenticate event to access the user’s Passport profile to identify and authorize the user.&lt;br /&gt;4. Implement a sign-out procedure to remove Passport cookies from the user’s machine.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Where is PassportAuthentication_OnAuthenticate event present?&lt;/strong&gt;&lt;br /&gt;PassportAuthentication_OnAuthenticate event is present in Global.asax.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Forms Authentication-&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the advantage of using Forms authentication?&lt;/strong&gt;&lt;br /&gt;The  advantage of using Forms authentication is that users do not have to be  member of a domain-based network to have access to your application.  Another advantage is that many Web applications, particularly commercial  sites where customers order products, want to have access to user  information. Forms authentication makes these types of applications  easier to create.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;List the steps to use Forms authentication in a web application?&lt;/strong&gt;&lt;br /&gt;1.Set the authentication mode in Web.config to Forms.&lt;br /&gt;2.Create a Web form to collect logon information.&lt;br /&gt;3.Create a file or database to store user names and passwords.&lt;br /&gt;4.Write code to add new users to the user file or database.&lt;br /&gt;5.Write code to authenticate users against the user file or database.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What happens when someone accesses a Web application that uses Forms authentication?&lt;/strong&gt;&lt;br /&gt;When  someone accesses a Web application that uses Forms authentication,  ASP.NET displays the logon Web form specified in Web.config. Once a user  is authorized, ASP.NET issues an authorization certificate in the form  of a cookie that persists for an amount of time specified by the  authentication settings in Web.config.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between Windows authentication and Forms authentication?&lt;/strong&gt;&lt;br /&gt;The  difference between Windows authentication and Forms authentication is  that in Forms authentication your application performs all the  authentication and authorization tasks. You must create Web forms and  write code to collect user names and passwords and to check those items  against a list of authorized users.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the use of mode attribute in authentication element in a web.config file?&lt;/strong&gt;&lt;br /&gt;You  use the mode attribute to specify the type of authentication your web  application is using. Set the mode attribute to forms to enable Forms  authentication.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the use of name attribute and loginUrl attribute of a forms element in a web.config file?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Name attribute &lt;/strong&gt;of  forms element is used to set the name of the cookie in which to store  the user’s credential. The default is .authaspx. If more than one  application on the server is using Forms authentication, you need to  specify a unique cookie name for each application.&lt;br /&gt;&lt;strong&gt;loginUrl&lt;/strong&gt;  attribute of forms element is used to set the name of the Web form to  display if the user has not already been authenticated. If omitted, the  default is Default.aspx.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is protection attribute in a forms element used for in web.config file?&lt;/strong&gt;&lt;br /&gt;The  protection attribute of a forms element of web.config file is used for  setting how ASP.NET protects the authentication cookie stored on the  user’s machine. The default is &lt;strong&gt;All&lt;/strong&gt;, which performs encryption and data validation. Other possible settings are &lt;strong&gt;Encryption, Validation, and None&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is timeout attribute in a forms element used for in web.config file?&lt;/strong&gt;&lt;br /&gt;Timeout  attribute is used to set the number of minutes the authentication  cookie persists on the user’s machine. The default is 30, indicating 30  minutes. ASP.NET renews the cookie automatically if it receives a  request from the user and more than half of the allotted time has  expired.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In which namespace the FormsAuthentication class is present?&lt;/strong&gt;&lt;br /&gt;System.Web.Security namespace&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Which method checks the user name and password against the user list found in the credentials element of Web.config?&lt;/strong&gt;&lt;br /&gt;The  FormsAuthentication class’s Authenticate method checks the user name  and password against the user list found in the credentials element of  Web.config.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Which method can be used to remove forms authentication cookie?&lt;/strong&gt;&lt;br /&gt;Use  the signout() method of FormsAuthentication class to sign out when the  user has finished with the application or when you want to remove the  authentication cookie from his or her machine. For example, the  following code ends the user’s access to an application and requires him  or her to sign back in to regain access&lt;br /&gt;&lt;strong&gt;&lt;em&gt;FormsAuthentication.SignOut();&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the advantage of Authenticating Users with a Database?&lt;/strong&gt;&lt;br /&gt;You  can authenticate users based on a list in Web.config. The  FormsAuthentication class’s Authenticate method is set up to read from  web.config file automatically. That’s fine if user names and passwords  are created and maintained by a system administrator, but if you allow  users to create their own user names or change their passwords, you’ll  need to store that information outside the Web.config file. This is  because changing Web.config at run time causes the Web application to  restart, which resets any Application state and Session state variables  used by the application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the advantages of storing user names and passwords in a database rather than a file?&lt;/strong&gt;&lt;br /&gt;You can store user names and passwords in any type of file; however, using a database has the following significant advantages:&lt;br /&gt;1. User names can be used as primary keys to store other information about the user.&lt;br /&gt;2. Databases can provide high performance for accessing user names and passwords.&lt;br /&gt;3. Adding, modifying, and accessing records are standardized through SQL.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you encrypt user names and passwords stored in a file or a database?&lt;/strong&gt;&lt;br /&gt;Yes,  you encrypt user names and passwords stored in a file or a database.  You can encrypt them using the FormsAuthentication class’s &lt;strong&gt;HashPasswordForStoringInConfigFile &lt;/strong&gt;method. This method uses the &lt;strong&gt;SHA1&lt;/strong&gt; or &lt;strong&gt;MD5 &lt;/strong&gt;algorithms to encrypt data, as shown below:&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Password = FormsAuthentication.HashPasswordForStoringInConfigFile(Password, "SHA1");&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you change authentication type in a subfolder's web.config file?&lt;/strong&gt;&lt;br /&gt;Authentication  type (Windows, Forms, or Passport) can be set only at the application’s  root folder. To change authentication type in a subfolder's web.config  file, you must create a new Web application project and application  starting point for that subfolder.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can you control access to subfolders in a web application?&lt;/strong&gt;&lt;br /&gt;The  authorization settings in the Web.config file apply hierarchically  within the folder structure of a Web application. For instance, you  might want to allow all users access to the root folder of a Web  application but restrict access to Web forms (and tasks) available from a  subfolder. To do this, set the authentication type in the root folder’s  Web.config file, and then use the authorization element in the  subfolder’s Web.config file to restrict access.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Windows Authentication-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the advantage of using Windows authentication in a Web application?&lt;br /&gt;&lt;/strong&gt;Windows  authentication uses the security features integrated into the Windows  NT and Windows XP operating systems to authenticate and authorize Web  application users. The advantage of Windows authentication is that your  Web application can use the exact same security scheme that applies to  your corporate network - user names, passwords, and permissions are the  same for network resources and Web applications. One of the key  advantages of Windows authentication is that users who are logged on to  the network don’t have to log on again to access the Web application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the default authentication method when you create a new Web application project? &lt;/strong&gt;&lt;br /&gt;Windows authentication is the default authentication method when you create a new Web application project.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How  do you allow or deny access to specific users using an authorization  list from Web.config file, when using windows authentication? &lt;/strong&gt;&lt;br /&gt;When  the application uses Windows authentication, ASP.NET checks the  project’s Web.config authorization list to see which network users are  allowed to access the application. The asterisk (*) and question mark  (?) characters have special meaning in the authorization list. The *  character indicates all users. The ? character indicates unauthenticated  users.&lt;br /&gt;&lt;br /&gt;To restrict access to specific users, list their names separated by commas in an element.  When ASP.NET checks the authorization list in Web.config, it accepts  the first match that it finds. Be sure to end the authorization list  with a element to deny access to any nonapproved users.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is Role-Based authorization in windows authentication?&lt;br /&gt;&lt;/strong&gt;Role-based  authorization lets you identify groups of users to allow or deny based  on their role in your organization. In Windows NT and Windows XP, roles  map to names used to identify user groups. Windows defines several  built-in groups, including Administrators, Users, and Guests. You can  view, modify, or add groups using the Computer Management console&lt;br /&gt;&lt;br /&gt;To allow or deny access to certain groups of users, add the element to the authorization list in your Web application’s Web.config file.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you get a User Identity?&lt;br /&gt;&lt;/strong&gt;Once  a user is authenticated and authorized, your application can get  information about the user by using the User object’s Identity property.  The Identity property returns an object that includes the user name and  role information, as shown in the following code:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;Label1.Text = User.Identity.IsAuthenticated.ToString();&lt;br /&gt;Label2.Text = User.Identity.Name;&lt;br /&gt;Label3.Text = User.Identity.AuthenticationType;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;How do you determine, what is the role of the current user? &lt;/strong&gt;&lt;br /&gt;The User object provides an IsInRole method to determine the role of the current user, as shown in the following example:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;if(User.IsInRole("Administrators"))&lt;br /&gt;{&lt;br /&gt;// Do something.&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Can you specify authorization settings both in Web.config and in IIS? &lt;/strong&gt;&lt;br /&gt;Yes,  you can specify authorization settings both in Web.config and in IIS.  The IIS setting is evaluated first and then the setting in Web.config is  evaluated. In general, this means that the most restrictive setting  will be used.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the user account under which an ASP.NET web application runs by default?&lt;br /&gt;&lt;/strong&gt;Web application runs under the identity of the ASPNET user account by default.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can you set the web application to run under a specific user’s account? &lt;/strong&gt;&lt;br /&gt;You  can set the application to run under a specific user’s account by  setting the application’s identity element to enable impersonation&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How can you see the impersonated identity under which code is executing?&lt;br /&gt;&lt;/strong&gt;To  see the impersonated identity under which code is executing, use the  WindowsIdentity class’s GetCurrent method, as shown in the sample code  below&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The  identity element can be used with any type of authentication; however,  it is most useful with Windows authentication because Windows  authentication users have accounts with specific permissions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;ADO.Net-&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is Microsoft ADO.NET?&lt;br /&gt;&lt;/strong&gt;Visual  Studio .NET provides access to databases through the set of tools and  namespaces collectively referred to as Microsoft ADO.NET&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the 3 major types of connection objects in ADO.NET? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;OleDbConnection object :&lt;/strong&gt;  Use an OleDbConnection object to connect to a Microsoft Access or  third-party database, such as MySQL. OLE database connections use the  OleDbDataAdapter object to perform commands and return data.&lt;br /&gt;&lt;strong&gt;SqlConnection object :&lt;/strong&gt;  Use a SqlConnection object to connect to a Microsoft SQL Server  database. SQL database connections use the SqlDataAdapter object to  perform commands and return data.&lt;br /&gt;&lt;strong&gt;OracleConnection object :&lt;/strong&gt;  Use an OracleConnection object to connect to Oracle databases. Oracle  database connections use the OracleDataAdapter object to perform  commands and return data. This connection object was introduced in  Microsoft .NET Framework version 1.1.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;List the 4 common ADO.NET Namespaces?&lt;br /&gt;System.Data :&lt;/strong&gt; Contains Classes, types, and services for creating and accessing data sets and their subordinate objects&lt;br /&gt;&lt;strong&gt;System.Data.SqlClient :&lt;/strong&gt; Contains Classes and types for accessing Microsoft SQL Server databases&lt;br /&gt;&lt;strong&gt;System.Data.OracleClient :&lt;/strong&gt; Contains Classes and types for accessing Oracle databases (Microsoft .NET Framework version 1.1 and later)&lt;br /&gt;&lt;strong&gt;System.Data.OleDb :&lt;/strong&gt; Contains Classes and types for accessing other databases&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;List all the steps in order, to access a database through ADO.NET?&lt;br /&gt;1.&lt;/strong&gt; Create a connection to the database using a connection object.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Invoke a command to create a DataSet object using an adapter object.&lt;br /&gt;&lt;strong&gt;3. &lt;/strong&gt;Use the DataSet object in code to display data or to change items in the database.&lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; Invoke a command to update the database from the DataSet object using an adapter object.&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt;  Close the database connection if you explicitly opened it in step 2  using the Open method. Invoking commands without first invoking the Open  method implicitly opens and closes the connection with each request.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Why will you usually create an ASPNET user account in the Database for an ASP.NET web application?&lt;br /&gt;&lt;/strong&gt;Web  applications run using the ASPNET user account. The SQL database  administrator will have to set up this account and grant it permissions  before your Web application will have access to a SQL database. For  file-based databases, such as Microsoft Access, you must grant  permissions on the database file to the ASPNET user account using  Windows file security settings.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between DataReader and DataAdapter? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1. &lt;/strong&gt;Data Reader is read only forward only and much faster than DataAdapter.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt;  If you use DataReader you have to open and close connection explicitly  where as if you use DataAdapter the connection is automatically opened  and closed.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; DataReader is connection oriented where as Data Adapter is disconnected&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Can you inherit from SqlConnection Class?&lt;br /&gt;&lt;/strong&gt;No, you cannot inheirt from SqlConnection Class. SqlConnection Class is a sealed class. It is a compile time error.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Will the connection be closed, if the SqlConnection object goes out of scope? &lt;/strong&gt;&lt;br /&gt;No,  If the SqlConnection goes out of scope, it won't be closed. Therefore,  you must explicitly close the connection by calling Close or Dispose.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What happens if connection pooling is enabled?&lt;br /&gt;&lt;/strong&gt;If  connection pooling is enabled and when you call Close or Dispose  methods, then the connection is returned to the connection pool. This  connection can then be resused.If connection pooling is disabled and  when you call Close or Dispose methods, the underlying connection to the  server is actually closed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you ensure that the database connections are always closed? &lt;/strong&gt;&lt;br /&gt;To  ensure that the database connections are always closed, open the  connection inside of a using block, as shown in the following code  fragment. Doing so ensures that the connection is automatically closed  when the code exits the block.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;using (SqlConnection ConnectionObject = new SqlConnection())&lt;br /&gt;{&lt;br /&gt;ConnectionObject.Open();&lt;br /&gt;//The database connection will be closed when the control exits the using code block&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you read an XML file into a DataSet?&lt;br /&gt;&lt;/strong&gt;Using the DataSet object’s ReadXML method.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;When do you use ExecuteReader, ExecuteNonQuery, ExecuteScalar methods?&lt;br /&gt;&lt;/strong&gt;If the command or stored procedure that is being executed returns a set of rows, then we use ExecuteReader method.&lt;br /&gt;If the command or stored procedure that is being executed returns a single value then we use ExecuteScalar method.&lt;br /&gt;If  the command or stored procedure performs INSERT, DELETE or UPDATE  operations, then we use ExecuteNonQuery method. ExecuteNonQuery method  returns an integer specifying the number of rows inserted, deleted or  updated.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can your class inherit from SqlCommand Class? &lt;/strong&gt;&lt;br /&gt;No, you cannot inheirt from SqlCommand Class. SqlCommand Class is a sealed class. It is a compile time error.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Give an example that shows how to execute a stored procedure in ADO.NET?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;using (SqlConnection ConnectionObject = new SqlConnection())&lt;br /&gt;{&lt;br /&gt;//Specify the name of the stored procedure to execute and the Connection Object to use&lt;br /&gt;SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);&lt;br /&gt;//Specify the SQL Command type is a stored procedure&lt;br /&gt;CommandObject.CommandType = CommandType.StoredProcedure;&lt;br /&gt;//Open the connection&lt;br /&gt;ConnectionObject.Open();&lt;br /&gt;//Execute the Stored Procedure&lt;br /&gt;int RecordsAffected = CommandObject.ExecuteNonQuery();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Can you reuse a SqlCommand object? &lt;/strong&gt;&lt;br /&gt;Yes, you can reset the CommandText property and reuse the SqlCommand object.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the methods that can ensure asynchronous execution of the Transact-SQL statement or stored procedure?&lt;br /&gt;&lt;/strong&gt;BeginExecuteNonQuery&lt;br /&gt;BeginExecuteReader&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is SqlCommand.CommandTimeout Property used for? &lt;/strong&gt;&lt;br /&gt;CommandTimeout  Property is used to Get or set the wait time before terminating the  attempt to execute a command and generating an error.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;//Specify the CommandTimeout property value&lt;br /&gt;SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);&lt;br /&gt;//Wait for 10 seconds to execute the Stored procedure&lt;br /&gt;CommandObject.CommandTimeout = 10; &lt;/span&gt;&lt;br /&gt;The time is in seconds. The default is 30 seconds.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you create an instance of SqlDataReader class?&lt;br /&gt;&lt;/strong&gt;To  create an instance of SqlDataReader class, you must call the  ExecuteReader method of the SqlCommand object, instead of directly using  a constructor.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;//Error! Cannot use SqlDataReader() constructor&lt;br /&gt;//to create an instance of SqlDataReader class&lt;br /&gt;SqlDataReader ReaderObject = new SqlDataReader();&lt;br /&gt;&lt;br /&gt;//Call the ExecuteReader method of the SqlCommand object&lt;br /&gt;SqlCommand CommandObject = new SqlCommand();&lt;br /&gt;SqlDataReader ReaderObject = CommandObject.ExecuteReader();&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Creating  an instance of SqlDataReader class using SqlDataReader() constructor  generates a compile time error - The type  'System.Data.SqlClient.SqlDataReader' has no constructors defined.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you programatically check if a specified SqlDataReader instance has been closed?&lt;br /&gt;&lt;/strong&gt;Use  the IsClosed property of SqlDataReader to check if a specified  SqlDataReader instance has been closed. If IsClosed property returns  true, the SqlDataReader instance has been closed else not closed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you get the total number of columns in the current row of a SqlDataReader instance? &lt;/strong&gt;&lt;br /&gt;FieldCount property can be used to get the total number of columns in the current row of a SqlDataReader instance.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Give an example for executing a stored procedure with parameters?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;//Create the Connection Object&lt;br /&gt;SqlConnection ConnectionObject = new SqlConnection(ConnectionString);&lt;br /&gt;//Create the Command Object&lt;br /&gt;SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);&lt;br /&gt;//Specify to CommandObject that you intend to execute a Stored Procedure&lt;br /&gt;CommandObject.CommandType = CommandType.StoredProcedure;&lt;br /&gt;//Create an SQL Parameter object&lt;br /&gt;SqlParameter ParameterObject = new SqlParameter();&lt;br /&gt;//Specify the name of the SQL Parameter&lt;br /&gt;ParameterObject.ParameterName = "Parameter1";&lt;br /&gt;//Assign the Parameter value&lt;br /&gt;ParameterObject.Value = "Some Value";&lt;br /&gt;//Specify the Database DataType of the Parameter&lt;br /&gt;ParameterObject.DbType = DbType.String;&lt;br /&gt;//Specify the type of parameter - input-only, output-only, bidirectional&lt;br /&gt;ParameterObject.Direction = ParameterDirection.Input;&lt;br /&gt;//Associate the Parameter to the Command Object&lt;br /&gt;CommandObject.Parameters.Add(ParameterObject);&lt;br /&gt;//Open the connection&lt;br /&gt;ConnectionObject.Open();&lt;br /&gt;//Execute the command&lt;br /&gt;int Records_Affected = CommandObject.ExecuteNonQuery();&lt;br /&gt;//Close the Connection&lt;br /&gt;ConnectionObject.Close();&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the use of SqlParameter.Direction Property?&lt;br /&gt;&lt;/strong&gt;SqlParameter.Direction  Property is used to specify the Sql Parameter type - input-only,  output-only, bidirectional, or a stored procedure return value  parameter. The default is Input.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you retrieve two tables of data at the same time by using data reader? &lt;/strong&gt;&lt;br /&gt;Include  2 select statements either in a stored procedure or in a select command  and call the ExecuteReader() method on the command object. This will  automatically fill the DataReader with 2 Tables of data.&lt;br /&gt;&lt;br /&gt;The  datareader will always return the data from first table only. If you  want to get the second table then you need to use  ReaderObject.NextResult() method. The NextResult() method will return  true if there is another table. The following code shows you how do it.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;//Create the SQL Query with 2 Select statements&lt;br /&gt;string SQLQuery = "Select * from Customers;Select * from Employees;";&lt;br /&gt;//Create the Connection Object&lt;br /&gt;SqlConnection ConnectionObject = new SqlConnection(ConnectionString);&lt;br /&gt;//Create the Command Object&lt;br /&gt;SqlCommand CommandObject = new SqlCommand(SQLQuery, ConnectionObject);&lt;br /&gt;//Open the connection&lt;br /&gt;ConnectionObject.Open();&lt;br /&gt;//Execute the command. Now reader object will have 2 tables of data.&lt;br /&gt;SqlDataReader ReaderObject = CommandObject.ExecuteReader();&lt;br /&gt;//Loop thru the tables in the DataReader object&lt;br /&gt;while (ReaderObject.NextResult())&lt;br /&gt;{&lt;br /&gt;while (ReaderObject.Read())&lt;br /&gt;{&lt;br /&gt;//Do Something&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;//Close the Reader&lt;br /&gt;ReaderObject.Close();&lt;br /&gt;//Close the Connection&lt;br /&gt;ConnectionObject.Close();&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;What are the advantages of using SQL stored procedures instead of adhoc SQL queries in an ASP.NET web application? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Better Performance :&lt;/strong&gt;  As stored procedures are precompiled objects they execute faster than  SQL queries. Every time we run a SQL query, the query has to be first  compiled and then executed where as a stored procedure is already  compiled. Hence executing stored procedures is much faster than  executing SQL queries.&lt;br /&gt;&lt;strong&gt;Better Security : &lt;/strong&gt;For a given  stored procedure you can specify who has the rights to execute. You  cannot do the same for an SQL query. Writing the SQL statements inside  our code is usually not a good idea. In this way you expose your  database schema (design) in the code which may be changed. Hence most of  the time programmers use stored procedures instead of plain SQL  statements.&lt;br /&gt;&lt;strong&gt;Reduced Network Traffic : &lt;/strong&gt;Stored  Procedures reside on the database server. If you have to execute a  Stored Procedure from your ASP.NET web application, you just specify the  name of the Stored Procedure. So over the network you just send the  name of the Stored Procedure. With an SQL query you have to send all the  SQL statements over the network to the database server which could lead  to increased network traffic.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Can you update the database using DataReader object?&lt;br /&gt;&lt;/strong&gt;No,  You cannot update the database using DataReader object. DataReader is  read-only, foward only. It reads one record at atime. After DataReader  finishes reading the current record, it moves to the next record. There  is no way you can go back to the previous record.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between a DataReader and a DataSet? &lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;DataReader&lt;br /&gt;1.&lt;/strong&gt; DatReader works on a Connection oriented architecture.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt;  DataReader is read only, forward only. It reads one record at atime.  After DataReader finishes reading the current record, it moves to the  next record. There is no way you can go back to the previous record. So  using a DataReader you read in forward direction only.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Updations are not possible with DataReader.&lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; As DataReader is read only, forward only it is much faster than a DataSet.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;DataSet&lt;br /&gt;1.&lt;/strong&gt; DataSet works on disconnected architecture.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Using a DataSet you can move in both directions. DataSet is bi directional.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Database can be updated from a DataSet.&lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; DataSet is slower than DataReader.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Give an example scenario of using a DataSet and a DataReader?&lt;br /&gt;&lt;/strong&gt;If you want to just read and display the data(No updates, deletes, or inserts) then use a DataReader.&lt;br /&gt;If you want to do a batch inserts, updates and deletes then use a DataSet.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;Themes and Skins-&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is a "theme" in ASP.NET?&lt;br /&gt;&lt;/strong&gt;A  "theme" is a collection of property settings that allow you to define  the look of pages and controls, and then apply the look consistently  across pages in a Web application, across an entire Web application, or  across all Web applications on a server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the extension for a skin file? &lt;/strong&gt;&lt;br /&gt;.skin&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the 2 types of control skins in ASP.NET?&lt;br /&gt;1. &lt;/strong&gt;Default skins&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Named skins&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the difference between Named skins and Default skins?&lt;br /&gt;&lt;/strong&gt;A &lt;strong&gt;default skin&lt;/strong&gt;  automatically applies to all controls of the same type when a theme is  applied to a page. A control skin is a default skin if it does not have a  SkinID attribute. For example, if you create a default skin for a  Calendar control, the control skin applies to all Calendar controls on  pages that use the theme. (Default skins are matched exactly by control  type, so that a Button control skin applies to all Button controls, but  not to LinkButton controls or to controls that derive from the Button  object.)&lt;br /&gt;&lt;br /&gt;A &lt;strong&gt;named skin&lt;/strong&gt; is a control skin with a  SkinID property set. Named skins do not automatically apply to controls  by type. Instead, you explicitly apply a named skin to a control by  setting the control's SkinID property. Creating named skins allows you  to set different skins for different instances of the same control in an  application.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the 3 levels at which a theme can be applied for a web application?&lt;br /&gt;1&lt;/strong&gt;. At the page level - Use the Theme or StyleSheetTheme attribute of the @ Page directive.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt;  At the application level - Can be applied to all pages in an  application by setting the &lt;pages&gt; element in the application  configuration file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; At the web server level -  Define the &lt;pages&gt; element in machine.config file. This will  apply the theme to all the web applications on that web server.&lt;br /&gt;&lt;br /&gt;&lt;/pages&gt;&lt;/pages&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the name of the folder that contains the application themes?&lt;br /&gt;&lt;/strong&gt;App_Themes&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is a global theme? &lt;/strong&gt;&lt;br /&gt;A &lt;strong&gt;global theme &lt;/strong&gt;is  a theme that you can apply to all the Web sites on a server. Global  themes allow you to define an overall look for your domain when you  maintain multiple Web sites on the same server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between themes and CSS? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt;  Themes can define many properties of a control or page, not just style  properties. For example, using themes, you can specify the graphics for a  TreeView control, the template layout of a GridView control, and so on.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Themes can include graphics.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt;  Themes do not cascade the way style sheets do. By default, any property  values defined in a theme referenced by a page's Theme property  override the property values declaratively set on a control, unless you  explicitly apply the theme using the StyleSheetTheme property.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. &lt;/strong&gt;Only  one theme can be applied to each page. You cannot apply multiple themes  to a page, unlike style sheets where multiple style sheets can be  applied.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the security concerns to keep in mind when using themes?&lt;br /&gt;&lt;/strong&gt;Themes can cause security issues when they are used on your Web site. Malicious themes can be used to:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Alter a control's behavior so that it does not behave as expected.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Inject client-side script, therefore posing a cross-site scripting risk.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Expose sensitive information.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. &lt;/strong&gt;The mitigations for these common threats are:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt;  Protect the global and application theme directories with proper access  control settings. Only trusted users should be allowed to write files  to the theme directories.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;6. &lt;/strong&gt;Do not use themes  from an untrusted source. Always examine any themes from outside your  organization for malicious code before using them on you Web site.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;7.&lt;/strong&gt;  Do not expose the theme name in query data. Malicious users could use  this information to use themes that are unknown to the developer and  thereby expose sensitive information.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Arrays-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the difference between arrays in C# and arrays in other programming languages?&lt;/strong&gt;&lt;br /&gt;Arrays  in C# work similarly to how arrays work in most other popular languages  There are, however, a few differences as listed below&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. &lt;/strong&gt;When  declaring an array in C#, the square brackets ([]) must come after the  type, not the identifier. Placing the brackets after the identifier is  not legal syntax in C#.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;int[] IntegerArray; // not int IntegerArray[];&lt;br /&gt;&lt;br /&gt;2.&lt;/strong&gt;  Another difference is that the size of the array is not part of its  type as it is in the C language. This allows you to declare an array and  assign any array of int objects to it, regardless of the array's  length.&lt;br /&gt;&lt;br /&gt;int[] IntegerArray; // declare IntegerArray as an int array of any size&lt;br /&gt;IntegerArray = new int[10];  // IntegerArray is a 10 element array&lt;br /&gt;IntegerArray = new int[50];  // now IntegerArray is a 50 element array&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the 3 different types of arrays that we have in C#?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;1.&lt;/strong&gt; Single Dimensional Arrays&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Multi Dimensional Arrays also called as rectangular arrays&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Array Of Arrays also called as jagged arrays&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Are arrays in C# value types or reference types?&lt;br /&gt;&lt;/strong&gt;Reference types.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the base class for all arrays in C#?&lt;br /&gt;&lt;/strong&gt;System.Array&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you sort an array in C#?&lt;br /&gt;&lt;/strong&gt;The Sort static method of the Array class can be used to sort array items.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Give an example to print the numbers in the array in descending order?&lt;br /&gt;&lt;/strong&gt;using System;&lt;br /&gt;namespace ConsoleApplication&lt;br /&gt;{&lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;static void Main()&lt;br /&gt;{&lt;br /&gt;int[] Numbers = { 2, 5, 3, 1, 4 };&lt;br /&gt;//Print the numbers in the array without sorting&lt;br /&gt;Console.WriteLine("Printing the numbers in the array without sorting");&lt;br /&gt;foreach (int i in Numbers)&lt;br /&gt;{&lt;br /&gt;Console.WriteLine(i);&lt;br /&gt;}&lt;br /&gt;//Sort and then print the numbers in the array&lt;br /&gt;Console.WriteLine("Printing the numbers in the array after sorting");&lt;br /&gt;Array.Sort(Numbers);&lt;br /&gt;foreach (int i in Numbers)&lt;br /&gt;{&lt;br /&gt;Console.WriteLine(i);&lt;br /&gt;}&lt;br /&gt;//Print the numbers in the array in desceding order&lt;br /&gt;Console.WriteLine("Printing the numbers in the array in desceding order");&lt;br /&gt;Array.Reverse(Numbers);&lt;br /&gt;foreach (int i in Numbers)&lt;br /&gt;{&lt;br /&gt;Console.WriteLine(i);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What property of an array object can be used to get the total number of elements in an array?&lt;/strong&gt;&lt;br /&gt;Length property of array object gives you the total number of elements in an array. An example is shown below.&lt;br /&gt;using System;&lt;br /&gt;namespace ConsoleApplication&lt;br /&gt;{&lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;static void Main()&lt;br /&gt;{&lt;br /&gt;int[] Numbers = { 2, 5, 3, 1, 4 };&lt;br /&gt;Console.WriteLine("Total number of elements = " +Numbers.Length);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Give an example to show how to copy one array into another array?&lt;br /&gt;&lt;/strong&gt;We can use CopyTo() method to copy one array into another array. An example is shown below.&lt;br /&gt;using System;&lt;br /&gt;namespace ConsoleApplication&lt;br /&gt;{&lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;static void Main()&lt;br /&gt;{&lt;br /&gt;int[] Numbers = { 2, 5, 3, 1, 4 };&lt;br /&gt;int[] CopyOfNumbers=new int[5];&lt;br /&gt;Numbers.CopyTo(CopyOfNumbers,0);&lt;br /&gt;foreach (int i in CopyOfNumbers)&lt;br /&gt;{&lt;br /&gt;Console.WriteLine(i);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;Caching-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is caching?&lt;br /&gt;&lt;/strong&gt;High-performance Web applications should be designed with &lt;strong&gt;caching&lt;/strong&gt;  in mind. Caching is the technique of storing frequently used items in  memory so that they can be accessed more quickly. Caching is important  to Web applications because each time a Web form is requested, the host  server must process the Web form’s HTML and run Web form code to create a  response. By caching the response, all that work is bypassed. Instead,  the request is served from the reponse already stored in memory.&lt;br /&gt;&lt;br /&gt;Caching  an item incurs considerable overhead, so it’s important to choose the  items to cache wisely. A Web form is a good candidate for caching if it  is frequently used and does not contain data that frequently changes. By  storing a Web form in memory, you are effectively freezing that form’s  server-side content so that changes to that content do not appear until  the cache is refreshed.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What directive is used to cache a web form?&lt;br /&gt;&lt;/strong&gt;The &lt;strong&gt;@OutputCache&lt;/strong&gt; page directive is used to cache a Web form in the server’s memory.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the use of duration attribute of @OutputCache page directive?&lt;br /&gt;&lt;/strong&gt;The &lt;strong&gt;@OutputCache&lt;/strong&gt; directive’s &lt;strong&gt;Duration&lt;/strong&gt; attribute controls how long the page is &lt;strong&gt;cached&lt;/strong&gt;. For example if you set the duration attribute to 60 seconds, the Web form is cached for 60 seconds.&lt;br /&gt;&lt;br /&gt;The  first time any user requests the Web form, the server loads the  response in memory and retains that response for 60 seconds. Any  subsequent requests during that time receive the cached response.&lt;br /&gt;&lt;br /&gt;After  the cache duration has expired, the next request for the Web form  generates a new response, which is then cached for another 60 seconds.  Thus the server processes the Web form once every 60 seconds at most.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the 2 required attributes of the @OutputCache directive?&lt;br /&gt;&lt;/strong&gt;The @OutputCache directive has two required attributes:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Duration&lt;br /&gt;2. &lt;/strong&gt;&lt;strong&gt;VaryByParam. &lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you cache multiple responses from a single Web form?&lt;br /&gt;&lt;/strong&gt;The &lt;strong&gt;VaryByParam&lt;/strong&gt;  attribute lets you cache multiple responses from a single Web form  based on varying HTTP POST or query string parameters. Setting  VaryByParam to None caches only one response for the Web form,  regardless of the parameters sent.&lt;br /&gt;&lt;br /&gt;You can also &lt;strong&gt;cache &lt;/strong&gt;multiple responses from a single Web form using the VaryByHeaders or VaryByCustom attribute.&lt;br /&gt;&lt;br /&gt;The VaryByCustom attribute lets you &lt;strong&gt;cache &lt;/strong&gt;different  responses based on a custom string. To use VaryByCustom, override the  GetVaryByCustomString method in the Web application’s Global.asax file.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Is it possible to cache a web form without using @OutputCache directive?&lt;br /&gt;&lt;/strong&gt;Yes, you can &lt;strong&gt;cache&lt;/strong&gt; a web form using the &lt;strong&gt;Response &lt;/strong&gt;object’s &lt;strong&gt;Cache &lt;/strong&gt;property,  which returns an HttpCachePolicy object for the response. The  HttpCachePolicy object provides members that are similar to the &lt;strong&gt;OutputCache &lt;/strong&gt;directive’s attributes.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Give a simple example to show how to cache a web form without using @OutputCache directive?&lt;br /&gt;&lt;/strong&gt;For example, the following code caches the Web form’s response for 60 seconds:&lt;br /&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;// Cache this page&lt;br /&gt;DateTimeLabel.Text = System.DateTime.Now.ToString();&lt;br /&gt;// Set OutputCache Duration. Response.Cache.SetExpires(System.DateTime.Now.AddSeconds(60));&lt;br /&gt;// Set OutputCache VaryByParams.&lt;br /&gt;Response.Cache.VaryByParams["None"] = true;&lt;br /&gt;// Set OutputCache Location.&lt;br /&gt;Response.Cache.SetCacheability(HttpCacheability.Public);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The preceding code is equivalent to the following OutputCache directive:&lt;br /&gt;@ OutputCache Duration="5" VaryByParam="None" Location="Any"&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is @OutputCache directive’s Location attribute and the HttpCachePolicy object’s SetCacheability property used for?&lt;/strong&gt;&lt;br /&gt;The &lt;strong&gt;@OutputCache&lt;/strong&gt;  directive’s Location attribute and the HttpCachePolicy object’s  SetCacheability property determine where Microsoft ASP.NET stores cached  responses. By default, ASP.NET caches responses at any available  location that accepts cache items - the client, proxy servers, or the  host server. In practice, those locations might or might not allow  caching, so you can think of the &lt;strong&gt;Location/SetCacheability&lt;/strong&gt; setting as more of a request than a command.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is HttpCachePolicy object’s SetAllowResponseInBrowserHistory method used for?&lt;br /&gt;&lt;/strong&gt;You can override the &lt;strong&gt;cache location&lt;/strong&gt; settings using the &lt;strong&gt;HttpCachePolicy &lt;/strong&gt;object’s  SetAllowResponseInBrowserHistory method. Setting that method to True  allows the response to be stored in the client’s history folder even if  the location setting is None or Server.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Which object can used to store frequently used items in the server’s memory for quick retrieval?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Cache object can be used to store frequently used items in the server’s memory for quick retrieval.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Is the cache object available for all web forms with in a web application?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Yes,  the Cache object is global, that is, data stored in the Cache object is  available anywhere within a Web application. In this way, the Cache  object is very similar to the intrinsic Application object.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;What are the 3 different ways to store data in the Cache object?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Use assignment.&lt;/strong&gt;&lt;br /&gt;Assigning  a value to an unused key in the Cache object automatically creates that  key and assigns the value to that key. Assigning a value to a key that  already exists replaces the cached value with the assigned value.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Use the Insert method.&lt;br /&gt;&lt;/strong&gt;The  Insert method uses parameters rather than assignment to create or  change cached data. Insert optionally accepts parameters to establish  dependencies and set expiration policy.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Use the Add method.&lt;br /&gt;&lt;/strong&gt;The Add method is similar to Insert; however, it requires all parameters and returns an object reference to the cached data.&lt;br /&gt;&lt;br /&gt;For example, the following Cache statements all add the same item to the cache:&lt;br /&gt;&lt;br /&gt;using System.Web.Caching;&lt;br /&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;if(!IsPostBack)    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;    {        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;       Cache["NewItem"] = "Some string data";        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;        Cache.Add("NewItem", "Some string data", null,  Cache.NoAbsoluteExpiration, System.TimeSpan.FromMinutes(1),  CacheItemPriority.Default, null);        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;       Cache.Insert("NewItem", "Some string data");    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;What are absoluteExpiration and slidingExpiration parmeters of the Insert and Add methods?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;absoluteExpiration&lt;br /&gt;&lt;/strong&gt;A  DateTime object that identifies when the data should be removed from  the cache. If you’re using sliding expiration, specify  Cache.NoAbsoluteExpiration for this parameter.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;slidingExpiration&lt;br /&gt;&lt;/strong&gt;A  TimeSpan object that identifies how long the data should remain in the  cache after the data was last accessed. If you’re using absolute  expiration, specify Cache.NoSlidingExpiration for this parameter.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Which delegate can be used to notify the application when items are removed from the cache?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;onRemoveCallback is used to notify the application when items are removed from the cache.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;How do you retrieve the value of a cache item stored in the servers memory?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;You  can retrieve the value of a cache item stored in the servers memory  through the item’s key, just as you do with the Application and Session  objects. Because cached items might be removed from memory, you should  always check for their existence before attempting to retrieve their  value, as shown in the following code:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;private void Button1_Click(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;{    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;     if (Cache["ChachedItem"] == null)     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;     {        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;         Lable1.Text = "Cached Item not found.";    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;     }    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;     else    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;     {        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;         Lable1.Text = Cache["ChachedItem"].ToString();    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;     }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Which method can be used to remove data from the cache?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Cache object’s Remove method can be used to remove data from the cache as shown in the following code example / sample.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;private void RemoveButton_Click(object sender, System.EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;{    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;     Cache.Remove("CachedItem");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;How do you control how long data is cached?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The  Cache object’s Add and Insert method parameters allow you to control  how long an item is stored in the server’s memory. In practice, these  parameter settings provide only indirect control of how long data  remains in memory. If your server runs low on available memory, ASP.NET  recovers as much memory as possible from expired cache items. If that’s  not enough, ASP.NET will unload unexpired items from the cache based on  their priority and when they were last accessed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;What is CacheItemPriority enumeration used for?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;CacheItemPriority  enumeration is used to set the relative importance of cached items.  CacheItemPriority.NotRemoveable has the highest priority and  CacheItemPriority.Low has the lowest priority.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Which is the only "event” provided by Cache object?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;CacheItemRemoved "event” is the only "event” provided by Cache object. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;How do you update the Cache object when data changes?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Items  stored in the cache are often copies of data that is stored and  maintained elsewhere, such as records in a database. Use the Add and  Insert methods’ dependency parameter to establish a relationship between  a cached data item and an external source, such as a file, a folder, or  a group of files.&lt;br /&gt;&lt;br /&gt;The dependency parameter accepts a  CacheDependency object, which in turn identifies the file, folder, or  set of files to watch for changes. ASP.NET checks the time stamp of the  items in the CacheDependency object, if one of those time stamps is  later than the DateTime entered for the cached item, ASP.NET unloads  that item from the cache.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is fragment caching?&lt;/strong&gt;&lt;br /&gt;Caching parts of web form is called as &lt;strong&gt;fragment caching&lt;/strong&gt;.  Sometimes you want to cache only part of a Web form response. For  instance, a Web form might contain many pieces of variable information  plus a single large table that almost never changes. In this case, you  might place that table in a Web user control and store the response for  that control in cache. This technique is called &lt;strong&gt;fragment caching.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the steps to follow to cache parts of web form?&lt;/strong&gt;&lt;br /&gt;To cache part of a Web form, follow these steps:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Place the controls and content that you want to cache in a Web user control.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Set the caching attributes for that Web user control.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Create an instance of the Web user control on the Web form.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is PartialCaching attribute used for?&lt;/strong&gt;&lt;br /&gt;You can include the &lt;strong&gt;PartialCaching&lt;/strong&gt; attribute in the control’s class declaration to enable &lt;strong&gt;fragment caching.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the OutputCache directive attributes that apply only to user controls?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Shared&lt;/strong&gt;&lt;br /&gt;Cache  a single response from a user control for use on multiple Web forms. By  default, ASP.NET caches a separate response for each Web form that uses  a cached user control. This attribute is only available in the .NET  Framework version 1.1 or later.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;VaryByControl&lt;/strong&gt;&lt;br /&gt;Cache multiple responses for a single user &lt;strong&gt;control based &lt;/strong&gt;on  the value of one or more controls contained in the user control. Can  you cache multiple versions of a user control?Yes, You can cache  multiple versions of a user control based on the value of controls  contained in a user control (VaryByControl) or based on a custom string  (VaryByCustom).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;If a user control is read from the cache, can you access its members from code?&lt;/strong&gt;&lt;br /&gt;No,  In general, cached controls are used to present data such as queries  from a database, rather than as interactive components. However, if you  do need to access a cached control from code, you must first check that  the control exists. If the control is read from the cache, you can’t  access its members from code. Control members are available only when  the control is not read from the cache, such as when the control is  first instantiated and when it is reloaded after its cache duration has  expired.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;When caching is set at both the Web form and user control levels, How does the cache settings interact? &lt;/strong&gt;&lt;br /&gt;The cache location is determined by the Web form setting. Location settings on a user control have no affect.&lt;br /&gt;If  the Web form’s cache duration is longer than the user control’s, both  the Web form response and the user control response will expire using  the Web form setting.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Cookies-&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are Cookies in ASP.NET? &lt;/strong&gt;&lt;br /&gt;Cookies  are small pieces of information stored on the client computer.Use  cookies to store small amounts of information on the client’s machine.  Web sites often use cookies to store user preferences or other  information that is client-specific. Because cookies can be refused, it  is important to check whether the browser allows them before you try to  create them.They are limited to storing only character data and they are  limited to 4K in size.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are different types of Cookies?&lt;br /&gt;&lt;/strong&gt;Session Cookies&lt;br /&gt;Persistent Cookies&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are Session Cookies? &lt;/strong&gt;&lt;br /&gt;Session cookies are stored in-memory during the client browser session. When the browser is closed the session cookies are lost.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How can you create Session Cookies?&lt;br /&gt;&lt;/strong&gt;You  can create session cookies by calling the Add method of the Cookies  collection on the Response object. The Cookies collection contains  individual cookie objects of type HttpCookie.&lt;br /&gt;&lt;br /&gt;//Code to create a UserName cookie containing the name David.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;HttpCookie CookieObject = new HttpCookie("UserName", "David");&lt;br /&gt;Response.Cookies.Add(CookieObject); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;//Code to read the Cookie created above&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Request.Cookies["UserName"].Value;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the difference between Session Cookies and Persistent Cookies?&lt;br /&gt;&lt;/strong&gt;Persistent  Cookies are same as Session Cookies except that, persistent cookies  have an expiration date. The expiration date indicates to the browser  that it should write the cookie to the client's hard drive. Keep in mind  that because a user can delete cookies from their machine that there is  no guarantee that a cookie you "drop" on a user machine will be there  the next time they visit your site.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are Persistent Cookies used for? &lt;/strong&gt;&lt;br /&gt;Persistent  cookies are generally used to store information that identifies a  returning user to a Web site. Typical information found in Persistent  Cookies includes user names or user IDs.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you create a Persistent Cookie?&lt;br /&gt;&lt;/strong&gt;You  create a persistent cookie the same way as session cookies except that  you set the Expires property to a Date in the future which will store  the Cookie to the client computer harddrive.&lt;br /&gt;&lt;br /&gt;//Code to create a UserName Persistent Cookie that lives for 10 days&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;HttpCookie CookieObject = new HttpCookie("UserName", "David");&lt;br /&gt;CookieObject.Expires = DateTime.Now.AddDays(10);&lt;br /&gt;Response.Cookies.Add(CookieObject); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;//Code to read the Cookie created above&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Request.Cookies["UserName"].Value; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is Cookie Dictionary? &lt;/strong&gt;&lt;br /&gt;A  cookie dictionary is a single cookie object that stores multiple pieces  of information. You use the Values property to access and assign new  values to the cookie dictionary.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Give an example using Cookie Dictionary?&lt;br /&gt;&lt;/strong&gt;//Code to create a Cookie Dictionary&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;HttpCookie CookieObject = new HttpCookie("UserPreference"); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;//Use the Values property to assign new values to the cookie dictionary&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;CookieObject.Values.Add("UserName", "David");&lt;br /&gt;CookieObject.Values.Add("Country", "USA");&lt;br /&gt;CookieObject.Values.Add("PreviousVisit", DateTime.Now.ToString());&lt;br /&gt;CookieObject.Expires = DateTime.MaxValue; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;//Add the Cookie to the client machine using the Response object&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Response.Cookies.Add(CookieObject);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;//Code to read the Cookie created above&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;HttpCookie ObjectCookie = Request.Cookies["UserPreference"];&lt;br /&gt;string UserName = ObjectCookie.Values["UserName"];&lt;br /&gt;string Country = ObjectCookie.Values["Country"];&lt;br /&gt;string PreviousVisit = ObjectCookie.Values["PreviousVisit"];&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;What are the advantages of Using Cookies? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Cookies do not require any server resources since they are stored on the client.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Cookies are easy to implement.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt;  You can configure cookies to expire when the browser session ends  (session cookies) or they can exist for a specified length of time on  the client computer (persistent cookies).&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;What are the disadvantages of Using Cookies?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;1.&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt; Users can delete a cookies.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Users browser can refuse cookies,so your code has to anticipate that possibility.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt;  Cookies exist as plain text on the client machine and they may pose a  possible security risk as anyone can open and tamper with cookies.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you create a Cookie that never expires?&lt;br /&gt;&lt;/strong&gt;To create a Cookie that never expires set the Expires property of the Cookie object to DateTime.MaxValue.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Are Cookies secure? &lt;/strong&gt;&lt;br /&gt;No, Cookies are not secure. You must pay attention to the type of data you store in cookies.&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Cookies are not designed to store critical information so storing passwords in a cookie is a bad idea.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Keep the lifetime of a cookie as short as practically possible.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Encrypt cookie data to help protect the values stored in the cookie.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Exception Handling-&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are Exceptions? &lt;/strong&gt;&lt;br /&gt;Exceptions are unusual occurrences that happen  within the logic of an application.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the 3 approaches to handle  exceptions in a Web application?&lt;br /&gt;1.&lt;/strong&gt; Use exception-handling  structures to deal with exceptions within the scope of a procedure. This  technique is called structured exception handling (SEH) in the Visual Studio  .NET documentation.&lt;br /&gt;&lt;strong&gt;try&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;catch&lt;br /&gt;finally  &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Use error events to deal with exceptions within  the scope of an object.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Page_Error&lt;br /&gt;Global_Error  &lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Application_Error&lt;br /&gt;3.&lt;/strong&gt; Use custom  error pages to display informational messages for unhandled exceptions within  the scope of a Web application.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Where will the control flow if an exception  occurs inside a try block?&lt;br /&gt;&lt;/strong&gt;If a statement in a try block causes an  exception, control flow passes immediately to the next catch statement. When  control flow passes to a catch block, the statements contained in the catch  block are processed to correct the error or otherwise handle the  exception.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Will the finally block gets executed, if an exception  occurs? &lt;/strong&gt;&lt;br /&gt;Yes, a finally block will always be executed irrespective  of whether an exception has occured or not.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the main use of a finally block in  exception handling?&lt;br /&gt;&lt;/strong&gt;Finally block is mainly used to free resources  used within the try block.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you raise an exception?  &lt;/strong&gt;&lt;br /&gt;Use the throw keyword to raise an exception. Use this keyword  within your exception-handling structure to immediately pass control flow to the  catch statement.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Will  the following code block compile?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color: rgb(0, 0, 153);font-family:verdana;" &gt;try&lt;br /&gt;{&lt;br /&gt;throw new  System.IO.FileNotFoundException();&lt;br /&gt;}&lt;br /&gt;catch (Exception  E)&lt;br /&gt;{&lt;br /&gt;Response.Write(E.Message);&lt;br /&gt;}&lt;br /&gt;catch  (System.IO.FileNotFoundException  FNFE)&lt;br /&gt;{&lt;br /&gt;Response.Write(FNFE.Message);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;No, a compile time error&lt;/strong&gt; A  previous catch clause already catches all exceptions of this or of a super type  ('System.Exception').&lt;br /&gt;&lt;br /&gt;Catch blocks are evaluated in the order in which  they appear in code. The exception declaration of each catch block determines  which type of exception the catch block handles. Always order catch blocks from  most specific to most general. So, in the preceding sample,  FileNotFoundException should be placed before the general Exception catch  block.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is  ApplicationException class used for?&lt;br /&gt;&lt;/strong&gt;If you are creating a large  application or creating components that are used by other applications, you  might want to define your own exception classes based on the  ApplicationException class. For example, the following code defines a class for  the UserLoggedOnException:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;public class UserLoggedOnException :  System.ApplicationException&lt;br /&gt;{&lt;br /&gt;// Exception constructor  (overloaded).&lt;br /&gt;public UserLoggedOnException()&lt;br /&gt;: this("The user is already  logged on to the server", null)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;public UserLoggedOnException(string  message)&lt;br /&gt;: this(message, null)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;public  UserLoggedOnException(string message, Exception inner)&lt;br /&gt;: base(message,  inner)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;The preceding UserLoggedOnException class  inherits its properties and methods from the ApplicationException base class.  The new exception class provides only its own constructor to set the default  message to display. This is a standard practice.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are Error  Events? &lt;/strong&gt;&lt;br /&gt;Another way to handle exceptions is through the Web  objects’ built-in error events. When an unhandled exception occurs in a Web  application, ASP.NET fires the error events shown below.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Page_Error :&lt;/strong&gt; Occurs when an  unhandled exception occurs on the page. This event procedure resides in the Web  form.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Global_Error  :&lt;/strong&gt; Occurs when an unhandled exception occurs in the application. This  event procedure resides in the Global.asax file.&lt;br /&gt;&lt;strong&gt;Application_Error  :&lt;/strong&gt; Occurs when an unhandled exception occurs in the application. This  event procedure resides in the Global.asax file.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Error events let you handle exceptions for an  entire object in a single, centralized location—the error event procedure. This  is different from using exception-handling structures, in which exceptions are  handled within the procedure where they occurred. You can use error events in  the following ways:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;As  a substitute for exception-handling structures :&lt;br /&gt;&lt;/strong&gt;Because error  events occur outside the scope of the procedure in which the error occurred, you  have less information about the steps leading up to the exception and therefore  less ability to correct the exception condition for the user. However, using  exception-handling events is fine for tasks where you might not be able to  correct the exception in code.&lt;br /&gt;&lt;strong&gt;As an adjunct to exception-handling  structures :&lt;/strong&gt;&lt;br /&gt;Error events can provide a centralized “backstop”  against exceptions that were not foreseen or handled elsewhere. Using the two  exception-handling techniques together lets you catch all exceptions before the  user sees them, display a reasonable message, and even record the exception in a  log as part of an ongoing effort to improve your  application.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Give an  example to show how error events can be used to handle  exceptions?&lt;br /&gt;&lt;/strong&gt;To handle an exception using error events, follow these  steps:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; In the Page_Error event procedure, get the  exception that occurred using the GetLastError method.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Do  something with the exception, such as display a message to the user, take steps  to correct the problem, or write to an error log.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Clear  the exception using the ClearError method.&lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; Redisplay the  page. Web form processing stops immediately when an exception occurs, so server  controls and other items on the page might not be displayed after the exception  is cleared.&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt; Add the following code to Page_Error event  procedure on the web page.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;private void Page_Error(object sender, System.EventArgs  e)&lt;br /&gt;{&lt;br /&gt;// Get the error.&lt;br /&gt;Exception ex = Server.GetLastError();&lt;br /&gt;//  Store the message in a session object.&lt;br /&gt;Session["Error"] = ex.Message;&lt;br /&gt;//  Clear the error message.&lt;br /&gt;Server.ClearError();&lt;br /&gt;// Redisplay this  page.&lt;br /&gt;Server.Transfer("ErrorEvents.aspx");&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;The preceding code  stores the exception message as a Session state variable before clearing the  exception so that the message can be displayed when the page is reloaded by the  Transfer method. The following code displays the saved exception message when  the page is redisplayed:&lt;br /&gt;&lt;br /&gt;Add the following code to Page_Load event  procedure on the web page.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;private void Page_Load(object sender, System.EventArgs  e)&lt;br /&gt;{&lt;br /&gt;// Display error. if any.&lt;br /&gt;if (Session["Error"] !=  null)&lt;br /&gt;{&lt;br /&gt;litError.Text = "The following error occurred:&lt;br /&gt;"  +&lt;br /&gt;Session["Error"].ToString();&lt;br /&gt;// Clear the Session state  variable.&lt;br /&gt;Session["Error"] = null;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Can you  have a try block without a catch or a finally block? &lt;/strong&gt;&lt;br /&gt;No, you cannot  have a try block without a catch or a finally block. A try block cannot exist in  isolation. A try block should be followed by either a catch block or a finally  block or both.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Is the  following code legal?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;try&lt;br /&gt;{&lt;br /&gt;Response.Write("Try block  executed");&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;Response.Write("Finally block  executed");&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Yes, it's legal. A try statement does not have  to have a catch statement if it has a finally  statement.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;What is  wrong with using the following type of exception  handler?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;catch(Exception E)&lt;br /&gt;{&lt;br /&gt;//Some  Code&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;This handler catches exceptions of type Exception,  therefore, it catches any exception. This can be a poor implementation because  you are losing valuable information about the type of exception being thrown and  making your code less efficient. As a result, your program may be forced to  determine the type of exception before it can decide on the best recovery  strategy.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Will the second catch block handle the exception  thrown by the first catch block? &lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;try&lt;br /&gt;{&lt;br /&gt;throw new  System.IO.FileNotFoundException();&lt;br /&gt;}&lt;br /&gt;catch  (System.IO.FileNotFoundException  FNFE)&lt;br /&gt;{&lt;br /&gt;Response.Write(FNFE.Message);&lt;br /&gt;throw new  Exception();&lt;br /&gt;}&lt;br /&gt;catch(Exception  E)&lt;br /&gt;{&lt;br /&gt;Response.Write(E.Message);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;No. For a catch block  to handle the exception, the statement that raised the exception must be inside  a try block.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;What will  happen to the exception raised by the code in the following Button1_Click event  procedure?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;protected void Button1_Click(object sender, EventArgs  e)&lt;br /&gt;{&lt;br /&gt;throw new  Exception();&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;Response.Write("Hello");&lt;br /&gt;}&lt;br /&gt;catch (Exception  E)&lt;br /&gt;{&lt;br /&gt;Response.Write(E.Message);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The exception will  not be handled by the catch block because the statement that raised the  exception must be inside a try block.&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Managed and Unmanaged Code-&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is Managed Code and Unmanaged Code? &lt;/strong&gt;&lt;br /&gt;Microsoft ASP.NET Web  applications run under the control of the common language runtime (CLR). The CLR  controls how the application’s assembly executes, allocates, and recovers  memory; therefore, ASP.NET applications are said to use managed code. In  contrast, most other Windows executables use unmanaged code because the  executable itself determines how memory is used.&lt;br /&gt;&lt;br /&gt;Examples of unmanaged  code include the Microsoft Win32 API, legacy DLLs and EXEs created for Windows  applications prior to the Microsoft .NET Framework, and COM  objects.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is  Platform Invoke or pinvoke?&lt;br /&gt;&lt;/strong&gt;The process of executing native code  from within a .NET assembly is called platform invoke, or pinvoke for short. You  use platform invoke to call the Win32 API directly, to access existing (legacy)  DLLs your company uses, or to access procedures compiled to native code for  performance reasons.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the steps to follow to use Platform  Invoke? &lt;/strong&gt;&lt;br /&gt;To use platform invoke, follow the following  steps:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Import the System.Runtime.InteropServices  namespace.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Declare the unmanaged procedure using the  DllImport attribute or the Declare statement.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Map the  data types of the procedures parameters to the equivalent .NET  types.&lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; Call the unmanaged procedure and test its return  value for success.&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt; If the procedure did not succeed,  retrieve and handle the exception code using the Marshal object’s  GetLastWin32Error method.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the limitations of using Unmanaged  Code from within a .NET assembly?&lt;br /&gt;Performance : &lt;/strong&gt;Although native-code  DLLs can perform some operations more quickly than equivalent code managed by  the CLR, these benefits might be offset by the time it takes to marshal the data  to pass between the unmanaged procedure and the .NET assembly.&lt;br /&gt;&lt;strong&gt;Type  safety :&lt;/strong&gt; Unlike .NET assemblies, unmanaged procedures might not be  type-safe. This can affect the reliability of your .NET application. In general,  reliability is a paramount concern with ASP.NET Web  applications.&lt;br /&gt;&lt;strong&gt;Code security :&lt;/strong&gt; Unmanaged procedures do not  use the .NET Framework’s model for code security.&lt;br /&gt;Versioning:Unmanaged code  does not support .NET versioning; therefore, assemblies that call unmanaged  procedures might lose the benefit of being able to coexist with other versions  of the same assembly.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are COM objects?&lt;br /&gt;&lt;/strong&gt;COM  objects are another type of unmanaged code that you can use from .NET  assemblies. Because COM is widely used, Visual Studio includes built-in tools  for importing and using COM objects within .NET assemblies. Visual Studio also  includes the option of automatically registering .NET class library assemblies  for use from COM.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What happens when you add a reference  to a COM object from with in a dot net application?&lt;br /&gt;&lt;/strong&gt;When you add a  reference to a COM object, Visual Studio automatically generates an interop  assembly for the object and places it in the project’s /bin folder. The interop  assembly is created from the COM object’s type information and contains the  metadata that the CLR uses to call the unmanaged code in the COM object. You can  then use COM objects from within .NET code the same way that you use .NET  classes.&lt;br /&gt;&lt;br /&gt;You can view this interop assembly using the Microsoft  Intermediate Language Disassembler (Ildasm.exe) included in the .NET  Framework.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can we create a .NET object for use from COM?  &lt;/strong&gt;&lt;br /&gt;Yes, Visual Studio can automatically generate type library  information and register a .NET class library assembly for use from COM. These  automatic tools do not work for ASP.NET Web applications, so you must isolate  the code you want to use from COM in its own Class Library  project.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you  hide Public .NET Classes and other public members from COM?&lt;br /&gt;&lt;/strong&gt;In some  cases, you might want to hide selected .NET classes from COM but keep them  public for use from other .NET assemblies. The ComVisible attribute allows you  to select which public .NET classes and members are included in the generated  type library. This attribute applies hierarchically for the assembly, class, and  member levels.&lt;br /&gt;&lt;strong&gt;How do you handle exceptions between .NET and COM?  &lt;/strong&gt;&lt;br /&gt;.NET handles errors through exception classes. COM handles errors  through 32-bit data types called HRESULTs. All of the .NET exception classes  include HResult properties that map to COM HRESULT codes.&lt;br /&gt;&lt;br /&gt;If an exception  occurs in a .NET object, the exception is automatically mapped to the  appropriate HRESULT and returned to COM. Similarly, if an exception occurs in a  COM object, the COM HRESULT is mapped to the appropriate exception class, which  is returned to .NET, where it can be handled just like any other  exception.&lt;br /&gt;&lt;br /&gt;If you are creating your own .NET exception classes for use  with COM, be sure to set the class’s HResult property so that the exception can  be handled within COM.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the technical limitations of COM  Interop?&lt;br /&gt;&lt;/strong&gt;The .NET Framework was developed to address the limitations  of COM. Because of this evolution, there are limits to the .NET features that  you can use from COM. The following list describes these  limits:&lt;br /&gt;&lt;strong&gt;Static members : &lt;/strong&gt;COM requires objects to be created  before use, so it does not support .NET Static members.&lt;br /&gt;&lt;strong&gt;New members  :&lt;/strong&gt; COM flattens the inheritance tree of .NET objects, so members in a  derived class that hides members inherited from a base class are not  callable.&lt;br /&gt;&lt;strong&gt;Constructors with parameters : &lt;/strong&gt;COM can’t pass  parameters to an object’s constructor.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the practical  limitations of using COM objects? &lt;/strong&gt;&lt;br /&gt;The following are the practical  limitations of using COM objects from .NET:&lt;br /&gt;&lt;strong&gt;Shared solutions might  not allow COM objects :&lt;/strong&gt; ASP.NET host service providers that use  nondedicated servers can limit or prohibit the installation of COM objects on  their servers.&lt;br /&gt;&lt;strong&gt;COM objects are prone to memory leaks : &lt;/strong&gt;COM  uses reference counting to determine when to destroy objects and free memory. It  is possible for this reference count to become incorrect, leaving objects in  memory indefinitely.&lt;br /&gt;&lt;strong&gt;Type libraries might be inaccurate :&lt;/strong&gt;  Because COM separates the object’s description from its implementation, it’s  possible for this description to not accurately reflect the object. In this  case, the generated interop assembly will also include those  inaccuracies.&lt;br /&gt;&lt;strong&gt;COM is unmanaged code :&lt;/strong&gt; All the limitations of  unmanaged code apply to COM objects as well.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;Tracing-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is an exception log? &lt;/strong&gt;&lt;br /&gt;An exception log is a list of handled  exceptions that occur while your application is running. Reviewing the exception  log periodically helps you verify that exceptions are being handled correctly,  are not occurring too frequently, and are not preventing users from  accomplishing tasks with your application.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;What is Tracing and what are the adavantages of  using tracing to log exceptions?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt;Tracing is a technique for recording events, such  as exceptions, in an application. There have always been ways to record errors  in an application - usually by opening a file and writing error messages to it.  But tracing offers the following significant  advantages:&lt;br /&gt;&lt;strong&gt;Standardization:&lt;/strong&gt;Building tracing into the .NET  Framework ensures that programming techniques are the same across all the  applications you develop with the .NET Framework.&lt;br /&gt;&lt;strong&gt;Built-in Web  support:&lt;/strong&gt;ASP.NET extends the .NET Framework tools by including  information related to the performance and behavior of Web  requests.&lt;br /&gt;&lt;strong&gt;Configuration:&lt;/strong&gt;You can turn tracing on and off  using settings in your application’s configuration file. You don’t have to  recompile your application to enable or disable  tracing.&lt;br /&gt;&lt;strong&gt;Performance:&lt;/strong&gt;While disabled, tracing statements do  not affect application performance.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you turn tracing on  and off for an ASP.NET web application? &lt;/strong&gt;&lt;br /&gt;Tracing can be turned on or  off for an entire Web application or for an individual page in the  application:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; To turn tracing on for an entire  application, in the application’s Web.config file, set the trace element’s  Enabled attribute to True.&lt;br /&gt;Or&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;2. &lt;/strong&gt;To turn tracing on for a single  page, set the DOCUMENT object’s Trace property to True in the Visual Studio .NET  Properties window. This sets the @ Page directive’s Trace attribute to True in  the Web form’s HTML.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Where is the trace output displayed by  default?&lt;br /&gt;&lt;/strong&gt;By default, trace output is displayed at the end of each  Web page.&lt;br /&gt;&lt;br /&gt;While this is fine for debugging purposes, you’ll generally  want to write trace output to a log file when you start testing your completed  application. To write trace messages to a log file for an entire application, in  the application’s Web.config file, set the trace element’s PageOutput attribute  to False. ASP.NET then writes trace output to the Trace.axd file in your  application’s root folder.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you specify, how many page  requets should be written to the trace log? &lt;/strong&gt;&lt;br /&gt;The element's  RequestLimit attribute can be used to specify how many page requests to write to  the trace log. For example, the following line from a Web.config file turns on  tracing for the application and writes the first 10 requests to the Trace.axd  file:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you write  trace messages to a log file for only selected pages in an  application?&lt;br /&gt;&lt;/strong&gt;To write trace messages to a log file for only selected  pages in an application, follow these steps:&lt;br /&gt;In the application’s Web.config  file, set the trace element’s Enabled attribute to True and PageOutput attribute  to False.&lt;br /&gt;For each Web page you want to exclude from tracing, set the @ Page  directive’s Trace attribute to False.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference  between Trace.Write() and Trace.Warn() methods of a trace object?  &lt;/strong&gt;&lt;br /&gt;The Trace object provides the Write and Warn methods to allow you  to write messages to a request’s trace information. The two methods are  identical with one difference: messages written with Trace.Write are displayed  in black, whereas messages written with Trace.Warn are displayed in  red.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you  programatically check if tracing is enabled?&lt;br /&gt;&lt;/strong&gt;The Trace object’s  IsEnabled property can be used to programatically check if tracing is  enabled.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you prevent from trace output being written at  the bottom of the web page? &lt;/strong&gt;&lt;br /&gt;You can prevent from trace output being  written at the bottom of the web page by setting the trace element’s PageOutput  attribute to False in the Web.config file.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the name of the file to which trace  log is written?&lt;br /&gt;&lt;/strong&gt;Trace.axd&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Can you view Trace.axd from a remote  machine?&lt;br /&gt;&lt;/strong&gt;No, by default, you can view Trace.axd only from the local  server running the application. If you want to view the trace log from a remote  machine, set the trace element’s LocalOnly attribute to False in the Web.config  file&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;Session State and Application State-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is a Session?&lt;br /&gt;&lt;/strong&gt;A Session is a unique instance of the browser. A  single user can have multiple instances of the browser running on his or her  machine. If each instance visits your Web application, each instance has a  unique session.A session starts when a user accesses a page on a Web site for  the first time, at which time they are assigned a unique session ID. The server  stores the user's session ID in the Session.SessionID  property.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the default session timeout period?  &lt;/strong&gt;&lt;br /&gt;20 minutes.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Where do you generally specify the Session  Timeout?&lt;br /&gt;&lt;/strong&gt;You specify the Session Timeout setting in the web.config  file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can you specify Session Timeout in a code behind file?  &lt;/strong&gt;&lt;br /&gt;Yes, can specify the Session.Timeout property as shown below in a  code behind file.&lt;br /&gt;Session.Timeout = 10;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you end a user  session?&lt;br /&gt;&lt;/strong&gt;You can call the Session.Abandon() method to end a user  session. If a user then tries to access a page the server will assign them a new  session ID and it will clear all the previous session variables. You'll  typically use Session.Abandon() on log-out pages.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What type of  data can you store in Application State and Session State variables?  &lt;/strong&gt;&lt;br /&gt;Application State and Session State variables are used to store  data that you want to keep for the lifetime of an application or for the  lifetime of a session. You can store any type of data in the Application or  Session state, including objects.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Are Application State or Session State  variables type safe?&lt;br /&gt;&lt;/strong&gt;No, Application and Session state variables are  created on the fly, without variable name or type checking.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Do  maintaining Session state affects performance?  &lt;/strong&gt;&lt;br /&gt;Yes&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Can  you turn of Session state?&lt;br /&gt;&lt;/strong&gt;Yes, Session state can be turned off at  the application and page levels.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Are Application state variables  available throughout the current process? &lt;/strong&gt;&lt;br /&gt;Yes, Application state  variables are available throughout the current process, but not across  processes. If an application is scaled to run on multiple servers or on multiple  processors within a server, each process has its own Application  state.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;How do you  disable Session state for a Web form?&lt;br /&gt;&lt;/strong&gt;To turn Session state off for  a Web form set EnableSessionState property of the Page to  False.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you turn Session state off for an entire web  application? &lt;/strong&gt;&lt;br /&gt;In the Web.config file, set the sessionstate tag to  False.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are Application State variables?  &lt;/strong&gt;&lt;br /&gt;Application State variables are global variables that are available  from anywhere in the application. All Sessions can access Application State  variables.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to add and remove data to Application State  Variables? &lt;/strong&gt;&lt;br /&gt;//Code to add data to Application State&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Application.Add("AppName",  "Sample");&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;//Code to remove data from Application State&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Application.Remove("AppName"); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How  do you remove all Application State Variables data? &lt;/strong&gt;&lt;br /&gt;//Code to  remove all Application State Variables data&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Application.RemoveAll();&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);font-family:verdana;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 51, 255);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Transaction-&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is a transaction? &lt;/strong&gt;&lt;br /&gt;A transaction is a group of commands that  change the data stored in a database. The transaction, which is treated as a  single unit, assures that the commands are handled in an all-or-nothing fashion.  if one of the commands fails, all of the commands fail, and any data that was  written to the database by the commands is backed out. In this way, transactions  maintain the integrity of data in a database. ADO.NET lets you group database  operations into transactions.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What is the main purpose of database  transactions?&lt;br /&gt;&lt;/strong&gt;The main purpose of database transactions is to  maintain the integrity of data in a database.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you  determine which SQL commands are part of a transaction? &lt;/strong&gt;&lt;br /&gt;You can  determine what database commands belong in a transaction by using the ACID test.  Commands must be atomic, consistent, isolated, and durable. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Commands belong in a transaction if they  are:&lt;br /&gt;&lt;strong&gt;Atomic:&lt;/strong&gt;In other words, they make up a single unit of  work. For example, if a customer moves, you want your data entry operator to  change all of the customer’s address fields as a single unit, rather than  changing street, then city, then state, and so  on.&lt;br /&gt;&lt;strong&gt;Consistent:&lt;/strong&gt;All the relationships between data in a  database are maintained correctly. For example, if customer information uses a  tax rate from a state tax table, the state entered for the customer must exist  in the state tax table. &lt;strong&gt;Isolated:&lt;/strong&gt;Changes made by other clients  can’t affect the current changes. For example, if two data entry operators try  to make a change to the same customer at the same time, one of two things  occurs: either one operator’s changes are accepted and the other is notified  that the changes weren’t made, or both operators are notified that their changes  were not made. In either case, the customer data is not left in an indeterminate  state.&lt;br /&gt;&lt;strong&gt;Durable:&lt;/strong&gt;Once a change is made, it is permanent. If a  system error or power failure occurs before a set of commands is complete, those  commands are undone and the data is restored to its original state once the  system begins running again.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Why is transaction processing very  important for web applications?&lt;br /&gt;&lt;/strong&gt;Transaction processing is very  important for Web applications that use data access, because Web applications  are distributed among many different clients. In a Web application, databases  are a shared resource, and having many different clients distributed over a wide  area can present the below key problems.&lt;br /&gt;&lt;strong&gt;Contention for  resources:&lt;/strong&gt;Several clients might try to change the same record at the  same time. This problem gets worse the more clients you  have.&lt;br /&gt;&lt;strong&gt;Unexpected failures:&lt;/strong&gt;The Internet is not the most  reliable network around, even if your Web application and Web server are 100  percent reliable. Clients can be unexpectedly disconnected by their service  providers, by their modems, or by power failures.&lt;br /&gt;&lt;strong&gt;Web application  life cycle:&lt;/strong&gt;Web applications don’t follow the same life cycle as Windows  applications—Web forms live for only an instant, and a client can leave your  application at any point by simply typing a new address in his or her  browser.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;List the steps  in order to process a transaction?&lt;br /&gt;&lt;/strong&gt;1.Begin a  transaction.&lt;br /&gt;2.Process database commands.&lt;br /&gt;3.Check for errors.&lt;br /&gt;4.If  errors occurred, restore the database to its state at the beginning of the  transaction. If no errors occurred, commit the transaction to the  database.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain how a DataSet provides transaction processing?  &lt;/strong&gt;&lt;br /&gt;DataSet provide transaction processing through the RejectChanges  and Update methods. DataSet also provide an AcceptChanges method that resets the  state of records in a data set to Unchanged. Data sets provide implicit  transaction processing, because changes to a data set are not made in the  database until you invoke the Update method on the data adapter object. This  lets you perform a set of commands on the data and then choose a point at which  to make the changes permanent in the database.&lt;br /&gt;&lt;br /&gt;If an error occurs during  the Update method, none of the changes from the data set is made in the  database. At that point, you can either attempt to correct the error and try the  Update method again or undo the changes pending in the data set using the data  set’s RejectChanges method.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Give an example to show how DataSets  provide transaction processing? &lt;/strong&gt;&lt;br /&gt;Let us assume we have a DataGrid  that displays employee information. Every row also has a delete button, which  when you click will delete that row. On this page we also have a Restore and  Commit buttons. When you click the Restore button you should be able to restore  the data to its previous state. When you click the Commit button you should be  able to update the database with the deletions made in the DataSet.&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;The code for Commit and Restore buttons is shown  below.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;private void butRestore_Click(object sender,  System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;// Restore the data set to its original  state.&lt;br /&gt;dsContacts.RejectChanges();&lt;br /&gt;// Refresh the data  grid.&lt;br /&gt;grdContacts.DataBind();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void butCommit_Click(object  sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;int intRows;&lt;br /&gt;// Update the database from  the data set.&lt;br /&gt;intRows = adptContacts.Update(dsContacts);&lt;br /&gt;// Save changes  to state variable.&lt;br /&gt;Session["dsContacts"] = dsContacts;&lt;br /&gt;// Refresh the data  grid.&lt;br /&gt;grdContacts.DataBind();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;The RejectChanges method in the  preceding butRestore_Click event procedure returns the data set to its state  before the row was deleted. The data set’s AcceptChanges method is the inverse  of RejectChanges—it resets the DataRowState property for all the changed rows in  a data set to Unchanged and removes any deleted rows.&lt;br /&gt;&lt;br /&gt;The AcceptChanges  method prevents the Update method from making those changes in the database,  however, because Update uses the rows’ DataRowState property to determine which  rows to modify in the database. For this reason, the AcceptChanges method is  useful only when you do not intend to update a database from the data  set.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are the 3  types of transaction objects available in ADO.NET?&lt;br /&gt;&lt;/strong&gt;As we have 3  types of database connections in ADO.NET, there are also 3 types of transaction  objects:&lt;br /&gt;SqlTransaction&lt;br /&gt;OracleTransaction&lt;br /&gt;OleDbTransaction&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What  are the steps involved in using a transaction object in ADO.NET?  &lt;/strong&gt;&lt;br /&gt;1.Open a database connection.&lt;br /&gt;2.Create the transaction object  using the database connection object’s BeginTransaction method.&lt;br /&gt;3.Create  command objects to track with this transaction, assigning the Transaction  property of each command object to the name of the transaction object created in  step 2.&lt;br /&gt;4.Execute the commands. Because the purpose of transaction processing  is to detect and correct errors before data is written to the database, this is  usually done as part of an error-handling structure.&lt;br /&gt;5.Commit the changes to  the database or restore the database state, depending on the success of the  commands.&lt;br /&gt;Close the database connection.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What property of a transaction object  determines how concurrent changes to a database are  handled?&lt;br /&gt;&lt;/strong&gt;IsolationLevel property of the transaction object is used  to determine how concurrent changes to a database are  handled.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are  different isolation levels of a transaction object in  ADO.NET?&lt;br /&gt;ReadUncommitted:&lt;/strong&gt;Does not lock the records being read. This  means that an uncommitted change can be read and then rolled back by another  client, resulting in a local copy of a record that is not consistent with what  is stored in the database. This is called a dirty read because the data is  inconsistent.&lt;br /&gt;&lt;strong&gt;Chaos:&lt;/strong&gt;Behaves the same way as ReadUncommitted,  but checks the isolation level of other pending transactions during a write  operation so that transactions with more restrictive isolation levels are not  overwritten.&lt;br /&gt;&lt;strong&gt;ReadCommitted:&lt;/strong&gt;Locks the records being read and  immediately frees the lock as soon as the records have been read. This prevents  any changes from being read before they are committed, but it does not prevent  records from being added, deleted, or changed by other clients during the  transaction. This is the default isolation  level.&lt;br /&gt;&lt;strong&gt;RepeatableRead:&lt;/strong&gt;Locks the records being read and keeps  the lock until the transaction completes. This ensures that the data being read  does not change during the transaction.&lt;br /&gt;&lt;strong&gt;Serializable:&lt;/strong&gt;Locks  the entire data set being read and keeps the lock until the transaction  completes. This ensures that the data and its order within the database do not  change during the transaction.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the default isolation  level in a transaction?&lt;/strong&gt;&lt;br /&gt;ReadCommitted&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is a Save  Point in a transaction in ADO.NET? &lt;/strong&gt;&lt;br /&gt;SqlConnection object provide one  transaction capability that is unavailable for OLE database connections: the  ability to create save points within a transaction. Save points let you restore  the database state to a specific position within the current transaction. To set  a save point within a SQL transaction, use the Save method as shown  below.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;TransactionObject.Save("FirstStep");&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;How  do you restore a SQL transaction to a specific save point? &lt;/strong&gt;&lt;br /&gt;To  restore a SQL transaction to a save point, specify the name of the save point in  the Rollback method as shown below.&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;TransactionObject.Rollback("FirstStep");&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;User Controls-&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;What are ASP.NET Custom controls?&lt;/strong&gt;&lt;br /&gt;Custom controls extend the tools  available to Web developers. Using custom controls, you can encapsulate key  aspects of the visual interface and program logic that you want to reuse  throughout your application, or throughout your  organization.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the 3 types of custom controls in  ASP.NET?&lt;/strong&gt;&lt;br /&gt;Microsoft Visual Studio .NET provides three types of custom  control for use on Web forms.&lt;br /&gt;&lt;strong&gt;1. Web user controls&lt;/strong&gt;&lt;br /&gt;These  combine existing server and HTML controls by using the Visual Studio .NET  Designer to create functional units that encapsulate some aspect of the user  interface. User controls reside in content files, which must be included in the  project in which the controls are used.&lt;br /&gt;&lt;strong&gt;2. Composite custom  controls&lt;/strong&gt;&lt;br /&gt;These create new controls from existing server and HTML  controls. Although similar to user controls, composite controls are created in  code rather than visually, and therefore they can be compiled into an assembly  (.dll), which can be shared between multiple applications and used from the  Toolbox in Visual Studio .NET.&lt;br /&gt;&lt;strong&gt;3. Rendered custom  controls&lt;/strong&gt;&lt;br /&gt;These create entirely new controls by rendering HTML  directly rather than using composition. These controls are compiled and can be  used from the Toolbox, just like composite controls, but you must write extra  code to handle tasks that are performed automatically in composite  controls.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the limitations of user controls in  ASP.NET?&lt;/strong&gt;&lt;br /&gt;As the user controls are not compiled into assemblies, they  have the following limitations:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; A copy of the control  must exist in each Web application project in which the control is  used.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; User controls can’t be loaded in the Visual Studio  .NET Toolbox; instead, you must create them by dragging the control from  Solution Explorer to the Web form.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; User control code is  initialized after the Web form loads, which means that user control property  values are not updated until after the Web form’s Load  event.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the steps to follow for creating and using a user  control in a Web application?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Add a Web user  control page (.ascx) to your project.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Draw the visual  interface of the control in the designer.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Write code to  create the control’s properties, methods, and events.&lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; Use  the control on a Web form by dragging it from Solution Explorer to the Web form  on which you want to include it.&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt; Use the control from a  Web form’s code by declaring the control at the module level and then using the  control’s methods, properties, and events as needed within the Web  form.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do you identify user controls?&lt;/strong&gt;&lt;br /&gt;User  controls are identified by their .ascx file extensions.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is  the base class from which user controls derive?&lt;/strong&gt;&lt;br /&gt;User controls derive  from System.Web.UI.UserControl base class. This base class provides the base set  of properties and methods you use to create the control.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are  the steps to follow to create properties and methods for the user control that  you can use from a Web form?&lt;/strong&gt;&lt;br /&gt;To create properties and methods for  the user control that you can use from a Web form, follow these  steps:&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Create the public property or method that you want  to make available on the containing Web form.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Write code  to respond to events that occur for the controls contained within the user  control. These event procedures do the bulk of the work for the user  control.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; If the property or method needs to retain a  setting between page displays, write code to save and restore settings from the  control’s ViewState.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What happens when you drag a user control  from solution explorer and drop it on a web form?&lt;/strong&gt;&lt;br /&gt;When you drag a  user control from solution explorer and drop it on a web form, Visual Studio  .NET generates a @Register directive and HTML tags to create the control on the  Web form.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:130%;" &gt;Custom Controls-&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;What are composite custom controls?&lt;/strong&gt;&lt;br /&gt;Composite custom controls  combine one or more server or HTML controls within a single control class, which  can be compiled along with other control classes to create an assembly (.dll)  that contains a custom control library. Once created, the custom control library  can be loaded into Visual Studio .NET and used in the same way as the standard  server and HTML controls.&lt;br /&gt;&lt;br /&gt;Composite custom controls are functionally  similar to user controls, but they reside in their own assemblies, so you can  share the same control among multiple projects without having to copy the  control to each project, as you must do with user controls. However, composite  controls are somewhat more difficult to create because you can’t draw them  visually using the Visual Studio .NET Designer.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the  steps to follow create and use a custom control in a Web  application?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; Create a solution containing a  custom control project.&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Add a Web application project to  the solution, and set it as the startup project. You will use the Web  application project to test the custom control during  development.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Add a project reference from the Web  application to the custom control project, and add an HTML @Register directive  and control element to use the custom control on a Web  form.&lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; Create the custom control’s visual interface by  adding existing controls to it through the custom control’s CreateChildControls  method.&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt; Add the properties, methods, and events that the  custom control provides.&lt;br /&gt;&lt;strong&gt;6.&lt;/strong&gt; Build and test the custom  control.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In general what is the base class for every composite  custom  control?&lt;/strong&gt;&lt;br /&gt;System.Web.UI.WebControls.WebControl&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Which  directive is used to add a custom control to a Web form?&lt;/strong&gt;&lt;br /&gt;Register  directive.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the 3 Register directive's  attributes?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;TagPrefix &lt;/strong&gt;&lt;br /&gt;This name identifies the  group that the user control belongs to. For example, the tag prefix for ASP.NET  server controls is “asp”. You use this prefix to create a naming convention to  organize your custom controls.&lt;br /&gt;&lt;strong&gt;Namespace &lt;/strong&gt;&lt;br /&gt;This is the  project name and namespace within the custom control assembly that contains the  controls to register. Microsoft Visual Basic .NET uses the project name as an  implicit namespace, so for controls written in Visual Basic .NET, use the  project name.&lt;br /&gt;&lt;strong&gt;Assembly &lt;/strong&gt;&lt;br /&gt;This is the name of the assembly  (.dll) containing the custom controls. The control assembly must be referenced  by the Web application. Referencing the assembly maintains a copy of it in the  Web application’s /bin directory.&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;What are the differences between User Controls and  Custom Controls?&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;strong&gt;1.&lt;/strong&gt; User Controls are easy to  create where as Custom Controls are difficult to create.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;2.&lt;/strong&gt; User Controls cannot be  compiled into an assembly, where as Custom Controls can be compiled into an  assembly.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; User Controls cannot be added to tool box,  where as Custom controls can be added to the toolbox.&lt;br /&gt;&lt;strong&gt;4. &lt;/strong&gt;You  need to have a copy of user control in every project where you want to use it,  where as this is not the case with custom controls. You can install a single  copy of the Web custom control in the global assembly cache and share it between  applications, which makes maintenance easier.&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt; User  controls are used for reusing existing user interface elements and code, but are  not useful for developing reusable components for multiple web applications.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-7352577474902543255?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/12/aspnet-interview-questions.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-6230821523717620465</guid><pubDate>Wed, 15 Dec 2010 06:40:00 +0000</pubDate><atom:updated>2010-12-14T22:44:14.786-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Coding Practices</category><category domain="http://www.blogger.com/atom/ns#">Best Coding Practices</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><title>ASP.Net Best Coding Practices</title><description>&lt;p&gt;As per my experience in the development / coding i found following as the best practices in ASP.Net application development.&lt;/p&gt;&lt;p&gt;These will definitely improve the application performace, maintanance and reliability.&lt;/p&gt;&lt;p&gt;1. Remove unused private fields and functions.&lt;/p&gt;&lt;p&gt;2. Do not cast unnecessarily. Avoid duplicate casts where possible, since there is a cost associated with them.&lt;/p&gt;&lt;p&gt;3. Properties that return arrays are prone to code inefficiencies. Consider using a collection or making this a method.&lt;/p&gt;&lt;p&gt;4. To test for empty strings, check if String.Length is equal to zero. Constructs such as "".Equals(someString) and String.Empty.Equals(someString) are less efficient than testing the string length. Replace these with checks for someString.Length == 0.&lt;/p&gt;&lt;p&gt;5. Methods in the same type that differ only by return type can be difficult for developers and tools to properly recognize. When extending a type, be sure not to define new methods that differ from base type methods only by type.&lt;/p&gt;&lt;p&gt;6. Use stringbuilder instead of string types for string manipulation.&lt;/p&gt;&lt;p&gt;7. Use String.Format instead of concatenating and appending strings.&lt;/p&gt;&lt;p&gt;8. Use Type.TryParse rather than Convert.ToDestinationType(). For example use int.TryParse() rather than Convert.ToInt32() which might throw an exception.&lt;/p&gt;&lt;p&gt;9. Override Equals() method wherever applicable in your classes.&lt;/p&gt;&lt;p&gt;10. Consider passing base types as parameters - Using base types as parameters to methods improves re-use of these methods if you only use methods &amp;amp; properties from the parameter's base class. E.g. use Stream instead of FileStream as a parameter when only calling Stream.Read(), this makes the method work on all kind of streams instead of just File streams.&lt;/p&gt;&lt;p&gt;11. Do not catch general exception types - You should not catch Exception or SystemException. Catching generic exception types can hide run-time problems from the library user, and can complicate debugging. You should catch only those exceptions that you can handle gracefully.&lt;br /&gt;12. Use properties instead of visible instance fields.&lt;/p&gt;&lt;p&gt;13. Follow the same naming conventions accross the solution.&lt;/p&gt;&lt;p&gt;14. Remove unwanted commented code, Indent code properly.&lt;/p&gt;&lt;p&gt;15. Use curly braces with in an if statement, even if there is a single statement in the if block. This will provide better readability.&lt;/p&gt;&lt;p&gt;16. Make sure to refactor your code to move the duplicated code to common reusable functions.&lt;/p&gt;&lt;p&gt;17. Move one time control settings into the .aspx page rather than having them in the code behind in if(!IsPostback) block.&lt;/p&gt;&lt;p&gt;18. Use inheritance whereever possible, which enables code reuse and also reduces the amount of code we have to write and test.&lt;/p&gt;&lt;p&gt;19. Move the reusable javascript functions to an external .js file instead of having them on the page.&lt;/p&gt;&lt;p&gt;20. For controls that are declarativley specified on the page, tie the event handlers to the controls events on the aspx page rather than initializing them in the codebehind. If the controls are built dynamically then we donot have a choice.&lt;/p&gt;&lt;p&gt;21. Make sure to check for nulls when using any type retrieved from a session, querystring or a database to avoid NullReferenceExceptions.&lt;/p&gt;&lt;p&gt;22. Use foreach loop instead of using for loop which may lead to out of boundary run time exceptions.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-6230821523717620465?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/12/aspnet-best-coding-practices.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-3055780217991215487</guid><pubDate>Fri, 26 Nov 2010 06:47:00 +0000</pubDate><atom:updated>2010-11-25T23:00:21.576-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">project design</category><category domain="http://www.blogger.com/atom/ns#">.Net project architecture</category><category domain="http://www.blogger.com/atom/ns#">project architecture</category><category domain="http://www.blogger.com/atom/ns#">efficient architecture</category><category domain="http://www.blogger.com/atom/ns#">n tier</category><title>Porject Architecture</title><description>The very common concern from a developers perspective is the Architechture of project.&lt;br /&gt;A architecture may lead to fast and robust development and at the same time it makes the project maintainable and scalable.&lt;br /&gt;The most commonly used architecture is the n-tier architecture&lt;br /&gt;&lt;br /&gt;Here i have mensioned all details of n-tier Architecture.Please check it.&lt;br /&gt;What is n-Tier Architecture?&lt;br /&gt;This is a very important topic to consider when developing an application. Many elements need to be considered when deciding on the architecture of the application, such as performance, scalability and future development issues. When you are deciding on which architecture to use, first decide on which of the three aforementioned elements you think is most valuable -- as some choices you make will impact on others. For example, some choices that boost performance will impact on the scalability or future development of your design, etc.&lt;br /&gt;&lt;br /&gt;Here we will talk generally about what n-Tier architecture is, and then we will have a look at different n-Tier architectures you can use to develop ASP.NET applications and issues that arise relating to performance, scalability and future development issues for each one.Firstly, what is n-Tier architecture? N-Tier architecture refers to the architecture of an application that has at least 3 "logical" layers -- or parts -- that are separate. Each layer interacts with only the layer directly below, and has specific function that it is responsible for.Why use n-Tier architecture? Because each layer can be located on physically different servers with only minor code changes, hence they scale out and handle more server load. Also, what each layer does internally is completely hidden to other layers and this makes it possible to change or update one layer without recompiling or modifying other layers.This is a very powerful feature of n-Tier architecture, as additional features or change to a layer can be done without redeploying the whole application. For example, by separating data access code from the business logic code, when the database servers change you only needs to change the data access code. Because business logic code stays the same, the business logic code does not need to be modified or recompiled.&lt;br /&gt;IMP- tier and layer mean the same thing&lt;br /&gt;&lt;br /&gt;An n-Tier application usually has three tiers, and they are called the presentation tier, the business tier and the data tier. Let's have a look at what each tier is responsible for.Presentation LayerPresentation Layer is the layer responsible for displaying user interface and "driving" that interface using business tier classes and objects. In ASP.NET it includes ASPX pages, user controls, server controls and sometimes security related classes and objects.&lt;br /&gt;&lt;br /&gt;Business TierBusiness Tier is the layer responsible for accessing the data tier to retrieve, modify and delete data to and from the data tier and send the results to the presentation tier. This layer is also responsible for processing the data retrieved and sent to the presentation layer.In ASP.NET it includes using SqlClient or OleDb objects to retrieve, update and delete data from SQL Server or Access databases, and also passing the data retrieved to the presentation layer in a DataReader or DataSet object, or a custom collection object.&lt;br /&gt;&lt;br /&gt;It might also include the sending of just an integer, but the integer would have been calculated using the data in the data tier such as the number of records a table has.BLL and DALOften this layer is divided into two sub layers: the Business Logic Layer (BLL), and the Data Access Layers (DAL). Business Logic Layers are above Data Access Layers, meaning BLL uses DAL classes and objects. DAL is responsible for accessing data and forwarding it to BLL.In ASP.NET it might be using SqlClient or OleDb to retrieve the data and sending it to BLL in the form of a DataSet or DataReader.&lt;br /&gt;&lt;br /&gt;BLL is responsible for preparing or processing the data retrieved and sends it to the presentation layer. In ASP.NET it might be using the DataSet and DataReader objects to fill up a custom collection or process it to come up with a value, and then sending it to Presentation Layer. BLL sometimes works as just transparent layer. For example, if you want to pass a DataSet or DataReader object directly to the presentation layer.Data TierData tier is the database or the source of the data itself. Often in .NET it's an SQL Server or Access database, however it's not limited to just those. It could also be Oracle, mySQL or even XML. In this article we will focus on SQL Server, as it has been proven to be the fastest database within a .NET Application.Logical Layers vs. Physical Layers (Distributed)Logical Layers and Physical Layers are the ones that confuse people.&lt;br /&gt;&lt;br /&gt;Firstly, a logical layer means that layers are separate in terms of assembly or sets of classes, but are still hosted on the same server. Physical layer means that those assemblies or sets of classes are hosted on different servers with some additional code to handle the communication between the layers. E.g. remoting and web services.Deciding to separate the layers physically or not is very important. It really depends on the load your application expects to get. I think it's worth mentioning some of the facts that might affect your decision.Please DO note that separating the layers physically WILL slow your application down due to the delay in communicating between the servers throughout the network, so if you are using the physical layer approach, make sure the performance gain is worth the performance loss from this.&lt;br /&gt;&lt;br /&gt;Hopefully you would have designed your application using the n-Tier approach. If this is the case, then note that you can separate the layers in the future.Cost for deploying and maintaining physically separated applications is much greater. First of all, you will need more servers. You also need network hardware connecting them. At this point, deploying the application becomes more complex too! So decide if these things will be worth it or not.Another fact that might affect your decision is how each of the tiers in the application are going to be used. You will probably want to host a tier on a separate server if more than 1 service is dependent on it, e.g. You might want to host business logic somewhere else if you have multiple presentation layers for different clients.&lt;br /&gt;&lt;br /&gt;You might also want a separate SQL server if you have other applications using the same data.Performance, Scalability and Future DevelopmentAs I said earlier, each choice you make in the architecture will affect one of the following: * Performance * Scalability * or Future Development.Here we will look at the most common choices you have to make in a typical ASP.NET application. I'll present you with some of the available options, cons and pros of each.[Note] You should develop an application bottom up. This means build the data tier layer first. You should always design all three layers before building the actual application. [End Note]Performance vs. Scalability vs. Future DevelopmentWhen deciding on your architecture, decide what your priority is going to be. If your application is time critical, then you might have to sacrifice its scalability and extendibility just because you need more procedural like class design, which will offer that.If you want scalability then you might have to sacrifice performance, because the scalability comes from scaling out and scaling out means communicating through a slower medium such as a LAN.&lt;br /&gt;&lt;br /&gt;Extensibility is a good thing to have but what's the point if you won’t be updating the application in the future, but instead be rewriting the whole thing? Think about whether you need extensibility or not because it can affect performance due to having more round trips to the database and also due to the simple fact that the size of the application will be bigger.Think about what you really need for the project you are doing not what other people are doing for their projects. Architecture is a topic that really doesn't have best practices so rather than going for architecture for all of your applications, think about different architecture for each of your applications.&lt;br /&gt;&lt;br /&gt;Presentation Tier IssuesThe presentation layer must be well planned before building it. If this layer is badly designed, it could impact on the applications performance and future development paths. I'll explain why.Firstly, let's start with performance. Remember how I said that the presentation layer 'uses' BLL to do any operations that need interaction with the data tier? No matter how well you've designed your BLL to reduce the round trips or unnecessary trips to the data tier, if the presentation layer code calls that method one or more times unnecessarily, you are still doing a round trip to the data tier. This impacts on your applications overall performance.Performance is also affected by the different types of controls you decide to use. For example, using a DataGrid instead of a DataList or Repeater will make a noticeable performance difference. So, when do you use a DataGrid and when do you use others? We will discuss this in a minute.&lt;br /&gt;&lt;br /&gt;Secondly, future development is also impacted upon if the presentation layer is badly designed. How? If you have repetitive HTML code in all pages of your website, what happens if you want to change a color of a table or something? Do you go to each page and change it? What would you do if your boss said "No, I don't like that... Change it back!"? You really need to implement a template system into your web pages, so when you make one change to your site design, it's propagated to all pages.Although not related to performance and future development, the presentation layer has another role in ASP.NET applications – security. You have 4 security options in ASP.NET, and we will have a look at each option in detail shortly.&lt;br /&gt;&lt;br /&gt;Before that though, let's get back to the DataGrid, DataList and Repeater issue.Data Grid, Data List, RepeaterKnowing the differences between these controls is very important because they are very different controls made for different uses, but people tend to get them confused.Performance wise, you must always use a Repeater wherever possible. It is the fastest control out of the three. Unfortunately, it is also very limited in what it can do. All a repeater can do is iterate through the data source and display its properties.A data source can be a data object such as a DataReader or dataset, but it can also be your custom collection that implements the IEnumerable and/or the IEnumerator interface. This is very good for displaying read only items such as list of news headlines, a summary of recent articles, etc.There are times when you want to be able to "select" a row. When the row is selected, you want different item templates to be displayed. This situation is when you use a data list. DataLists allow you to select a row and display data using different templates.&lt;br /&gt;&lt;br /&gt;This is very useful for items that might need some frequent modification such as a list of news headlines for administrators where you want administrators to be able to edit headlines, etc.The DataGrid is an interesting control. I always use it when I have a dataset as my data source. Although it's really slow, it is very flexible. It's also capable of producing a professional looking list or grid automatically. It knows the database's schema. It knows the type of fields and displays them accordingly. But one of the best features it has is its ability to allow editing of the data without having us code any postback functions, etc.I find it great for administrative sections as it is not used very often but offers the greatest flexibility and convenience. If you need the greatest performance possible, however, then don't use a DataGrid. SecurityIn ASP.NET there are 4 security models that you can use in your web applications.1. Form securityThis is probably the most commonly used security model in ASP.NET web sites. It's very convenient to use and is perfect for most applications. If you need role based security then typically this is the way to go.&lt;br /&gt;&lt;br /&gt;2. PassportIf you want your visitors to be able to use their passport account at your site, you can implement the passport security model. To use this security model you need to be able to access the Internet, so it's not really suitable for intranet applications. It's quiet flexible and quite effective, however. As a passport user myself, its very convenient not to login to each and every site I visit. But all of this come at an expensive dollar price!&lt;br /&gt;&lt;br /&gt;3. Custom SecurityIf you need a more complex security system, then you will need to implement your own security system. This is typically done by building your own principal and identity classes (implementing the IPrincipal an Iidentity interfaces). I've implemented permission-based security using this method and it was very successful.&lt;br /&gt;&lt;br /&gt;4. Windows SecurityThis is perfect for intranet sites. It communicates to an Active Directory for user authentication information where all of the groups, permissions and users are managed.&lt;br /&gt;&lt;br /&gt;Business Tier IssuesBuilding an efficient and elegant Business Tier is very important. If your business tier code is slow and hard to understand, then there is no hope of making an application fast or extendable in the future. It doesn't matter how efficient your presentation code is (by calling on the business tier less often) -- if your business tier is making unnecessary round trips to the database, then your application as a whole will be slow.This is a little different from what I've said about the presentation tier. If the presentation tier is slow, then that part of the application might be slow, but if its the business tier that's slow, then it will affect all applications that use the business tier, which can be ASPX pages as well as web services you provide to other businesses.&lt;br /&gt;&lt;br /&gt;DataSet VS DataReaderThe issue of the DataSet versus the DataReader for some reason always seem to put people in doubt. I've come across a lot of people who weren’t sure which one to use. Let's clarify their uses now.In ASP.NET, always use a DataReader unless you need to serialize it or pass it to the next tier. There are some books and articles that tell you to use a DataSet over a DataReader every time. In my opinion that's not good practice because a DataSet eats up your resources very, very quickly (a DataSet actually is filled using a DataReader).I rarely use a DataSet in my web applications. I always use a DataReader, and if I need to pass it to the next tier I make my own custom collection class and pass that object between tiers. I just find a DataSet too heavy for web applications, though for a web service it's better to use a DataSet than a custom collection.&lt;br /&gt;&lt;br /&gt;IMP- I'm talking about just the web application. This becomes a different story if you're designing BLL for both Web AND Win forms&lt;br /&gt;&lt;br /&gt;Some people might have heard of typed DataSets, which are classes that inherit from the DataSet. It is used in Duwamish7 and is quite popular in the .NET community. It has a very elegant design, but compromises your application’s performance. If elegance is more important (for future upgrades), then a typed dataset is a great alternative to your own custom collection. VS.NET has great support for them too!&lt;br /&gt;&lt;br /&gt;Happy development....&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-3055780217991215487?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/11/porject-architecture.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-8430524008083037576</guid><pubDate>Wed, 24 Nov 2010 05:31:00 +0000</pubDate><atom:updated>2010-12-27T23:39:12.245-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSIS</category><category domain="http://www.blogger.com/atom/ns#">SSIS interview questions</category><category domain="http://www.blogger.com/atom/ns#">SQL Server Integration Services</category><category domain="http://www.blogger.com/atom/ns#">scenario</category><category domain="http://www.blogger.com/atom/ns#">scenario based</category><category domain="http://www.blogger.com/atom/ns#">Interview Questions</category><category domain="http://www.blogger.com/atom/ns#">SQL server 2005</category><category domain="http://www.blogger.com/atom/ns#">Checkpoints</category><category domain="http://www.blogger.com/atom/ns#">MS SSIS</category><category domain="http://www.blogger.com/atom/ns#">Delpoy SSIS</category><title>SSIS Interview Questions and answers</title><description>Here are some SSIS related Interview Questions with answers. hope they help.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question - 1 What is the control flow and data flow&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In SSIS a workflow is called a control-flow. A control-flow links together our modular data-flows as a series of operations in order to achieve a desired result.&lt;br /&gt;A control flow consists of one or more tasks and containers that execute when the package runs. To control order or define the conditions for running the next task or container in the package control flow, you use precedence constraints to connect the tasks and containers in a package. A subset of tasks and containers can also be grouped and run repeatedly as a unit within the package control flow.&lt;br /&gt;&lt;br /&gt;SQL Server 2005 Integration Services (SSIS) provides three different types of control flow elements: containers that provide structures in packages, tasks that provide functionality, and precedence constraints that connect the executables, containers, and tasks into an ordered control flow.&lt;br /&gt;&lt;br /&gt;A data flow consists of the sources and destinations that extract and load data, the transformations that modify and extend data, and the paths that link sources, transformations, and destinations. Before you can add a data flow to a package, the package control flow must include a Data Flow task. The Data Flow task is the executable within the SSIS package that creates, orders, and runs the data flow. A separate instance of the data flow engine is opened for each Data Flow task in a package.&lt;br /&gt;&lt;br /&gt;SQL Server 2005 Integration Services (SSIS) provides three different types of data flow components: sources, transformations, and destinations. Sources extract data from data stores such as tables and views in relational databases, files, and Analysis Services databases. Transformations modify, summarize, and clean data. Destinations load data into data stores or create in-memory datasets.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Question -2 How do you do error handling in SSIS&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When a data flow component applies a transformation to column data, extracts data from sources, or loads data into destinations, errors can occur. Errors frequently occur because of unexpected data values.&lt;br /&gt;&lt;br /&gt;For example, a data conversion fails because a column contains a string instead of a number, an insertion into a database column fails because the data is a date and the column has a numeric data type, or an expression fails to evaluate because a column value is zero, resulting in a mathematical operation that is not valid.&lt;br /&gt;&lt;br /&gt;Errors typically fall into one the following categories:&lt;br /&gt;&lt;br /&gt;-Data conversion errors, which occur if a conversion results in loss of significant digits, the loss of insignificant digits, and the truncation of strings. Data conversion errors also occur if the requested conversion is not supported.&lt;br /&gt;-Expression evaluation errors, which occur if expressions that are evaluated at run time perform invalid operations or become syntactically incorrect because of missing or incorrect data values.&lt;br /&gt;-Lookup errors, which occur if a lookup operation fails to locate a match in the lookup table.&lt;br /&gt;&lt;br /&gt;Many data flow components support error outputs, which let you control how the component handles row-level errors in both incoming and outgoing data. You specify how the component behaves when truncation or an error occurs by setting options on individual columns in the input or output.&lt;br /&gt;&lt;br /&gt;For example, you can specify that the component should fail if customer name data is truncated, but ignore errors on another column that contains less important data.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question- 3 How do you do logging in ssis&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SSIS includes logging features that write log entries when run-time events occur and can also write custom messages.&lt;br /&gt;&lt;br /&gt;Integration Services supports a diverse set of log providers, and gives you the ability to create custom log providers. The Integration Services log providers can write log entries to text files, SQL Server Profiler, SQL Server, Windows Event Log, or XML files.&lt;br /&gt;&lt;br /&gt;Logs are associated with packages and are configured at the package level. Each task or container in a package can log information to any package log. The tasks and containers in a package can be enabled for logging even if the package itself is not.&lt;br /&gt;&lt;br /&gt;To customize the logging of an event or custom message, Integration Services provides a schema of commonly logged information to include in log entries. The Integration Services log schema defines the information that you can log. You can select elements from the log schema for each log entry.&lt;br /&gt;&lt;br /&gt;To enable logging in a package&lt;br /&gt;1. In Business Intelligence Development Studio, open the Integration Services project that contains the package you want.&lt;br /&gt;2. On the SSIS menu, click Logging.&lt;br /&gt;3. Select a log provider in the Provider type list, and then click Add.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question- 4 How do you deploy ssis packages.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SQL Server 2005 Integration Services (SSIS) makes it simple to deploy packages to any computer.&lt;br /&gt;There are two steps in the package deployment process:&lt;br /&gt;-The first step is to build the Integration Services project to create a package deployment utility.&lt;br /&gt;-The second step is to copy the deployment folder that was created when you built the Integration Services project to the target computer, and then run the Package Installation Wizard to install the packages.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question -5 How do you schedule ssis packages to run on the fly&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;SQL Server 2005 Integration Services (SSIS) makes it simple to deploy packages to any computer.There are two steps in the package deployment process:-The first step is to build the Integration Services project to create a package deployment utility.-The second step is to copy the deployment folder that was created when you built the IntegrationServices project to the target computer, and then run the Package Installation Wizard to install thepackages.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question - 6 How do you run stored procedure and get data&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question -7 A scenario: Want to insert a text file into database table, but during the upload want to change a column called as months - January, Feb, etc to a code, - 1,2,3.. .This code can be read from another database table called months. After the conversion of the data , upload the file. If there are any errors, write to error table. Then for all errors, read errors from database, create a file, and mail it to the supervisor.&lt;br /&gt;How would you accomplish this task in SSIS?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 8- What are variables and what is variable scope ?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Variables store values that a SSIS package and its containers, tasks, and event handlers can use at run time. The scripts in the Script task and the Script component can also use variables. The precedence constraints that sequence tasks and containers into a workflow can use variables when their constraint definitions include expressions.&lt;br /&gt;&lt;br /&gt;Integration Services supports two types of variables: user-defined variables and system variables. User-defined variables are defined by package developers, and system variables are defined by Integration Services. You can create as many user-defined variables as a package requires, but you cannot create additional system variables.&lt;br /&gt;&lt;br /&gt;Scope :&lt;br /&gt;&lt;br /&gt;A variable is created within the scope of a package or within the scope of a container, task, or event handler in the package. Because the package container is at the top of the container hierarchy, variables with package scope function like global variables and can be used by all containers in the package. Similarly, variables defined within the scope of a container such as a For Loop container can be used by all tasks or containers within the For Loop container.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 9 - True or False - Using a checkpoint file in SSIS is just like issuing the CHECKPOINT command against the relational engine. It commits all of the data to the database.&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;False. SSIS provides a Checkpoint capability which allows a package to restart at the point of failure.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 10 - Can you explain the what the Import\Export tool does and the basic steps in the wizard?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;The Import\Export tool is accessible via BIDS or executing the dtswizard command.&lt;br /&gt;The tool identifies a data source and a destination to move data either within 1 database, between instances or even from a database to a file (or vice versa).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 11 - What are the command line tools to execute SQL Server Integration Services packages?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;DTSEXECUI - When this command line tool is run a user interface is loaded in order to configure each of the applicable parameters to execute an SSIS package.&lt;br /&gt;DTEXEC - This is a pure command line tool where all of the needed switches must be passed into the command for successful execution of the SSIS package.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 12 - Can you explain the SQL Server Integration Services functionality in Management Studio?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You have the ability to do the following:&lt;br /&gt;Login to the SQL Server Integration Services instance&lt;br /&gt;View the SSIS log&lt;br /&gt;View the packages that are currently running on that instance&lt;br /&gt;Browse the packages stored in MSDB or the file system&lt;br /&gt;Import or export packages&lt;br /&gt;Delete packages&lt;br /&gt;Run packages&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 13 - Can you name some of the core SSIS components in the Business Intelligence&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Development Studio you work with on a regular basis when building an SSIS package?&lt;br /&gt;Connection Managers&lt;br /&gt;Control Flow&lt;br /&gt;Data Flow&lt;br /&gt;Event Handlers&lt;br /&gt;Variables window&lt;br /&gt;Toolbox window&lt;br /&gt;Output window&lt;br /&gt;Logging&lt;br /&gt;Package Configurations&lt;br /&gt;&lt;br /&gt;Question Difficulty = Moderate&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 14 - True or False: SSIS has a default means to log all records updated, deleted or inserted on a per table basis.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;False, but a custom solution can be built to meet these needs.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 15 - What is a breakpoint in SSIS? How is it setup? How do you disable it?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A breakpoint is a stopping point in the code. The breakpoint can give the Developer\DBA an opportunity to review the status of the data, variables and the overall status of the SSIS package.&lt;br /&gt;10 unique conditions exist for each breakpoint.&lt;br /&gt;Breakpoints are setup in BIDS. In BIDS, navigate to the control flow interface. Right click on the object where you want to set the breakpoint and select the 'Edit Breakpoints...' option.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 16- Can you name 5 or more of the native SSIS connection managers?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;OLEDB connection - Used to connect to any data source requiring an OLEDB connection (i.e., SQL Server 2000)&lt;br /&gt;Flat file connection - Used to make a connection to a single file in the File System. Required for reading information from a File System flat file&lt;br /&gt;ADO.Net connection - Uses the .Net Provider to make a connection to SQL Server 2005 or other connection exposed through managed code (like C#) in a custom task&lt;br /&gt;Analysis Services connection - Used to make a connection to an Analysis Services database or project. Required for the Analysis Services DDL Task and Analysis Services Processing Task&lt;br /&gt;File connection - Used to reference a file or folder. The options are to either use or create a file or folder&lt;br /&gt;Excel&lt;br /&gt;FTP&lt;br /&gt;HTTP&lt;br /&gt;MSMQ&lt;br /&gt;SMO&lt;br /&gt;SMTP&lt;br /&gt;SQLMobile&lt;br /&gt;WMI&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 17 - How do you eliminate quotes from being uploaded from a flat file to SQL Server?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the SSIS package on the Flat File Connection Manager Editor, enter quotes into the Text qualifier field then preview the data to ensure the quotes are not included.&lt;br /&gt;Additional information: How to strip out double quotes from an import file in SQL Server Integration Services&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Question 18- Can you name 5 or more of the main SSIS tool box widgets and their functionality?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;For Loop Container&lt;br /&gt;Foreach Loop Container&lt;br /&gt;Sequence Container&lt;br /&gt;ActiveX Script Task&lt;br /&gt;Analysis Services Execute DDL Task&lt;br /&gt;Analysis Services Processing Task&lt;br /&gt;Bulk Insert Task&lt;br /&gt;Data Flow Task&lt;br /&gt;Data Mining Query Task&lt;br /&gt;Execute DTS 2000 Package Task&lt;br /&gt;Execute Package Task&lt;br /&gt;Execute Process Task&lt;br /&gt;Execute SQL Task&lt;br /&gt;etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 19- Can you explain one approach to deploy an SSIS package?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One option is to build a deployment manifest file in BIDS, then copy the directory to the applicable SQL Server then work through the steps of the package installation wizard&lt;br /&gt;A second option is using the dtutil utility to copy, paste, rename, delete an SSIS Package&lt;br /&gt;A third option is to login to SQL Server Integration Services via SQL Server Management Studio then navigate to the 'Stored Packages' folder then right click on the one of the children folders or an SSIS package to access the 'Import Packages...' or 'Export Packages...'option.&lt;br /&gt;A fourth option in BIDS is to navigate to File Save Copy of Package and complete the interface.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Question 20- Can you explain how to setup a checkpoint file in SSIS?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;The following items need to be configured on the properties tab for SSIS package:&lt;br /&gt;CheckpointFileName - Specify the full path to the Checkpoint file that the package uses to save the value of package variables and log completed tasks. Rather than using a hard-coded path as shown above, it's a good idea to use an expression that concatenates a path defined in a package variable and the package name.&lt;br /&gt;CheckpointUsage - Determines if/how checkpoints are used. Choose from these options: Never (default), IfExists, or Always. Never indicates that you are not using Checkpoints. IfExists is the typical setting and implements the restart at the point of failure behavior. If a Checkpoint file is found it is used to restore package variable values and restart at the point of failure. If a Checkpoint file is not found the package starts execution with the first task. The Always choice raises an error if the Checkpoint file does not exist.&lt;br /&gt;SaveCheckpoints - Choose from these options: True or False (default). You must select True to implement the Checkpoint behavior.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 21- Can you explain different options for dynamic configurations in SSIS?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Use an XML file&lt;br /&gt;Use custom variables&lt;br /&gt;Use a database per environment with the variables&lt;br /&gt;Use a centralized database with all variables&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 22 - How do you upgrade an SSIS Package?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Depending on the complexity of the package, one or two techniques are typically used:&lt;br /&gt;Recode the package based on the functionality in SQL Server DTS&lt;br /&gt;Use the Migrate DTS 2000 Package wizard in BIDS then recode any portion of the package that is not accurate&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 23 - Can you name five of the Performance counters for SSIS and the value they provide?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SQLServer:SSIS Service&lt;br /&gt;SSIS Package Instances - Total number of simultaneous SSIS Packages running&lt;br /&gt;SQLServer:SSIS Pipeline&lt;br /&gt;BLOB bytes read - Total bytes read from binary large objects during the monitoring period.&lt;br /&gt;BLOB bytes written - Total bytes written to binary large objects during the monitoring period.&lt;br /&gt;BLOB files in use - Number of binary large objects files used during the data flow task during the monitoring period.&lt;br /&gt;Buffer memory - The amount of physical or virtual memory used by the data flow task during the monitoring period.&lt;br /&gt;Buffers in use - The number of buffers in use during the data flow task during the monitoring period.&lt;br /&gt;Buffers spooled - The number of buffers written to disk during the data flow task during the monitoring period.&lt;br /&gt;Flat buffer memory - The total number of blocks of memory in use by the data flow task during the monitoring period.&lt;br /&gt;Flat buffers in use - The number of blocks of memory in use by the data flow task at a point in time.&lt;br /&gt;Private buffer memory - The total amount of physical or virtual memory used by data transformation tasks in the data flow engine during the monitoring period.&lt;br /&gt;Private buffers in use - The number of blocks of memory in use by the transformations in the data flow task at a point in time.&lt;br /&gt;Rows read - Total number of input rows in use by the data flow task at a point in time.&lt;br /&gt;Rows written - Total number of output rows in use by the data flow task at a point in time.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Question 24. Explain what ETL is?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 25. Which task would you use to copy, move or delete files?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Question 26. Which transform would you use to split your data based on&lt;br /&gt;conditions you define? &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 27. Explain the pros and cons of deploying to a file system vs msdb?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 28 Explain architecture of SSIS?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 29 Difference between Control Flow and Data Flow? &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 30 How to pass property value at Run time? How do you implement Package Configuration?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 31 How would you deploy a SSIS Package on production?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;1. Create deployment utility by setting its propery as true .&lt;br /&gt;2. It will be created in the bin folder of the solution as soon as package is build.&lt;br /&gt;3. Copy all the files in the utility and use manifest file to deply it on the Prod.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 32 Difference between DTS and SSIS? &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Question 33 What are new features in SSIS 2008? &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Question 34 How would you pass a variable value to Child Package?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 35 What is Execution Tree? &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 36 What are the points to keep in mind for performance improvement of the package?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 37 You may get a question stating a scenario and then asking you how would you create a package forthat e.g. How would you configure a data flow task so that it can transfer data to different table based on thecity name in a source table column?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 38 Difference between Unionall and Merge Join?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 39 May get question regarding what X transformation do?Lookup, fuzzy lookup, fuzzy grouping &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 40 How would you restart package from previous failure point?What are Checkpoints and how can we implement in SSIS?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 41 Where are SSIS package stored in the SQL Server? &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;MSDB.sysdtspackages90 stores the actual content and ssydtscategories, sysdtslog90,&lt;br /&gt;sysdtspackagefolders90, sysdtspackagelog, sysdtssteplog, and sysdtstasklog do the&lt;br /&gt;supporting roles.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 42 How would you schedule a SSIS packages?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using SQL Server Agent. There are few third party applications also by which we can deploy the SSIS packages with greater flexibility.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 43 Difference between asynchronous and synchronos transformations? &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;Asynchronous transformation have different Input and Output buffers and it is up to the component designerin an Async component to provide a column structure to the output buffer and hook up the data from theinput.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;strong&gt;Question 44 How to achieve multiple threading in SSIS? Passing variable to Child package from Parent package in SSIS&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-8430524008083037576?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/11/ssis-interview-questions-and-answers.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-4592839705692833269</guid><pubDate>Thu, 09 Sep 2010 17:30:00 +0000</pubDate><atom:updated>2010-10-31T21:26:19.677-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MSMQ in dotnet</category><category domain="http://www.blogger.com/atom/ns#">implement MSMQ</category><category domain="http://www.blogger.com/atom/ns#">MSMQ</category><category domain="http://www.blogger.com/atom/ns#">how to implement MSMQ</category><category domain="http://www.blogger.com/atom/ns#">implement MSMQ in dotnet</category><title>Implement MSMQ in Dot Net</title><description>In Dot net, MSMQ provides a powerful set of services. These you can get from&lt;br /&gt;System.Messaging name space. In order to use MSMQ explorer our Dot Net IDE can also be used to add and remove messages form MSMQ.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How you can use MSMQ:&lt;/strong&gt;&lt;br /&gt;In order to use MSMQ first you have to install MSMQ in your machine.&lt;br /&gt;Since we are looking at MSMQ in Dot Net, you need to have Windows 2000 + Service Pack1, MSMQ, .NET Framework Beta1 and Visual Studio.NET .&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to Use MSMQ:&lt;/strong&gt;&lt;br /&gt;MSMQ Enterprise can be managed through the MSMQ Explorer.&lt;br /&gt;The MSMQ Explorer provides an interface for managing all machines in a MSMQ environment from a single point of control. This MSMQ Explorer you can get from Computer Management/Services and Applications/MessageQueing.&lt;br /&gt;&lt;br /&gt;Here I am trying to show a simple Example in VS.Net(VB).&lt;br /&gt;In this example I am using a Windows Application in the C# Environment.This example will help you to know how to send and receive messages using MSMQ.&lt;br /&gt;In this example I am basically using System.Messaging name space to manage the&lt;br /&gt;messages using msmq.&lt;br /&gt;&lt;br /&gt;Following example will help you to know how to send and receive messages using MSMQ.&lt;br /&gt;&lt;br /&gt;In this I have created a Windows application in VB using VS.net.&lt;br /&gt;&lt;br /&gt;Take a form and put two buttons, one for sending data and one for receiving data. I also used a text box.While sending message, i am taking message form the textbox.Button one is used to send message.Other button will be used to receive the data.&lt;br /&gt;&lt;br /&gt;To use the MSMQ name space System.Messaging, go to Tools and Component Tab, then Drag and Drop the MessageQueue to the Form (Design View).Once you add it, as shown below, code will be added to your application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Private WithEvents MessageQueue1 As System.Messaging.MessageQueue&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The above code will be added in&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;public class Form1 : System.WinForms.Form&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;and one more important line&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Me.MessageQueue1 = New System.Messaging.MessageQueue()&lt;/strong&gt;&lt;br /&gt;will be added in &lt;strong&gt;Private Sub InitializeComponent()&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;While your application initializes it will create the messageQueue1 .&lt;br /&gt;Once your object has been Created or Instantiated you can use it's methods and&lt;br /&gt;Properties.&lt;br /&gt;&lt;br /&gt;In our example we are trying to Send a message to "Test" Private Queue.&lt;br /&gt;&lt;strong&gt;"Test"&lt;/strong&gt; is a Queue name which we are using in the example. It's not a system Queue.&lt;br /&gt;&lt;br /&gt;The code below is used for sending the message to a queue when you click Button1&lt;br /&gt;button.&lt;br /&gt;****************************&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)&lt;br /&gt;Dim q As MessageQueue&lt;br /&gt;If MessageQueue.Exists(".Private$Test") Then&lt;br /&gt;q = New MessageQueue(".Private$Test")&lt;br /&gt;Else&lt;br /&gt;q = MessageQueue.Create(".Private$Test")&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Dim BW As New BinaryWriter(New MemoryStream())&lt;br /&gt;bw.Write(textbox1.Text)&lt;br /&gt;Dim m As New Messaging.Message()&lt;br /&gt;m.BodyStream = BW.BaseStream&lt;br /&gt;m.Label = "My Test Message"&lt;br /&gt;&lt;br /&gt;q.Send(m)&lt;br /&gt;msgbox("Message sent successfully",Microsoft.VisualBasic.MsgBoxStyle.Information, "MSMQ Message")&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/span&gt;******************************&lt;br /&gt;&lt;br /&gt;When you click the command one, first i am checking for Queue if queue is not&lt;br /&gt;there then i am creating the Queue , if queue is there i am sending the message to the&lt;br /&gt;queueusingn Send method.&lt;br /&gt;Send Can basically will have two arguments a) Message b) Label for that message.&lt;br /&gt;&lt;br /&gt;Button Two will help you to receive the messages:&lt;br /&gt;******************************&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)&lt;br /&gt;Dim q As MessageQueue&lt;br /&gt;Dim m As Messaging.Message&lt;br /&gt;Dim Br As BinaryReader&lt;br /&gt;Dim x As String&lt;br /&gt;&lt;br /&gt;If MessageQueue.Exists(".Private$Test") Then&lt;br /&gt;q = New MessageQueue(".Private$Test")&lt;br /&gt;Else&lt;br /&gt;q = MessageQueue.Create(".Private$Test")&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Try&lt;br /&gt;m = q.Receive(New TimeSpan(0, 0, 3))&lt;br /&gt;Br = New BinaryReader(m.BodyStream)&lt;br /&gt;x = New String(Br.ReadChars(CInt(m.BodyStream.Length)))&lt;br /&gt;Catch&lt;br /&gt;x = "(no message)"&lt;br /&gt;&lt;br /&gt;End Try&lt;br /&gt;msgbox(x, Microsoft.VisualBasic.MsgBoxStyle.Information, "MSMQ Message")&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/span&gt;********************************&lt;br /&gt;If you look into the code, basically I am testing for the existence of the Smile&lt;br /&gt;Private Queue.If it is not there, I am popping up a message box. If it is there, then I am instantiating a PostMessage as a Message Queue.&lt;br /&gt;&lt;br /&gt;Here I have to explain one thing. The message object holds the result of the&lt;br /&gt;received message. So here I am using m as the message object, and we also created a TimeSpan object from the System name space. The TimeSpan object will tell how long to wait for the Receive method before timing out (hours, minutes, seconds).&lt;br /&gt;Before .Net, we could simply set a message object Body property to a string value.&lt;br /&gt;But in Dot Net the data will be automatically wrapped in XML using SOAP encoding.&lt;br /&gt;It makes consistent with other languages with in Dot Net.&lt;br /&gt;&lt;br /&gt;Note:&lt;br /&gt;Take care with the following Steps:&lt;br /&gt;1. Must install MSMQ on your machine.&lt;br /&gt;2. Drag and Drop the Message Queue into your Design Form.&lt;br /&gt;3. You must be using System.Messaging;&lt;br /&gt;4. Must declare a message for receiving messages. Here we declared as m.&lt;br /&gt;5. Build the code before running.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=netandbusines-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=B00466R0V6&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-4592839705692833269?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/09/implement-msmq-in-dot-net.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-2521399878206631435</guid><pubDate>Thu, 08 Jul 2010 09:32:00 +0000</pubDate><atom:updated>2010-07-08T02:59:17.185-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tutorial</category><category domain="http://www.blogger.com/atom/ns#">.Net Tutorial</category><category domain="http://www.blogger.com/atom/ns#">asp.net tutorials</category><category domain="http://www.blogger.com/atom/ns#">.net tutorials</category><category domain="http://www.blogger.com/atom/ns#">ASP.Net tutorial</category><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><title>ASP.Net Tutorials</title><description>ASP.NET Tutorials
&lt;br /&gt;
&lt;br /&gt;										&lt;a href="http://www.c-sharpcorner.com/AspNet2.0.asp" class="plainlink" target="_blank"&gt;														C-Sharp Corner ASP.NET 2.0 Tutorials
&lt;br /&gt;&lt;/a&gt;
&lt;br /&gt;How to use many ASP.NET 2.0 features such as the TreeView control, Object Data Source control, and Visual Studio 2005.
&lt;br /&gt;																&lt;a href="http://www.4guysfromrolla.com/webtech/090200-1.shtml" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															Form Validation Controls in ASP.NET
&lt;br /&gt;										&lt;/a&gt;
&lt;br /&gt;																							Learn how to use various ASP.NET Validator controls to make form validation simple in this 2 part tutorial.
&lt;br /&gt;																				&lt;a href="http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=85" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															ASP.NET Security - Forms Authentication Tutorial
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																			Learn how to do .NET Forms Authentication with this tutorial. How to secure single pages or entire directories with ease.
&lt;br /&gt;										&lt;a href="http://www.411asp.net/" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															411asp.net
&lt;br /&gt;											&lt;/a&gt;
&lt;br /&gt;																							Excellent source of tutorials and how-to's. Lot's of additional ASP.Net articles and help here as well.
&lt;br /&gt;
&lt;br /&gt;																							&lt;a href="http://www.aspnetfaq.com/" class="plainlink" target="_blank"&gt;															&lt;/a&gt;&lt;a href="http://www.aspnetfaq.com/" class="plainlink" target="_blank"&gt;ASP.Net FAQ
&lt;br /&gt;												&lt;/a&gt;
&lt;br /&gt;																							Site containing FAQ sections for ASP.Net and other .Net related areas.
&lt;br /&gt;
&lt;br /&gt;																						&lt;a href="http://www.15seconds.com/issue/020102.htm" class="plainlink" target="_blank"&gt;															The ASP.NET Page Life Cycle
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																							A must read for those interested in developing with ASP.Net. This tutorial will clarify the execution pattern behind an ASP.Net page.
&lt;br /&gt;
&lt;br /&gt;																							&lt;a href="http://www.takempis.com/aspnet_fundamentals.asp" class="plainlink" target="_blank"&gt;															ASP.Net Fundamentals
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;													Large single page tutorial that does a good job explaining what makes an ASP.Net page tick. Topics include maintaining state and using events.
&lt;br /&gt;																							&lt;a href="http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=96" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															Guestbook.NET - a beginner tutorial to ASP.NET
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																							Targeted to people who know some HTML and know some simple programming concepts. Tutorial will guide a beginner through creating a simple guestbook with ASP.Net.
&lt;br /&gt;													&lt;a href="http://www.123aspx.com/directory.aspx?dir=69" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															ASP.Net Tutorials and Examples
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									ASP.Net resource page packed with links to tutorials on every subject imaginable. Tutorials on authentication, code behind, msmq, remoting, reflection and more.
&lt;br /&gt;																																			&lt;a href="http://www.asp101.com/aspdotnet/aspplus/index.asp" com="" freebook="" learn="" class="plainlink" target=""&gt;&lt;br /&gt;																									High level overview of ASP.Net from Asp101.com.&lt;br /&gt;																																					&lt;a href=""&gt;
&lt;br /&gt;															ASP.Net Free Book
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									Charles Carroll does a great service to those wanting to learn ASP.Net with this free online book. Chapters include basics, debugging, databases, datagrids, optimization, and xml.
&lt;br /&gt;																																				&lt;a href="http://www.411asp.net/home/tutorial" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															ASP.Net Tutorials &amp;amp; Code Snips
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									From this page you can either branch into the 411asp.net how-to's section, or search through a comprehensive specific topics area.
&lt;br /&gt;																																			&lt;a href="http://www.codeproject.com/aspnet/" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															CodeProject.com Tutorials
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									Great site for articles/tutorials on ASP.Net and other .Net categories. Tons of helpful articles here covering topics ranging from Caching to Tracing and Viewstate.
&lt;br /&gt;																																				&lt;a href="http://www.aspalliance.com/das/tutorial/default.aspx" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															AspAlliance.com ASP.Net Tutorial
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									Several mini tutorials covering many of the different web server controls used in ASP.Net including Label, Textbox, Listbox, Checkbox, RadioButton, LinkButton, Panels, and others.
&lt;br /&gt;																									&lt;a href="http://www.w3schools.com/aspnet/default.asp" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															W3schools.com ASP.Net
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									Great ASP.Net tutorial, ASP.Net references, and examples. Tutorial sections include ASP vs. ASP.Net, installing ASP.Net, creating a simple page, and many more advanced topics.
&lt;br /&gt;																																					&lt;a href="http://www.dotnetjunkies.com/article/Default.aspx?cat=12" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															DotNetJunkies ASP.Net Tutorials
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									Extensive collection of ASP.Net tutorials from DotNetJunkies.com. Tutorials on ADO.Net, custom controls, server controls, advanced techniques, and xml web services.
&lt;br /&gt;																									&lt;a href="http://msdn.microsoft.com/asp.net/using/default.aspx" class="plainlink" target="_blank"&gt;
&lt;br /&gt;															MSDN Using ASP.Net 2.0
&lt;br /&gt;														&lt;/a&gt;
&lt;br /&gt;																									Microsoft's MSDN resource for developing with ASP.NET. Areas include getting started, migrating ASP apps to ASP.NET, building apps, and deployment.
&lt;br /&gt;																									&lt;a href="http://www.asp.net/quickstart/aspnet/" class="plainlink" target="_blank"&gt;&lt;span class="plainlink"&gt;
&lt;br /&gt;															ASP.NET 2.0 QuickStart Tutorial
&lt;br /&gt;														&lt;/span&gt;&lt;/a&gt;
&lt;br /&gt;													Microsoft's Asp.Net 2.0 quickstart tutorials which come packaged with the .NET sdk. This page will allow you to choose between VB.Net, C#, and JScript for code samples.
&lt;br /&gt;												
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-2521399878206631435?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/07/aspnet-tutorials.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-2471778875096326664</guid><pubDate>Thu, 24 Jun 2010 10:52:00 +0000</pubDate><atom:updated>2010-06-24T03:56:26.828-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">UML</category><category domain="http://www.blogger.com/atom/ns#">UML interview questions</category><category domain="http://www.blogger.com/atom/ns#">intervie questions UML</category><title>UML Interview questions</title><description>1. What is inheritance?&lt;br /&gt;2. Difference between Composition and Aggregation.&lt;br /&gt;3. Difference: Sequence Diagrams, Collaboration Diagrams.&lt;br /&gt;4. Differentiate: 'uses', 'extends', 'includes'&lt;br /&gt;5. What shall I do for Package Diagram?&lt;br /&gt;6. What is Polymorphism?&lt;br /&gt;7. Is class an Object? Is object a class?&lt;br /&gt;8. Comment: C++ "includes" behavior and java "imports"&lt;br /&gt;9. What do you mean by "Realization"?&lt;br /&gt;10. What is a Presistent, Transient Object?&lt;br /&gt;11. What is the use of Operator Overloading?&lt;br /&gt;12. Does UML guarantee project success?&lt;br /&gt;13. Difference: Activity Diagram and Sequence Diagram.&lt;br /&gt;14. What is association?&lt;br /&gt;15. How to resolve many to many relationship?&lt;br /&gt;16. How do you represent static members and abstract classes in Class Diagram?&lt;br /&gt;17. Can we use UML for user interface (UI) design?&lt;br /&gt;18. Every object has : state, behavior and identity - explain&lt;br /&gt;19. How to reverse engineer C++ code in UML?&lt;br /&gt;20. What are the tools you used for OOAD?&lt;br /&gt;21. Difference: Object Oriented Analysis (OOA) and Object Oriented Design (OOD)?&lt;br /&gt;22. What are the four phases of the Unified Process ?&lt;br /&gt;23. How do you convert uses cases into test cases?&lt;br /&gt;24. Explain Class Diagram in Detail.&lt;br /&gt;25. What are the Design Patterns you know.&lt;br /&gt;26. When do you prefer to use composition than aggregation?&lt;br /&gt;27. UML: IS it a process, method or notation?&lt;br /&gt;28. Does a concept HAVE to become a class in Design?&lt;br /&gt;29. What are the good practices to use while designing for reuse?&lt;br /&gt;30. Can you think of some nice examples where *multiple* actors are associated with&lt;br /&gt;a use case ?&lt;br /&gt;31. How to use CRC Cards for Class Design?&lt;br /&gt;32. What is the difference between static and dynamic Classificaition.Give some&lt;br /&gt;examples.&lt;br /&gt;33. Explian following terms: Constraint Rules, Design by contract.&lt;br /&gt;34. What is Object Constraint Language (OCL)?&lt;br /&gt;35. Difference Between Attribute and Association.&lt;br /&gt;36. What are associative classes?&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-2471778875096326664?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/06/uml-interview-questions.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-6339601338872297689</guid><pubDate>Wed, 23 Jun 2010 11:07:00 +0000</pubDate><atom:updated>2010-11-23T04:56:58.282-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Surface computing</category><category domain="http://www.blogger.com/atom/ns#">latest gadget</category><category domain="http://www.blogger.com/atom/ns#">microsoft surface computing</category><title>Microsoft Surface Computing</title><description>&lt;strong&gt;Microsoft's corporate campus is a sprawling affair&lt;/strong&gt;, with more than 100 buildings scattered over 261 acres. To make sense of it all, you have to navigate by numbers. The Microsoft Visitor Center, for instance, is in Building 127, north campus, while the Microsoft Conference Center is in Building 33, just down the road from the company soccer and baseball fields. About 4 miles away, however, there is an unnumbered building that is decidedly "off campus." In that building, Microsoft has quietly been developing the first completely new computing platform since the PC — a project that was given the internal code name Milan. This past March, when the project was still operating on the down low, I became the first reporter invited inside these offices. My hosts politely threatened legal consequences if I blabbed about the project to anyone not directly involved in it, then escorted me down a dark hallway to a locked corner conference room. Inside that room was Microsoft's best-kept technology secret in years ... a coffee table. The product behind the Milan project is called the Microsoft Surface, and the company's unofficial Surface showman is Jeff Gattis. He's a clean-cut fellow who is obviously the veteran of a thousand marketing seminars. He spoke in sentences peppered with "application scenarios," "operational efficiencies" and "consumer pain points" while he took me through a few demonstrations of what the Surface can do. One of Gattis's consumer pain points is the frustrating mess of cables, drivers and protocols that people must use to link their peripheral devices to their personal computers. Surface has no cables or external USB ports for plugging in peripherals. For that matter, it has no keyboard, no mouse, no trackball — no obvious point of interaction except its screen. Gattis took out a digital camera and placed it on the Surface. Instantly, digital pictures spilled out onto the tabletop. As Gattis touched and dragged each picture, it followed his fingers around the screen. Using two fingers, he pulled the corners of a photo and stretched it to a new size. Then, Gattis put a cellphone on the surface and dragged several photos to it — just like that, the pictures uploaded to the phone. It was like a magic trick. He was dragging and dropping virtual content to physical objects. I'm not often surprised by new technology, but I can honestly say I'd never seen anything like it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://video.popularmechanics.com/services/player/bcpid932579976?bclid=932553050&amp;amp;bctid=933742930"&gt;http://video.popularmechanics.com/services/player/bcpid932579976?bclid=932553050&amp;amp;bctid=933742930&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-6339601338872297689?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/06/microsift-surface-computing.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-6144057770339947293</guid><pubDate>Mon, 14 Jun 2010 06:31:00 +0000</pubDate><atom:updated>2010-06-13T23:38:43.857-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">application architecture</category><category domain="http://www.blogger.com/atom/ns#">project design</category><category domain="http://www.blogger.com/atom/ns#">project architecture</category><category domain="http://www.blogger.com/atom/ns#">Presentation layer</category><category domain="http://www.blogger.com/atom/ns#">.net</category><category domain="http://www.blogger.com/atom/ns#">which component to use</category><category domain="http://www.blogger.com/atom/ns#">DAL</category><category domain="http://www.blogger.com/atom/ns#">architecture</category><category domain="http://www.blogger.com/atom/ns#">which control to use</category><category domain="http://www.blogger.com/atom/ns#">n tier</category><category domain="http://www.blogger.com/atom/ns#">c#.net project architecture</category><category domain="http://www.blogger.com/atom/ns#">BLL</category><title>How to architect a .Net application</title><description>&lt;strong&gt;What is n-Tier Architecture?&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;This is a very important topic to consider when developing an application. Many elements need to be considered when deciding on the architecture of the application, such as performance, scalability and future development issues. When you are deciding on which architecture to use, first decide on which of the three aforementioned elements you think is most valuable -- as some choices you make will impact on others. For example, some choices that boost performance will impact on the scalability or future development of your design, etc.&lt;br /&gt;&lt;br /&gt;Here we will talk generally about what n-Tier architecture is, and then we will have a look at different n-Tier architectures you can use to develop ASP.NET applications and issues that arise relating to performance, scalability and future development issues for each one.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Firstly, what is n-Tier architecture?&lt;br /&gt;&lt;/strong&gt;N-Tier architecture refers to the architecture of an application that has at least 3 "logical" layers -- or parts -- that are separate. Each layer interacts with only the layer directly below, and has specific function that it is responsible for.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why use n-Tier architecture?&lt;br /&gt;&lt;/strong&gt;Because each layer can be located on physically different servers with only minor code changes, hence they scale out and handle more server load. Also, what each layer does internally is completely hidden to other layers and this makes it possible to change or update one layer without recompiling or modifying other layers.&lt;br /&gt;&lt;br /&gt;This is a very powerful feature of n-Tier architecture, as additional features or change to a layer can be done without redeploying the whole application. For example, by separating data access code from the business logic code, when the database servers change you only needs to change the data access code. Because business logic code stays the same, the business logic code does not need to be modified or recompiled.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Tier and layer mean the same thing&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;An n-Tier application usually has three tiers, and they are called the presentation tier, the business tier and the data tier. Let's have a look at what each tier is responsible for.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Presentation Layer&lt;/strong&gt;&lt;br /&gt;Presentation Layer is the layer responsible for displaying user interface and "driving" that interface using business tier classes and objects. In ASP.NET it includes ASPX pages, user controls, server controls and sometimes security related classes and objects.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Business Tier&lt;/strong&gt;&lt;br /&gt;Business Tier is the layer responsible for accessing the data tier to retrieve, modify and delete data to and from the data tier and send the results to the presentation tier. This layer is also responsible for processing the data retrieved and sent to the presentation layer.&lt;br /&gt;&lt;br /&gt;In ASP.NET it includes using SqlClient or OleDb objects to retrieve, update and delete data from SQL Server or Access databases, and also passing the data retrieved to the presentation layer in a DataReader or DataSet object, or a custom collection object. It might also include the sending of just an integer, but the integer would have been calculated using the data in the data tier such as the number of records a table has.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;BLL and DAL&lt;br /&gt;&lt;/strong&gt;Often this layer is divided into two sub layers: the Business Logic Layer (BLL), and the Data Access Layers (DAL). Business Logic Layers are above Data Access Layers, meaning BLL uses DAL classes and objects. DAL is responsible for accessing data and forwarding it to BLL.&lt;br /&gt;&lt;br /&gt;In ASP.NET it might be using SqlClient or OleDb to retrieve the data and sending it to BLL in the form of a DataSet or DataReader. BLL is responsible for preparing or processing the data retrieved and sends it to the presentation layer. In ASP.NET it might be using the DataSet and DataReader objects to fill up a custom collection or process it to come up with a value, and then sending it to Presentation Layer. BLL sometimes works as just transparent layer. For example, if you want to pass a DataSet or DataReader object directly to the presentation layer.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Data Tier&lt;/strong&gt;&lt;br /&gt;Data tier is the database or the source of the data itself. Often in .NET it's an SQL Server or Access database, however it's not limited to just those. It could also be Oracle, mySQL or even XML. In this article we will focus on SQL Server, as it has been proven to be the fastest database within a .NET Application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Logical Layers vs. Physical Layers (Distributed)&lt;br /&gt;&lt;/strong&gt;Logical Layers and Physical Layers are the ones that confuse people. Firstly, a logical layer means that layers are separate in terms of assembly or sets of classes, but are still hosted on the same server. Physical layer means that those assemblies or sets of classes are hosted on different servers with some additional code to handle the communication between the layers. E.g. remoting and web services.&lt;br /&gt;&lt;br /&gt;Deciding to separate the layers physically or not is very important. It really depends on the load your application expects to get. I think it's worth mentioning some of the facts that might affect your decision.&lt;br /&gt;&lt;br /&gt;Please DO note that separating the layers physically WILL slow your application down due to the delay in communicating between the servers throughout the network, so if you are using the physical layer approach, make sure the performance gain is worth the performance loss from this.&lt;br /&gt;&lt;br /&gt;Hopefully you would have designed your application using the n-Tier approach. If this is the case, then note that you can separate the layers in the future.&lt;br /&gt;&lt;br /&gt;Cost for deploying and maintaining physically separated applications is much greater. First of all, you will need more servers. You also need network hardware connecting them. At this point, deploying the application becomes more complex too! So decide if these things will be worth it or not.&lt;br /&gt;&lt;br /&gt;Another fact that might affect your decision is how each of the tiers in the application are going to be used. You will probably want to host a tier on a separate server if more than 1 service is dependent on it, e.g. You might want to host business logic somewhere else if you have multiple presentation layers for different clients. You might also want a separate SQL server if you have other applications using the same data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Performance, Scalability and Future Development&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;As I said earlier, each choice you make in the architecture will affect one of the following:&lt;br /&gt;&lt;br /&gt;* Performance&lt;br /&gt;* Scalability&lt;br /&gt;* or Future Development.&lt;br /&gt;&lt;br /&gt;Here we will look at the most common choices you have to make in a typical ASP.NET application. I'll present you with some of the available options, cons and pros of each.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;You should develop an application bottom up. This means build the data tier layer first. You should always design all three layers before building the actual application.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Performance vs. Scalability vs. Future Development &lt;/strong&gt;&lt;br /&gt;When deciding on your architecture, decide what your priority is going to be. If your application is time critical, then you might have to sacrifice its scalability and extendibility just because you need more procedural like class design, which will offer that.&lt;br /&gt;&lt;br /&gt;If you want scalability then you might have to sacrifice performance, because the scalability comes from scaling out and scaling out means communicating through a slower medium such as a LAN. Extensibility is a good thing to have but what's the point if you won’t be updating the application in the future, but instead be rewriting the whole thing? Think about whether you need extensibility or not because it can affect performance due to having more round trips to the database and also due to the simple fact that the size of the application will be bigger.&lt;br /&gt;&lt;br /&gt;Think about what you really need for the project you are doing not what other people are doing for their projects. Architecture is a topic that really doesn't have best practices so rather than going for architecture for all of your applications, think about different architecture for each of your applications.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Presentation Tier Issues &lt;/strong&gt;&lt;br /&gt;The presentation layer must be well planned before building it. If this layer is badly designed, it could impact on the applications performance and future development paths. I'll explain why.&lt;br /&gt;&lt;br /&gt;Firstly, let's start with performance. Remember how I said that the presentation layer 'uses' BLL to do any operations that need interaction with the data tier? No matter how well you've designed your BLL to reduce the round trips or unnecessary trips to the data tier, if the presentation layer code calls that method one or more times unnecessarily, you are still doing a round trip to the data tier. This impacts on your applications overall performance.&lt;br /&gt;&lt;br /&gt;Performance is also affected by the different types of controls you decide to use. For example, using a DataGrid instead of a DataList or Repeater will make a noticeable performance difference. So, when do you use a DataGrid and when do you use others? We will discuss this in a minute.&lt;br /&gt;&lt;br /&gt;Secondly, future development is also impacted upon if the presentation layer is badly designed. How? If you have repetitive HTML code in all pages of your website, what happens if you want to change a color of a table or something? Do you go to each page and change it? What would you do if your boss said "No, I don't like that... Change it back!"? You really need to implement a template system into your web pages, so when you make one change to your site design, it's propagated to all pages.&lt;br /&gt;&lt;br /&gt;Although not related to performance and future development, the presentation layer has another role in ASP.NET applications – security. You have 4 security options in ASP.NET, and we will have a look at each option in detail shortly. Before that though, let's get back to the DataGrid, DataList and Repeater issue.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WHAT, WHEN, WHERE? &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Data Grid, Data List, Repeater&lt;/strong&gt;&lt;br /&gt;Knowing the differences between these controls is very important because they are very different controls made for different uses, but people tend to get them confused.&lt;br /&gt;&lt;br /&gt;Performance wise, you must always use a Repeater wherever possible. It is the fastest control out of the three. Unfortunately, it is also very limited in what it can do. All a repeater can do is iterate through the data source and display its properties.&lt;br /&gt;&lt;br /&gt;A data source can be a data object such as a DataReader or dataset, but it can also be your custom collection that implements the IEnumerable and/or the IEnumerator interface. This is very good for displaying read only items such as list of news headlines, a summary of recent articles, etc.&lt;br /&gt;&lt;br /&gt;There are times when you want to be able to "select" a row. When the row is selected, you want different item templates to be displayed. This situation is when you use a data list. DataLists allow you to select a row and display data using different templates. This is very useful for items that might need some frequent modification such as a list of news headlines for administrators where you want administrators to be able to edit headlines, etc.&lt;br /&gt;&lt;br /&gt;The DataGrid is an interesting control. I always use it when I have a dataset as my data source. Although it's really slow, it is very flexible. It's also capable of producing a professional looking list or grid automatically. It knows the database's schema. It knows the type of fields and displays them accordingly. But one of the best features it has is its ability to allow editing of the data without having us code any postback functions, etc.&lt;br /&gt;&lt;br /&gt;I find it great for administrative sections as it is not used very often but offers the greatest flexibility and convenience. If you need the greatest performance possible, however, then don't use a DataGrid.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Security &lt;/strong&gt;&lt;br /&gt;In ASP.NET there are 4 security models that you can use in your web applications.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Form security &lt;/strong&gt;&lt;br /&gt;This is probably the most commonly used security model in ASP.NET web sites. It's very convenient to use and is perfect for most applications. If you need role based security then typically this is the way to go.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Passport &lt;/strong&gt;&lt;br /&gt;If you want your visitors to be able to use their passport account at your site, you can implement the passport security model. To use this security model you need to be able to access the Internet, so it's not really suitable for intranet applications. It's quiet flexible and quite effective, however. As a passport user myself, its very convenient not to login to each and every site I visit. But all of this come at an expensive dollar price!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Custom Security &lt;/strong&gt;&lt;br /&gt;If you need a more complex security system, then you will need to implement your own security system. This is typically done by building your own principal and identity classes (implementing the IPrincipal an Iidentity interfaces). I've implemented permission-based security using this method and it was very successful.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. Windows Security &lt;/strong&gt;&lt;br /&gt;This is perfect for intranet sites. It communicates to an Active Directory for user authentication information where all of the groups, permissions and users are managed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Business Tier Issues&lt;/strong&gt;&lt;br /&gt;Building an efficient and elegant Business Tier is very important. If your business tier code is slow and hard to understand, then there is no hope of making an application fast or extendable in the future. It doesn't matter how efficient your presentation code is (by calling on the business tier less often) -- if your business tier is making unnecessary round trips to the database, then your application as a whole will be slow.&lt;br /&gt;&lt;br /&gt;This is a little different from what I've said about the presentation tier. If the presentation tier is slow, then that part of the application might be slow, but if its the business tier that's slow, then it will affect all applications that use the business tier, which can be ASPX pages as well as web services you provide to other businesses.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DataSet VS DataReader &lt;/strong&gt;&lt;br /&gt;The issue of the DataSet versus the DataReader for some reason always seems to put people in doubt. I've come across a lot of people who weren’t sure which one to use. Let's clarify their uses now.&lt;br /&gt;&lt;br /&gt;In ASP.NET, always use a DataReader unless you need to serialize it or pass it to the next tier. There are some books and articles that tell you to use a DataSet over a DataReader every time. In my opinion that's not good practice because a DataSet eats up your resources very, very quickly (a DataSet actually is filled using a DataReader).&lt;br /&gt;&lt;br /&gt;I rarely use a DataSet in my web applications. I always use a DataReader, and if I need to pass it to the next tier I make my own custom collection class and pass that object between tiers. I just find a DataSet too heavy for web applications, though for a web service it's better to use a DataSet than a custom collection.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;I'm talking about just the web application. This becomes a different story if you're designing BLL for both Web AND Win forms&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Some people might have heard of typed DataSets, which are classes that inherit from the DataSet. It is used in Duwamish7 and is quite popular in the .NET community. It has a very elegant design, but compromises your application’s performance. If elegance is more important (for future upgrades), then a typed dataset is a great alternative to your own custom collection. VS.NET has great support for them too!&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-6144057770339947293?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/06/how-to-architect-net-project.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-5818713664292070221</guid><pubDate>Thu, 03 Jun 2010 09:55:00 +0000</pubDate><atom:updated>2010-06-03T02:58:16.067-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Not null</category><category domain="http://www.blogger.com/atom/ns#">not null constraint</category><category domain="http://www.blogger.com/atom/ns#">check integrity</category><category domain="http://www.blogger.com/atom/ns#">business intelligence in sql server 2008</category><category domain="http://www.blogger.com/atom/ns#">stored procedure</category><category domain="http://www.blogger.com/atom/ns#">database integrity</category><title>Check Not Null constraint in all the columns of all tables in the database</title><description>CREATE PROC SearchAllTablesForNULLValues&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)&lt;br /&gt;SET @TableName = ''&lt;br /&gt;WHILE @TableName IS NOT NULL&lt;br /&gt;BEGIN&lt;br /&gt;SET @ColumnName = ''&lt;br /&gt;SET @TableName =&lt;br /&gt;(&lt;br /&gt;SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))&lt;br /&gt;FROM INFORMATION_SCHEMA.TABLES&lt;br /&gt;WHERE TABLE_TYPE = 'BASE TABLE'&lt;br /&gt;AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) &gt; @TableName&lt;br /&gt;AND OBJECTPROPERTY(&lt;br /&gt;OBJECT_ID(&lt;br /&gt;QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)&lt;br /&gt;), 'IsMSShipped'&lt;br /&gt;) = 0&lt;br /&gt;)&lt;br /&gt;WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)&lt;br /&gt;BEGIN&lt;br /&gt;SET @ColumnName =&lt;br /&gt;(&lt;br /&gt;SELECT MIN(QUOTENAME(COLUMN_NAME))&lt;br /&gt;FROM INFORMATION_SCHEMA.COLUMNS&lt;br /&gt;WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)&lt;br /&gt;AND TABLE_NAME = PARSENAME(@TableName, 1)&lt;br /&gt;AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')&lt;br /&gt;AND QUOTENAME(COLUMN_NAME) &gt; @ColumnName&lt;br /&gt;AND IS_NULLABLE='NO'&lt;br /&gt;)&lt;br /&gt;IF @ColumnName IS NOT NULL&lt;br /&gt;BEGIN&lt;br /&gt;INSERT INTO #Results&lt;br /&gt;EXEC&lt;br /&gt;(&lt;br /&gt;'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630)&lt;br /&gt;FROM ' + @TableName + ' (NOLOCK) ' +&lt;br /&gt;' WHERE ' + @ColumnName +'Is Null OR '+@ColumnName+' = '''' '&lt;br /&gt;)&lt;br /&gt;END&lt;br /&gt;END&lt;br /&gt;END&lt;br /&gt;SELECT ColumnName, ColumnValue,count(*)as 'No Of Occurance' FROM #Results&lt;br /&gt;group by ColumnName,ColumnValue&lt;br /&gt;END&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-5818713664292070221?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2010/06/check-not-null-constraint-in-all.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-592938861941470347</guid><pubDate>Tue, 22 Sep 2009 09:22:00 +0000</pubDate><atom:updated>2012-02-09T22:31:44.788-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">export to excel</category><category domain="http://www.blogger.com/atom/ns#">column headers</category><category domain="http://www.blogger.com/atom/ns#">BCP</category><category domain="http://www.blogger.com/atom/ns#">business intelligence in sql server 2008</category><category domain="http://www.blogger.com/atom/ns#">SQL query</category><category domain="http://www.blogger.com/atom/ns#">BCP with column headers</category><title>BCP command to export data to excel with column header</title><description>Hi Friends,&lt;br /&gt;Here is a perfect running BCP command / SQL query which exports table data into excel sheet with column headers.&lt;br /&gt;&lt;br /&gt;I spent almost 5 hrs to got it working, exporting data without column headers is a very easy job.&lt;br /&gt;but the main task was getting column headers also in the first row of excel sheet..&lt;br /&gt;so here is the script.. enjoy&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--&lt;br /&gt;google_ad_client = "ca-pub-2395186880727730";&lt;br /&gt;/* feb 10 */&lt;br /&gt;google_ad_slot = "9247630149";&lt;br /&gt;google_ad_width = 468;&lt;br /&gt;google_ad_height = 60;&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&lt;br /&gt;src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;NOTE:&lt;/span&gt; don't forget to replace &lt;span style="color: rgb(255, 0, 0);"&gt;&lt;strong&gt;RED&lt;/strong&gt;&lt;/span&gt; elements with your local environment elements &lt;span style="color: rgb(255, 0, 0);"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;use &lt;span style="color: rgb(255, 0, 0);"&gt;&lt;strong&gt;database&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;go&lt;br /&gt;if object_id('spExportData_n') is not null&lt;br /&gt;drop proc spExportData_n&lt;br /&gt;go&lt;br /&gt;create proc spExportData_n&lt;br /&gt;(&lt;br /&gt;@dbName varchar(100) = &lt;span style="color: rgb(255, 0, 0);"&gt;'&lt;/span&gt;&lt;strong&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;database&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;/strong&gt;',&lt;br /&gt;@sql varchar(8000) = 'select &lt;strong&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;col1,col2,col3....col4&lt;/span&gt;&lt;/strong&gt; from &lt;strong&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;table&lt;/span&gt;&lt;/strong&gt;',&lt;br /&gt;@fullFileName varchar(100) = '&lt;strong&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;output file path&lt;/span&gt;&lt;/strong&gt;'&lt;br /&gt;)&lt;br /&gt;as&lt;br /&gt;if @sql = '' or @fullFileName = ''&lt;br /&gt;begin&lt;br /&gt;select 0 as ReturnValue -- failure&lt;br /&gt;return&lt;br /&gt;end&lt;br /&gt;-- if DB isn't passed in set it to master&lt;br /&gt;select @dbName = 'use ' + @dbName + ';'&lt;br /&gt;if object_id('##TempExportData') is not null&lt;br /&gt;drop table ##TempExportData&lt;br /&gt;if object_id('##TempExportData2') is not null&lt;br /&gt;drop table ##TempExportData2&lt;br /&gt;-- insert data into a global temp table&lt;br /&gt;declare @columnNames varchar(8000), @columnConvert varchar(8000), @tempSQL varchar(8000)&lt;br /&gt;&lt;br /&gt;select @tempSQL = left(@sql, charindex('from', @sql)-1) + ' into ##TempExportData ' +&lt;br /&gt;substring(@sql, charindex('from', @sql)-1, len(@sql))&lt;br /&gt;&lt;br /&gt;exec(@dbName + @tempSQL)&lt;br /&gt;if @@error &gt; 0&lt;br /&gt;begin&lt;br /&gt;select 0 as ReturnValue -- failure&lt;br /&gt;return&lt;br /&gt;end&lt;br /&gt;-- build 2 lists&lt;br /&gt;-- 1. column names&lt;br /&gt;-- 2. columns converted to nvarchar&lt;br /&gt;SELECT @columnNames = COALESCE( @columnNames + ',', '') + column_name,&lt;br /&gt;@columnConvert = COALESCE( @columnConvert + ',', '') + 'convert(nvarchar(4000),'&lt;br /&gt;+ column_name + case when data_type in ('datetime', 'smalldatetime') then ',121'&lt;br /&gt;when data_type in ('numeric', 'decimal') then ',128'&lt;br /&gt;when data_type in ('float', 'real', 'money', 'smallmoney') then ',2'&lt;br /&gt;when data_type in ('datetime', 'smalldatetime') then ',120'&lt;br /&gt;else ''&lt;br /&gt;end + ') as ' + column_name&lt;br /&gt;FROM tempdb.INFORMATION_SCHEMA.Columns&lt;br /&gt;WHERE table_name = '##TempExportData'&lt;br /&gt;&lt;br /&gt;-- execute select query to insert data and column names into new temp table&lt;br /&gt;SELECT @sql = 'select ' + @columnNames + ' into ##TempExportData2 from (select ' + @columnConvert + ', ''2'' as [temp##SortID] from ##TempExportData union all select ''' + replace(@columnNames, ',', ''', ''') + ''', ''1'') t order by [temp##SortID]'&lt;br /&gt;&lt;br /&gt;exec (@sql)&lt;br /&gt;&lt;br /&gt;-- build full BCP query&lt;br /&gt;DECLARE @bcpCommand VARCHAR(8000)&lt;br /&gt;SET @bcpCommand = 'bcp " SELECT * from ##TempExportData2" queryout'&lt;br /&gt;SET @bcpCommand = @bcpCommand + ' &lt;span style="color: rgb(255, 0, 0);"&gt;&lt;strong&gt;C:\Temp\test.csv&lt;/strong&gt;&lt;/span&gt; -c -w -T -U sa -P sa","-CRAW'&lt;br /&gt;EXEC &lt;strong&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;database&lt;/span&gt;&lt;/strong&gt;&lt;database&gt;..xp_cmdshell @bcpCommand&lt;br /&gt;if @@error &gt; 0&lt;br /&gt;begin&lt;br /&gt;select 0 as ReturnValue -- failure&lt;br /&gt;return&lt;br /&gt;end&lt;br /&gt;drop table ##TempExportData&lt;br /&gt;drop table ##TempExportData2&lt;br /&gt;set @columnNames =' '&lt;br /&gt;set @columnConvert =' '&lt;br /&gt;set @tempSQL =' '&lt;br /&gt;select 1 as ReturnValue&lt;/database&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-592938861941470347?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/09/bcp-command-to-export-data-to-excel.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-2197202673895028763</guid><pubDate>Fri, 28 Aug 2009 07:14:00 +0000</pubDate><atom:updated>2009-08-28T00:16:10.799-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">duplicate rows</category><category domain="http://www.blogger.com/atom/ns#">delete duplicate rows</category><category domain="http://www.blogger.com/atom/ns#">TSQL</category><category domain="http://www.blogger.com/atom/ns#">business intelligence in sql server 2008</category><category domain="http://www.blogger.com/atom/ns#">CTE</category><category domain="http://www.blogger.com/atom/ns#">Common Table Expression</category><category domain="http://www.blogger.com/atom/ns#">CTE for deleting duplicate rows</category><title>CTE to delete duplicate rows from a table</title><description>Common-table expressions are a very useful new feature in SQL Server 2005. You can use them for recursive queries, &lt;br /&gt;&lt;br /&gt;removing duplicates, and even simple looping procedures.&lt;br /&gt;&lt;br /&gt;With some crafty TSQL, this is a relatively easy task to do when a primary key defined on the table. Luckily, the &lt;br /&gt;&lt;br /&gt;new CTE feature in SQL Server 2005 makes it very easy to remove these duplicates, with or without a primary key.&lt;br /&gt;&lt;br /&gt;The script below defines my CTE. I am using a windowing function named DENSE_RANK to group the records together &lt;br /&gt;&lt;br /&gt;based on the Product, SaleDate, and SalePrice fields, and assign them a sequential value randomly. This means that &lt;br /&gt;&lt;br /&gt;if I have two records with the exact same Product, SaleDate, and SalePrice values, the first record will be ranked &lt;br /&gt;&lt;br /&gt;as 1, the second as 2, and so on.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WITH SalesCTE(Product, SaleDate, SalePrice, Ranking)&lt;br /&gt;AS&lt;br /&gt;(&lt;br /&gt;&lt;br /&gt;SELECT Product, SaleDate, SalePrice,Ranking = DENSE_RANK() OVER(PARTITION BY Product, SaleDate, SalePrice ORDER BY &lt;br /&gt;&lt;br /&gt;NEWID() ASC)&lt;br /&gt;FROM SalesHistory&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;DELETE FROM SalesCTE WHERE Ranking &gt; 1&lt;/strong&gt;&lt;br /&gt;Because a CTE acts as a virtual table, I am able to process data modification statements against it, and the &lt;br /&gt;&lt;br /&gt;underlying table will be affected. In this case, I am removing any record from the SalesCTE that is ranked higher &lt;br /&gt;&lt;br /&gt;than 1. This will remove all of my duplicate records.&lt;br /&gt;&lt;br /&gt;To verify my duplicates have been removed, I can review the data in the table, which should now contain 8 records, &lt;br /&gt;&lt;br /&gt;rather than the previous 10.&lt;br /&gt;&lt;br /&gt;SELECT *FROM SalesHistory&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-2197202673895028763?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/08/cte-to-delete-duplicate-rows-from-table.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-1075111759810492399</guid><pubDate>Thu, 23 Jul 2009 08:47:00 +0000</pubDate><atom:updated>2009-07-23T01:57:54.934-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL script</category><category domain="http://www.blogger.com/atom/ns#">generate stored procedure</category><category domain="http://www.blogger.com/atom/ns#">Dynamic</category><category domain="http://www.blogger.com/atom/ns#">stored procedure</category><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">mysql stored procedure</category><title>Dynamically generate stored procedures for Insert, update and delete on a  table</title><description>Hi friends.....&lt;br /&gt;This stored procedure script is very useful for generating dynamic stored procedures for insert, update and delete operations on a table.&lt;br /&gt;&lt;br /&gt;After creating the table execute this SP with the table name as the parameter and it will automatically generate stored procedures for insert, update and delete operations on that table.&lt;br /&gt;&lt;br /&gt;In this way u can save your precious programming time for other important work..&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;strong&gt;Happy scripting..&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Copy and paste this stored procedure in your SQL server query browser and execute it..&lt;br /&gt;once created you can call this with the table name as a paramater&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;/*-- =======================================================================================&lt;br /&gt;-- Author : XYZ&lt;br /&gt;-- Create date : dd/mm/yy&lt;br /&gt;-- Description : Generate the Insert / Update/ Delete Stored procedure script of any table&lt;br /&gt;-- by passing the table name&lt;br /&gt;Exec [dbo].[sp_et_create_sps_for_table] 'et_application'&lt;br /&gt;&lt;br /&gt;-- ========================================================================================= */&lt;br /&gt;CREATE PROCEDURE [dbo].[sp_et_create_sps_for_table]&lt;br /&gt;@tblName Varchar(50)&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt;Declare @dbName Varchar(50)&lt;br /&gt;Declare @insertSPName Varchar(50), @updateSPName Varchar(50), @deleteSPName Varchar(50) ;&lt;br /&gt;Declare @tablColumnParameters Varchar(1000), @tableColumns Varchar(1000),@tableColumnVariables Varchar(1000);&lt;br /&gt;Declare @tableCols Varchar(1000), @tablinsertParameters Varchar(1000);&lt;br /&gt;Declare @space Varchar(50) ;&lt;br /&gt;Declare @colName Varchar(100) ;&lt;br /&gt;Declare @colVariable Varchar(100) ;&lt;br /&gt;Declare @colParameter Varchar(100) ;&lt;br /&gt;Declare @strSpText Varchar(8000);&lt;br /&gt;Declare @updCols Varchar(2000);&lt;br /&gt;Declare @delParamCols Varchar(2000);&lt;br /&gt;Declare @whereCols Varchar(2000);&lt;br /&gt;Set @tblName = SubString(@tblName,CharIndex('.',@tblName)+1, Len(@tblName))&lt;br /&gt;Set @insertSPName = '[dbo].[sp_' + lower(@tblName) +'_insert]' ;&lt;br /&gt;Set @updateSPName = '[dbo].[sp_' + lower(@tblName) +'_update]' ;&lt;br /&gt;Set @deleteSPName = '[dbo].[sp_' + lower(@tblName) +'_delete]' ;&lt;br /&gt;Set @space = REPLICATE(' ', 4) ;&lt;br /&gt;Set @tablColumnParameters = '' ;&lt;br /&gt;Set @tableColumns = '' ;&lt;br /&gt;Set @tableColumnVariables = '' ;&lt;br /&gt;Set @strSPText = '' ;&lt;br /&gt;Set @tableCols = '' ;&lt;br /&gt;Set @updCols = '' ;&lt;br /&gt;Set @delParamCols = '' ;&lt;br /&gt;Set @whereCols = '' ;&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;-- Get all columns &amp;amp; data types for a table&lt;br /&gt;&lt;br /&gt;-- SELECT distinct&lt;br /&gt;-- sysobjects.name as 'Table',&lt;br /&gt;-- syscolumns.colid ,&lt;br /&gt;-- '[' + syscolumns.name + ']' as 'ColumnName',&lt;br /&gt;-- '@'+syscolumns.name as 'ColumnVariable',&lt;br /&gt;-- systypes.name +&lt;br /&gt;-- Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'DataType' ,&lt;br /&gt;-- '@'+syscolumns.name + ' ' + systypes.name +&lt;br /&gt;-- Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'ColumnParameter'&lt;br /&gt;-- Into #tmp_Structure&lt;br /&gt;-- From sysobjects , syscolumns , systypes&lt;br /&gt;-- Where sysobjects.id = syscolumns.id&lt;br /&gt;-- and syscolumns.xusertype = systypes.xusertype&lt;br /&gt;-- and sysobjects.xtype = 'u'&lt;br /&gt;-- and sysobjects.name = @tblName&lt;br /&gt;-- and syscolumns.name!=(SELECT&lt;br /&gt;-- c.name AS ColumnName&lt;br /&gt;-- FROM sys.columns AS c&lt;br /&gt;-- INNER JOIN&lt;br /&gt;-- sys.tables AS t&lt;br /&gt;-- ON t.[object_id] = c.[object_id]&lt;br /&gt;-- where c.is_identity = 1&lt;br /&gt;-- and t.name=@tblName)&lt;br /&gt;-- Order by syscolumns.colid&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- SELECT distinct&lt;br /&gt;-- sysobjects.name as 'Table',&lt;br /&gt;-- syscolumns.colid ,&lt;br /&gt;-- '[' + syscolumns.name + ']' as 'ColumnName',&lt;br /&gt;-- '@'+syscolumns.name as 'ColumnVariable',&lt;br /&gt;-- systypes.name +&lt;br /&gt;-- Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'DataType' ,&lt;br /&gt;-- '@'+syscolumns.name + ' ' + systypes.name +&lt;br /&gt;-- Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'ColumnParameter'&lt;br /&gt;-- Into #tmp_Structure&lt;br /&gt;-- From sysobjects , syscolumns , systypes&lt;br /&gt;-- Where sysobjects.id = syscolumns.id&lt;br /&gt;-- and syscolumns.xusertype = systypes.xusertype&lt;br /&gt;-- and sysobjects.xtype = 'u'&lt;br /&gt;-- and sysobjects.name = @tblName&lt;br /&gt;-- Order by syscolumns.colid&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- Get all Primary KEY columns &amp;amp; data types for a table&lt;br /&gt;SELECT t.name as 'Table',&lt;br /&gt;c.colid ,&lt;br /&gt;'[' + c.name + ']' as 'ColumnName',&lt;br /&gt;'@'+c.name as 'ColumnVariable',&lt;br /&gt;systypes.name +&lt;br /&gt;Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),c.length) +')' Else '' end as 'DataType' ,&lt;br /&gt;'@'+c.name + ' ' + systypes.name +&lt;br /&gt;Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),c.length) +')' Else '' end as 'ColumnParameter'&lt;br /&gt;Into #tmp_PK_Structure&lt;br /&gt;FROM sysindexes i, sysobjects t, sysindexkeys k, syscolumns c, systypes&lt;br /&gt;WHERE i.id = t.id AND&lt;br /&gt;i.indid = k.indid AND i.id = k.ID And&lt;br /&gt;c.id = t.id AND c.colid = k.colid AND&lt;br /&gt;i.indid BETWEEN 1 And 254 AND&lt;br /&gt;c.xusertype = systypes.xusertype AND&lt;br /&gt;(i.status &amp;amp; 2048) = 2048 AND t.id = OBJECT_ID(@tblName)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--if exists(select * from #tmp_PK_Structure)&lt;br /&gt;--BEGIN&lt;br /&gt;--print 'y'&lt;br /&gt;SELECT distinct&lt;br /&gt;sysobjects.name as 'Table',&lt;br /&gt;syscolumns.colid ,&lt;br /&gt;'[' + syscolumns.name + ']' as 'ColumnName',&lt;br /&gt;'@'+syscolumns.name as 'ColumnVariable',&lt;br /&gt;systypes.name +&lt;br /&gt;Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'DataType' ,&lt;br /&gt;'@'+syscolumns.name + ' ' + systypes.name +&lt;br /&gt;Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'ColumnParameter'&lt;br /&gt;Into #tmp_Structure&lt;br /&gt;From sysobjects , syscolumns , systypes&lt;br /&gt;Where sysobjects.id = syscolumns.id&lt;br /&gt;and syscolumns.xusertype = systypes.xusertype&lt;br /&gt;and sysobjects.xtype = 'u'&lt;br /&gt;and sysobjects.name = @tblName&lt;br /&gt;and syscolumns.name!=(SELECT&lt;br /&gt;c.name AS ColumnName&lt;br /&gt;FROM sys.columns AS c&lt;br /&gt;INNER JOIN&lt;br /&gt;sys.tables AS t&lt;br /&gt;ON t.[object_id] = c.[object_id]&lt;br /&gt;where c.is_identity = 1&lt;br /&gt;and t.name=@tblName)&lt;br /&gt;Order by syscolumns.colid&lt;br /&gt;&lt;br /&gt;--END&lt;br /&gt;--ELSe&lt;br /&gt;--BEGIN&lt;br /&gt;--print 'n'&lt;br /&gt;SELECT distinct&lt;br /&gt;sysobjects.name as 'Table',&lt;br /&gt;syscolumns.colid ,&lt;br /&gt;'[' + syscolumns.name + ']' as 'ColumnName',&lt;br /&gt;'@'+syscolumns.name as 'ColumnVariable',&lt;br /&gt;systypes.name +&lt;br /&gt;Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'DataType' ,&lt;br /&gt;'@'+syscolumns.name + ' ' + systypes.name +&lt;br /&gt;Case When systypes.xusertype in (165,167,175,231,239 ) Then '(' + Convert(varchar(10),Case When syscolumns.length=-1 Then 4000 else syscolumns.length end) +')' Else '' end as 'ColumnParameter'&lt;br /&gt;Into #tmp_Structure1&lt;br /&gt;From sysobjects , syscolumns , systypes&lt;br /&gt;Where sysobjects.id = syscolumns.id&lt;br /&gt;and syscolumns.xusertype = systypes.xusertype&lt;br /&gt;and sysobjects.xtype = 'u'&lt;br /&gt;and sysobjects.name = @tblName&lt;br /&gt;Order by syscolumns.colid&lt;br /&gt;--END&lt;br /&gt;&lt;br /&gt;/* Read the table structure and populate variables*/&lt;br /&gt;Declare SpText_Cursor Cursor For&lt;br /&gt;Select ColumnName, ColumnVariable, ColumnParameter&lt;br /&gt;From #tmp_Structure&lt;br /&gt;&lt;br /&gt;Open SpText_Cursor&lt;br /&gt;&lt;br /&gt;Fetch Next From SpText_Cursor Into @colName, @colVariable, @colParameter&lt;br /&gt;While @@FETCH_STATUS = 0&lt;br /&gt;Begin&lt;br /&gt;Set @tableColumns = @tableColumns + @colName + CHAR(13) + @space + @space + ',' ;&lt;br /&gt;Set @tablColumnParameters = @tablColumnParameters + @colParameter + CHAR(13) + @space + ',' ;&lt;br /&gt;Set @tableColumnVariables = @tableColumnVariables + @colVariable + CHAR(13) + @space + @space + ',' ;&lt;br /&gt;Set @tableCols = @tableCols + @colName + ',' ;&lt;br /&gt;Set @updCols = @updCols + @colName + ' = ' + @colVariable + CHAR(13) + @space + @space + ',' ;&lt;br /&gt;Fetch Next From SpText_Cursor Into @colName, @colVariable, @colParameter&lt;br /&gt;End&lt;br /&gt;&lt;br /&gt;Close SpText_Cursor&lt;br /&gt;Deallocate SpText_Cursor&lt;br /&gt;&lt;br /&gt;/* for update parameter*/&lt;br /&gt;&lt;br /&gt;if exists(select * from #tmp_PK_Structure)&lt;br /&gt;BEGIN&lt;br /&gt;Set @tablinsertParameters=''&lt;br /&gt;Declare SpText_Cursor1 Cursor For&lt;br /&gt;Select ColumnParameter&lt;br /&gt;From #tmp_Structure1&lt;br /&gt;&lt;br /&gt;Open SpText_Cursor1&lt;br /&gt;&lt;br /&gt;Fetch Next From SpText_Cursor1 Into @colParameter&lt;br /&gt;While @@FETCH_STATUS = 0&lt;br /&gt;Begin&lt;br /&gt;&lt;br /&gt;Set @tablinsertParameters = @tablinsertParameters + @colParameter + CHAR(13) + @space + ',' ;&lt;br /&gt;Fetch Next From SpText_Cursor1 Into @colParameter&lt;br /&gt;End&lt;br /&gt;&lt;br /&gt;Close SpText_Cursor1&lt;br /&gt;Deallocate SpText_Cursor1&lt;br /&gt;END&lt;br /&gt;/*end for update parameter*/&lt;br /&gt;&lt;br /&gt;/* Read the Primary Keys from the table and populate variables*/&lt;br /&gt;Declare SpPKText_Cursor Cursor For&lt;br /&gt;Select ColumnName, ColumnVariable, ColumnParameter&lt;br /&gt;From #tmp_PK_Structure&lt;br /&gt;&lt;br /&gt;Open SpPKText_Cursor&lt;br /&gt;&lt;br /&gt;Fetch Next From SpPKText_Cursor Into @colName, @colVariable, @colParameter&lt;br /&gt;While @@FETCH_STATUS = 0&lt;br /&gt;Begin&lt;br /&gt;Set @delParamCols = @delParamCols + @colParameter + CHAR(13) + @space + ',' ;&lt;br /&gt;Set @whereCols = @whereCols + @colName + ' = ' + @colVariable + ' AND ' ;&lt;br /&gt;Fetch Next From SpPKText_Cursor Into @colName, @colVariable, @colParameter&lt;br /&gt;End&lt;br /&gt;&lt;br /&gt;Close SpPKText_Cursor&lt;br /&gt;Deallocate SpPKText_Cursor&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If (LEN(@tablinsertParameters)&gt;0)&lt;br /&gt;Set @tablinsertParameters = LEFT(@tablinsertParameters,LEN(@tablinsertParameters)-1) ;&lt;br /&gt;&lt;br /&gt;-- Stored procedure scripts starts here&lt;br /&gt;If (LEN(@tablColumnParameters)&gt;0)&lt;br /&gt;Begin&lt;br /&gt;Set @tablColumnParameters = LEFT(@tablColumnParameters,LEN(@tablColumnParameters)-1) ;&lt;br /&gt;Set @tableColumnVariables = LEFT(@tableColumnVariables,LEN(@tableColumnVariables)-1) ;&lt;br /&gt;Set @tableColumns = LEFT(@tableColumns,LEN(@tableColumns)-1) ;&lt;br /&gt;Set @tableCols = LEFT(@tableCols,LEN(@tableCols)-1) ;&lt;br /&gt;Set @updCols = LEFT(@updCols,LEN(@updCols)-1) ;&lt;br /&gt;&lt;br /&gt;If (LEN(@whereCols)&gt;0)&lt;br /&gt;Begin&lt;br /&gt;Set @whereCols = 'WHERE ' + LEFT(@whereCols,LEN(@whereCols)-4) ;&lt;br /&gt;Set @delParamCols = LEFT(@delParamCols,LEN(@delParamCols)-1) ;&lt;br /&gt;End&lt;br /&gt;&lt;br /&gt;/* Create INSERT stored procedure for the table if it does not exist */&lt;br /&gt;IF Not EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(@insertSPName) AND OBJECTPROPERTY(id,N'IsProcedure') = 1)&lt;br /&gt;Begin&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '/*-- ============================================='&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Author : dbo'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Create date : ' + Convert(varchar(20),Getdate())&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Description : Insert Procedure for ' + @tblName&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Exec ' + @insertSPName + ' ' + @tableCols&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- ============================================= */'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'CREATE PROCEDURE ' + @insertSPName&lt;br /&gt;&lt;br /&gt;if exists(select * from #tmp_PK_Structure)&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + ' ' + @tablColumnParameters&lt;br /&gt;else&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + ' ' + @tablinsertParameters&lt;br /&gt;&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'AS'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'BEGIN'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + 'INSERT INTO [dbo].['+@tblName +']'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + '( '&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + @space + ' ' + @tableColumns&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + ')'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + 'VALUES'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + '('&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + @space + ' ' + @tableColumnVariables&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + ')'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'END'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;--Print @strSPText ;&lt;br /&gt;--print&lt;br /&gt;Exec(@strSPText);&lt;br /&gt;&lt;br /&gt;if (@@ERROR=0)&lt;br /&gt;Print 'Procedure ' + @insertSPName + ' Created Successfully '&lt;br /&gt;End&lt;br /&gt;Else&lt;br /&gt;Begin&lt;br /&gt;Print 'Sorry!! ' + @insertSPName + ' Already exists in the database. '&lt;br /&gt;End&lt;br /&gt;/* Create UPDATE stored procedure for the table if it does not exist */&lt;br /&gt;IF Not EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(@updateSPName) AND OBJECTPROPERTY(id,N'IsProcedure') = 1)&lt;br /&gt;Begin&lt;br /&gt;Set @strSPText = ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '/*-- ============================================='&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Author : dbo'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Create date : ' + Convert(varchar(20),Getdate())&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Description : Update Procedure for ' + @tblName&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Exec ' + @updateSPName + ' ' + @tableCols&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- ============================================= */'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'CREATE PROCEDURE ' + @updateSPName&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if exists(select * from #tmp_PK_Structure)&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + ' ' + @tablinsertParameters&lt;br /&gt;else&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + ' ' + @tablColumnParameters&lt;br /&gt;--Set @strSPText = @strSPText + CHAR(13) + @space + ' ' + @tablColumnParameters&lt;br /&gt;&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'AS'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'BEGIN'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + 'UPDATE [dbo].['+@tblName +']'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + 'SET '&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + @space + ' ' + @updCols&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + @whereCols&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'END'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;--Print @strSPText ;&lt;br /&gt;Exec(@strSPText);&lt;br /&gt;&lt;br /&gt;if (@@ERROR=0)&lt;br /&gt;Print 'Procedure ' + @updateSPName + ' Created Successfully '&lt;br /&gt;End&lt;br /&gt;Else&lt;br /&gt;Begin&lt;br /&gt;Print 'Sorry!! ' + @updateSPName + ' Already exists in the database. '&lt;br /&gt;End&lt;br /&gt;/* Create DELETE stored procedure for the table if it does not exist */&lt;br /&gt;IF Not EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(@deleteSPName) AND OBJECTPROPERTY(id,N'IsProcedure') = 1)&lt;br /&gt;Begin&lt;br /&gt;Set @strSPText = ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '/*-- ============================================='&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Author : dbo'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Create date : ' + Convert(varchar(20),Getdate())&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Description : Delete Procedure for ' + @tblName&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- Exec ' + @deleteSPName + ' ' + @delParamCols&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + '-- ============================================= */'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'CREATE PROCEDURE ' + @deleteSPName&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + ' ' + @delParamCols&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'AS'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'BEGIN'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + 'DELETE FROM [dbo].['+@tblName +']'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + @space + @whereCols&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + 'END'&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;Set @strSPText = @strSPText + CHAR(13) + ''&lt;br /&gt;--Print @strSPText ;&lt;br /&gt;Exec(@strSPText);&lt;br /&gt;&lt;br /&gt;if (@@ERROR=0)&lt;br /&gt;Print 'Procedure ' + @deleteSPName + ' Created Successfully '&lt;br /&gt;End&lt;br /&gt;Else&lt;br /&gt;Begin&lt;br /&gt;Print 'Sorry!! ' + @deleteSPName + ' Already exists in the database. '&lt;br /&gt;End&lt;br /&gt;End&lt;br /&gt;Drop table #tmp_Structure&lt;br /&gt;Drop table #tmp_Structure1&lt;br /&gt;Drop table #tmp_PK_Structure&lt;br /&gt;END&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-1075111759810492399?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/07/dynamically-generate-stored-procedures.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-8644185847594840234</guid><pubDate>Tue, 02 Jun 2009 06:03:00 +0000</pubDate><atom:updated>2009-06-01T23:05:27.213-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">communicate with internet from console application</category><category domain="http://www.blogger.com/atom/ns#">Console to internet</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><category domain="http://www.blogger.com/atom/ns#">winforms</category><category domain="http://www.blogger.com/atom/ns#">c# console</category><title>Communicating with inernet from Console application</title><description>Following code can be used to communicate with internet from a console application.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Security.Cryptography;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Net.Sockets;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;namespace GirderInternetEventClient&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;public class GirderInternetEventClient&lt;br /&gt;{&lt;br /&gt;public GirderInternetEventClient()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;if (args.Length == 4)&lt;br /&gt;{&lt;br /&gt;sendEventString(args[0], int.Parse(args[1]), args[2], args[3]);&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Console.WriteLine("Girder Internet Event Client");&lt;br /&gt;&lt;br /&gt;Console.Write("Enter host [localhost]: ");&lt;br /&gt;&lt;br /&gt;string host = Console.ReadLine();&lt;br /&gt;&lt;br /&gt;if (host.Equals("")) host = "localhost";&lt;br /&gt;&lt;br /&gt;Console.Write("Enter port [1024]: ");&lt;br /&gt;&lt;br /&gt;string port = Console.ReadLine();&lt;br /&gt;&lt;br /&gt;if (port.Equals("")) port = "1024";&lt;br /&gt;&lt;br /&gt;Console.Write("Enter password [NewDefPWD]: ");&lt;br /&gt;&lt;br /&gt;string password = Console.ReadLine();&lt;br /&gt;&lt;br /&gt;if (password.Equals("")) password = "NewDefPWD";&lt;br /&gt;&lt;br /&gt;Console.Write("Enter event [CR ends]: ");&lt;br /&gt;&lt;br /&gt;string event_string = Console.ReadLine();&lt;br /&gt;&lt;br /&gt;while (!event_string.Equals(""))&lt;br /&gt;{&lt;br /&gt;sendEventString(host, int.Parse(port), password, event_string);&lt;br /&gt;&lt;br /&gt;Console.Write("Enter event [CR ends]: ");&lt;br /&gt;&lt;br /&gt;event_string = Console.ReadLine();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Console.WriteLine("Done");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static String getHexString(byte[] bytes)&lt;br /&gt;{&lt;br /&gt;String hex_string = "";&lt;br /&gt;byte[] item = { 0 };&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &lt; bytes.Length; i++)&lt;br /&gt;{&lt;br /&gt;item[0] = bytes[i];&lt;br /&gt;hex_string += BitConverter.ToString(item);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return hex_string;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static String getMD5String(String str)&lt;br /&gt;{&lt;br /&gt;MD5 md5 = new MD5CryptoServiceProvider();&lt;br /&gt;&lt;br /&gt;byte[] result = md5.ComputeHash((new UTF8Encoding()).GetBytes(str));&lt;br /&gt;&lt;br /&gt;return getHexString(result);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void sendEventString(String hostname, int port, String password, String event_string)&lt;br /&gt;{&lt;br /&gt;TcpClient tcpClient = new TcpClient();&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;tcpClient.Connect(hostname, port);&lt;br /&gt;&lt;br /&gt;NetworkStream networkStream = tcpClient.GetStream();&lt;br /&gt;StreamReader input = new StreamReader(networkStream);&lt;br /&gt;StreamWriter output = new StreamWriter(networkStream);&lt;br /&gt;output.AutoFlush = true;&lt;br /&gt;&lt;br /&gt;output.WriteLine("quintessence");&lt;br /&gt;String cookie = input.ReadLine();&lt;br /&gt;output.WriteLine(getMD5String(cookie + ":" + password));&lt;br /&gt;String accept_result = input.ReadLine();&lt;br /&gt;&lt;br /&gt;if (accept_result.Equals("accept"))&lt;br /&gt;{&lt;br /&gt;output.WriteLine(event_string);&lt;br /&gt;&lt;br /&gt;output.WriteLine("close");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;tcpClient.Close();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-8644185847594840234?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/06/communicating-with-inernet-from-console.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-5804011343730379393</guid><pubDate>Tue, 02 Jun 2009 05:52:00 +0000</pubDate><atom:updated>2009-06-01T22:59:45.721-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">internet explorer</category><category domain="http://www.blogger.com/atom/ns#">blink</category><category domain="http://www.blogger.com/atom/ns#">IE</category><category domain="http://www.blogger.com/atom/ns#">blinking text</category><title>Blink text in IE</title><description>Its very easy to blink text in Firefox/Mozilla by simply assigning text-decoration:blink in the style of the container.&lt;br /&gt;&lt;br /&gt;But Interner Explorer (IE) does not supports this property, so here is a trick to blink text in IE&lt;br /&gt;&lt;br /&gt;&amp;lt;style type="text/css"&gt; &lt;br /&gt;.blink{ &lt;br /&gt;visibility: expression((Math.floor(new Date().getTime()/500)%2 ) ? "visible":"hidden");}&lt;br /&gt;&amp;lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&gt;&lt;br /&gt;setInterval("document.recalc()",1);&lt;br /&gt;&amp;lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cheers&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-5804011343730379393?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/06/blink-text-in-ie.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-8706782017066149936</guid><pubDate>Wed, 27 May 2009 11:09:00 +0000</pubDate><atom:updated>2009-05-27T04:16:16.428-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Unicode character</category><category domain="http://www.blogger.com/atom/ns#">£ in textbox</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><category domain="http://www.blogger.com/atom/ns#">c#</category><category domain="http://www.blogger.com/atom/ns#">textbox</category><category domain="http://www.blogger.com/atom/ns#">problem with unicode on web form</category><title>Display unicode characters in the web control</title><description>First let me explain the scenario.&lt;br /&gt;&lt;br /&gt;You have unicode data in one of the fields of my DB table, and you want to fetch the unicode data and display it in a textbox lets say a currency symbol £ (GPB).&lt;br /&gt;&lt;br /&gt;Now if you are simply assigning the text from datatable field then it would not show £ sign rather some other code value.&lt;br /&gt;&lt;br /&gt;Its very simple to display it in its actual form just use&lt;br /&gt;&lt;br /&gt;HttpUtility.HtmlDecode on the string &lt;br /&gt;coming from the DB and get the correct output.&lt;br /&gt;&lt;br /&gt;Cheers&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-8706782017066149936?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/05/display-unicode-characters-in-web.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-3094615520399119546</guid><pubDate>Fri, 17 Apr 2009 13:11:00 +0000</pubDate><atom:updated>2009-05-06T11:35:38.944-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">problem with web.config</category><category domain="http://www.blogger.com/atom/ns#">asp.net security</category><category domain="http://www.blogger.com/atom/ns#">security vulnerabilities</category><category domain="http://www.blogger.com/atom/ns#">web.config settings</category><category domain="http://www.blogger.com/atom/ns#">Application Security</category><title>Application Security Vulnerabilities in Web.config File</title><description>&lt;div&gt;The biggest threat to an organization’s network security comes from its public Web site and the&lt;br /&gt;Web-based applications found there. As networks have become more secure, vulnerabilities in Web applications have inevitably attracted the attention of hackers who have techniques to exploit these holes.&lt;br /&gt;&lt;br /&gt;Some of the most common and dangerous application security vulnerabilities that exist in ASP.NET Web-based applications come not from the C# or VB.NET code that make up its pages and service methods, but instead from the XML code that makes up its Web.config files. Incorrect configurations can open Web sites to application security holes such as session hijacking, Cross-Site Scripting attacks, and even allow the disclosure of private data to attackers. An additional problem is that Web.config files were designed to be changed at any time, even after the Web-based applications are in production.&lt;br /&gt;&lt;br /&gt;A well-intentioned system administrator could inadvertently get around application security measures and open the Web site to attack just by modifying the configuration file. And because .NET configuration files operate in a hierarchical manner, a single change to the global Machine.config file could affect every Web site on the entire network.&lt;br /&gt;&lt;br /&gt;In fact, attacks upon the Web application layer now exceed those conducted at the network level, and can have consequences which are just as damaging. By "baking in" application security from the start of the development process, rather than trying to ”brush it on” at the end, you are much more likely to create secure applications that will withstand hackers' attacks. However, even the most meticulous and security-aware C# or VB.NET code can still be vulnerable to attack if you neglect to secure the Web.config configuration files of your application. Incorrectly configured Web-based applications can be just as dangerous as those that have been incorrectly coded. To make matters worse, many configuration settings actually default to insecure values.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. &lt;span style="color:#3333ff;"&gt;Custom Errors Disabled&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;When you disable custom errors as shown below, ASP.NET provides a detailed error message to clients by default.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Vulnerable configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;customErrors mode=”Off”&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;strong&gt;Secure configuration: &lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;customErrors mode=”RemoteOnly”&gt;&lt;br /&gt;&lt;br /&gt;In itself, knowing the source of an error may not seem like a risk to application security, but&lt;br /&gt;consider this: the more information a hacker can gather about a Web site, the more likely it is that he will be able to successfully attack it.&lt;br /&gt;&lt;br /&gt;An error message can be a gold mine of information to an attacker. A default ASP.NET error message lists the specific versions of ASP.NET and the .NET framework which are being used by the Web server, as well as the type of exception that was thrown. Just knowing which Web-based applications are used (in this case ASP.NET) compromises application security by telling the attacker that the server is running a relatively recent version of Microsoft Windows and that Microsoft Internet Information Server (IIS) 6.0 or later is being used as the Web server.&lt;br /&gt;&lt;br /&gt;You can build up application security to prevent such information leakage by modifying the mode attribute of the &amp;lt;customErrors&gt; element to On or RemoteOnly. This setting instructs Web-based applications to display a nondescript, generic error message when an unhandled exception is generated.&lt;br /&gt;Another way to circumvent this application security issue is to redirect the user to a new page when errors occur by setting the defaultRedirect attribute of the &amp;lt;customErrors&gt; element.&lt;br /&gt;&lt;br /&gt;2. &lt;span style="color:#3333ff;"&gt;Leaving Tracing Enabled in Web-Based Applications&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The trace feature of ASP.NET is one of the most useful tools that you can use to ensure application security by debugging and profiling your Web-based applications. Unfortunately, it is also one of the most useful tools that a hacker can use to attack your Web-based applications if it is left enabled in a production environment.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration: &lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;trace enabled=”true” localOnly=”false”&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;strong&gt;Secure configuration: &lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;trace enabled=”false” localOnly=”true”&gt;&lt;br /&gt;&lt;br /&gt;When the &amp;lt;trace&gt; element is enabled for remote users of Web-based applications ( localOnly="false"), any user can view an incredibly detailed list of recent requests to the application simply by browsing to the page trace.axd. If a detailed exception message is like a gold mine to a hacker looking to circumvent application security, a trace log is like Fort Knox! A trace log presents a wealth of information: the .NET and ASP.NET versions that the server is running; a complete trace of all the page methods that the request caused, including their times of execution; the session state and application state keys; the request and response cookies; the complete set of request headers, form variables, and QueryString variables; and finally the complete set of server variables.&lt;br /&gt;&lt;br /&gt;A hacker looking for a way around application security would obviously find the form variable&lt;br /&gt;histories useful because these might include email addresses that could be harvested and sold to&lt;br /&gt;spammers, IDs and passwords that could be used to impersonate the user, or credit card and bank account numbers. Even the most innocent-looking piece of data in the trace collection can be dangerous in the wrong hands. For example, the APPL_PHYSICAL_PATH server variable, which contains the physical path of Web-based applications on the server, could help an attacker perform directory traversal attacks against the system.&lt;br /&gt;&lt;br /&gt;The best way to prevent a hacker from obtaining trace data from Web-based applications is to disable the trace viewer completely by setting the enabled attribute of the &amp;lt;trace&gt; element to false. If you have to have the trace viewer enabled, either to debug or to profile your application, then be sure to set the localOnly attribute of the &amp;lt;trace&gt; element to true. That allows users to access the trace viewer only from the Web server and disables viewing it from any remote machine, increasing your application security.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. &lt;span style="color:#3333ff;"&gt;Debugging Enabled&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Web servers often are installed with default configurations that may not be secure. These&lt;br /&gt;insecurities include unnecessary samples and templates, administrative tools, and predictable&lt;br /&gt;locations of utilities used to manage servers. Without appropriate security risk management, this can lead to several types of attacks that allow hackers to gain complete control over the Web server.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;compilation debug=”true”&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33cc00;"&gt;Secure configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;compilation debug=”false”&gt;&lt;br /&gt;&lt;br /&gt;Like the first two application security vulnerabilities described in this list, leaving debugging&lt;br /&gt;enabled is dangerous because you are providing inside information to users who shouldn’t have access to it, and who may use it to attack your Web-based applications. For example, if you have enabled debugging and disabled custom errors in your application, then any error message displayed to a user of your Web-based applications will include not only the server information, a detailed exception message, and a stack trace, but also the actual source code of the page where the error occurred. Unfortunately, this configuration setting isn't the only way that source code might be displayed to the user.&lt;br /&gt;&lt;br /&gt;4. &lt;span style="color:#3333ff;"&gt;Cookies Accessible through Client-Side Script&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In Internet Explorer 6.0, Microsoft introduced a new cookie property called HttpOnly. While you can set the property programmatically on a per-cookie basis, you also can set it globally in the site configuration.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;httpCookies httpOnlyCookies=”false”&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33cc00;"&gt;Secure configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;httpCookies httpOnlyCookies=”true”&gt;&lt;br /&gt;&lt;br /&gt;Any cookie marked with this property will be accessible only from server-side code, and not to any client-side scripting code like JavaScript or VBScript. This shielding of cookies from the client helps to protect Web-based applications from Cross-Site Scripting attacks. A hacker initiates a Cross-Site Scripting (also called CSS or XSS) attack by attempting to insert his own script code into the Web page to get around any application security in place. Any page that accepts input from a user and echoes that input back is potentially vulnerable. For example, a login page that prompts for a user name and password and then displays “Welcome back, &amp;lt;username&gt;” on a successful login may be susceptible to an XSS attack.&lt;br /&gt;&lt;br /&gt;As mentioned earlier, it is possible to enable HttpOnly programmatically on any individual cookie by setting the HttpOnly property of the HttpCookie object to true. However, it is easier and more reliable to configure the application to automatically enable HttpOnly for all cookies. To do this, set the httpOnlyCookies attribute of the &amp;lt;httpCookies&gt; element to true.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. &lt;span style="color:#3333ff;"&gt;Cookieless Session State Enabled&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the initial 1.0 release of ASP.NET, you had no choice about how to transmit the session token&lt;br /&gt;between requests when your Web application needed to maintain session state: it was always stored in a cookie. Unfortunately, this meant that users who would not accept cookies could not use your application. So, in ASP.NET 1.1, Microsoft added support for cookieless session tokens via use of the “cookieless” setting.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Vulnerable configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;sessionState cookieless=”UseUri”&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33cc00;"&gt;Secure configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;sessionState cookieless=”UseCookies”&gt;&lt;br /&gt;&lt;br /&gt;Web applications configured to use cookieless session state now stored the session token in the page URLs rather than a cookie. For example, the page URL might change from &lt;a href="http://myserver.com/MyApplication/default.aspx"&gt;http://myserver.com/MyApplication/default.aspx&lt;/a&gt; to&lt;br /&gt;http://myserver.com/MyApplication/(ANCFGNBG12345678)/default.aspx. In this case, 123456789ABCDEFG represents the current user's session token. A different user browsing the site at the same time would receive a completely different session token, resulting in a different URL, such as &lt;a href="http://myserver.com/MyApplication/(ABCDFU987678920)/default.aspx"&gt;http://myserver.com/MyApplication/(ABCDFU987678920)/default.aspx&lt;/a&gt;.&lt;br /&gt;While adding support for cookieless session state did improve the usability of ASP.NET Web&lt;br /&gt;applications for users who would not accept cookies, it also had the side effect of making those&lt;br /&gt;applications much more vulnerable to session hijacking attacks.&lt;br /&gt;&lt;br /&gt;Session hijacking is basically a form of identity theft wherein a hacker impersonates a legitimate&lt;br /&gt;user by stealing his session token. When the session token is transmitted in a cookie, and the request is made on a secure channel (that is, it uses SSL), the token is secure. However, when the session token is included as part of the URL, it is much easier for a hacker to find and steal it. By using a network monitoring tool (also known as a “sniffer”) or by obtaining a recent request log, hijacking the user’s session becomes a simple matter of browsing to the URL containing the stolen unique session token. The Web application has no way of knowing that this new request with session token “123456789ABCDEFG” is not coming from the original, legitimate user. It happily loads the corresponding session state and returns the response back to the hacker, who has now effectively impersonated the user.&lt;br /&gt;&lt;br /&gt;The most effective way to prevent these session hijacking attacks is to force your Web application to use cookies to store the session token. This is accomplished by setting the cookieless attribute of the &amp;lt;sessionState&gt; element to UseCookies or false. But what about the users who do not accept cookies?&lt;br /&gt;&lt;br /&gt;Do you have to choose between making your application available to all users versus ensuring that it operates securely for all users? A compromise between the two is possible in ASP.NET 2.0. By setting the cookieless attribute to AutoDetect, the application will store the session token in a cookie for users who accept them and in the URL for those who won’t. This means that only the users who use cookieless tokens will still be vulnerable to session hijacking. That's often acceptable, given the alternative—that users who deny cookies wouldn't be able to use the application at all. It is ironic that many users disable cookies because of privacy concerns when doing so can actually make them more prone to attack.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now we will focus on authentication and authorization application security issues, and detail vulnerabilities commonly found in ASP.NET Web-based applications using Forms authentication. It will also provide some best practices for application security, including locking down your configuration files to ensure that they are not unintentionally modified by well-meaning (but uninformed) programmers or administrators.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. &lt;span style="color:#3333ff;"&gt;Cookieless Authentication Enabled&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just as in the “Cookieless Session State Enabled” vulnerability discussed in part one, enabling&lt;br /&gt;cookieless authentication in your Web-based applications can lead to session hijacking and problems with application security.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms cookieless=”UseUri”&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33cc00;"&gt;Secure configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms cookieless=”UseCookies”&gt;&lt;br /&gt;&lt;br /&gt;When a session or authentication token appears in the request URL rather than in a secure cookie, an attacker with a network monitoring tool can get around application security, easily take over that session, and effectively impersonate a legitimate user. However, session hijacking has far more serious consequences for application security after a user has been authenticated.&lt;br /&gt;&lt;br /&gt;The best way to prevent session hijacking with Web-based applications is to disable cookieless&lt;br /&gt;authentication and force the use of cookies for storing authentication tokens. This application&lt;br /&gt;security measure is added by changing the cookieless attribute of the &amp;lt;forms&gt; element to the value UseCookies.&lt;br /&gt;&lt;br /&gt;7. &lt;span style="color:#3333ff;"&gt;Failure to Require SSL for Authentication Cookies &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Web-based applications use the Secure Sockets Layer (SSL) protocol to encrypt data passed between the Web server and the client. Using SSL for application security means that attackers using network sniffers will not be able to interpret the exchanged data. Rather than seeing plain text requests and responses, they will see only an indecipherable jumble of meaningless characters. You can require the forms authentication cookie from your Web-based applications to use SSL by setting the require SSL attribute of the &amp;lt;forms&gt; element to true.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms requireSSL=”false”&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33cc00;"&gt;Secure configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms requireSSL=”true”&gt;&lt;br /&gt;&lt;br /&gt;The previous section discussed the importance of transmitting the authentication token in a cookie, rather than embedding it in the request URL. However, disabling cookieless authentication is just the first step towards securing the authentication token. Unless requests made to the Web server are encrypted, a network sniffer will still be able to read the authentication token from the request cookie. An attacker would still be able to hijack the user’s session.&lt;br /&gt;&lt;br /&gt;At this point, you might be wondering why it is necessary with application security to disable&lt;br /&gt;cookieless authentication, since it is very inconvenient for users who won’t accept cookies, and&lt;br /&gt;seeing as how the request still has to be sent over SSL. The answer is that the request URL is often persisted regardless of whether or not it was sent via SSL. Most major browsers save the complete URL in the browser history cache. If the history cache were to be compromised, the user’s login credentials would be as well. Therefore, to truly secure the authentication token, you must require the authentication token to be stored in a cookie, and use SSL to ensure that the cookie be transmitted securely. By setting the requireSSL attribute of the &amp;lt;forms&gt; element to true, ASP.NET Web-based applications will use a secure connection when transmitting the authentication cookie to the Web server. Note that IIS requires additional configuration steps to support SSL. You can find instructions to configure SSL for IIS on &lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/56bdf977-14f8-4867-9c" mfr="'true"&gt;MSDN&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;8. &lt;span style="color:#3366ff;"&gt;Sliding Expiration Used&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;All authenticated ASP.NET sessions have a timeout interval to protect the application security. The default timeout value is 30 minutes. So, 30 minutes after a user first logs into any of these&lt;br /&gt;Web-based applications, he will automatically be logged out and forced to re-authenticate his&lt;br /&gt;credentials.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms slidingExpiration=”true”&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;strong&gt;Secure configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms slidingExpiration=”false”&gt;&lt;br /&gt;&lt;br /&gt;The slidingExpiration setting is an application security measure used to reduce risk to Web-based applications in case the authentication token is stolen. When set to false, the specified timeout interval becomes a fixed period of time from the initial login, rather than a period of inactivity.&lt;br /&gt;&lt;br /&gt;Attackers using a stolen authentication token have, at maximum, only the specified length of time to impersonate the user before the session times out. Because typical attackers of these Web-based applications have only the token, and don't really know the user's credentials, they can't log back in as the legitimate user, so the stolen authentication token is now useless and the application security threat is mitigated. When sliding expiration is enabled, as long as an attacker makes at least one request to the system every 15 minutes (or half of the timeout interval), the session will remain open indefinitely. This gives attackers more opportunities to steal information and cause other mischief in Web-based applications. To avoid this application security issue altogether, you can disable sliding expiration by setting the slidingExpiration attribute of the &amp;lt;forms&gt; element to false.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. &lt;span style="color:#3366ff;"&gt;Non-Unique Authentication Cookie Used&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;A cookie is more than just a value; it is a name-value pair. As strange as it seems, an improperly&lt;br /&gt;chosen cookie name can create an application security vulnerability just as dangerous as an improperly chosen storage location.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms name=”.ASPXAUTH”&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;strong&gt;Secure configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms name=”{abcd1234…}”&gt;&lt;br /&gt;&lt;br /&gt;The default value for the name of the authentication cookie is .ASPXAUTH. If you have only one&lt;br /&gt;Web-based application on your server, then .ASPXAUTH is a perfectly secure choice for the cookie name.&lt;br /&gt;In fact, any choice would be secure. But, when your server runs multiple ASP.NET Web-based&lt;br /&gt;applications, it becomes critical to assign a unique authentication cookie name to each application.&lt;br /&gt;If the names are not unique, then users logging into any of the Web-based applications might&lt;br /&gt;inadvertently gain access to all of them. For example, a user logging into the online shopping site to view his order history might find that he is now able to access the administration application on the same site and change the prices of the items in his shopping cart.&lt;br /&gt;&lt;br /&gt;The best way to ensure that all Web-based applications on your server have their own set of authorized users is to change the authentication cookie name to a unique value. Globally Unique Identifiers (GUIDs) are excellent choices for application security since they are guaranteed to be unique.&lt;br /&gt;&lt;br /&gt;Microsoft Visual Studio helpfully includes a tool that will automatically generate a GUID for you. You can find this tool in the Tools menu with the command name “Create GUID”. Copy the generated GUID into the name attribute of the &amp;lt;forms&gt; element in the configuration file.&lt;br /&gt;&lt;br /&gt;10. &lt;span style="color:#3333ff;"&gt;Hardcoded Credentials Used&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Vulnerable configuration:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms&gt;&lt;br /&gt;&amp;lt;credentials&gt;&lt;br /&gt;…&lt;br /&gt;&amp;lt;/credentials&gt;&lt;br /&gt;&amp;lt;/forms&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33cc00;"&gt;Secure configuration:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;&amp;lt;authentication mode=”Forms”&gt;&lt;br /&gt;&amp;lt;forms&gt;&lt;br /&gt;&amp;lt;/forms&gt;&lt;br /&gt;&lt;br /&gt;A fundamental difficulty of creating software is that the environment in which the application will be deployed is usually not the same environment in which it is created. In a production environment, the operating system may be different, the hardware on which the application runs may be more or less powerful, and test databases are replaced with live databases. This is an issue for creating Web-based applications that require authentication because developers and administrators often use test credentials to test the application security. This begs the question: Where do the test credentials come from?&lt;br /&gt;&lt;br /&gt;For convenience, to avoid forcing developers from spending time on creating a credential store used solely for test purposes (and which would subsequently be discarded when the application went to production), Microsoft added a section to the Web.config file that you can use to quickly add test users to Web-based applications. For each test user, the developer adds an element to the configuration file with the desired user ID and password as shown below:&lt;br /&gt;&lt;br /&gt;&amp;lt;authentication mode="Forms"&gt;&lt;br /&gt;&amp;lt;forms&gt;&lt;br /&gt;&amp;lt;credentials&gt;&lt;br /&gt;&amp;lt;user name="bob" password="bob"/&gt;&lt;br /&gt;&amp;lt;user name="jane" password="Elvis"/&gt;&lt;br /&gt;&amp;lt;/credentials&gt;&lt;br /&gt;&amp;lt;/forms&gt;&lt;br /&gt;&amp;lt;/authentication&gt;&lt;br /&gt;&lt;br /&gt;While undeniably convenient for development purposes, this was never intended for use in a production environment. Storing login credentials in plaintext in a configuration file is simply not secure.&lt;br /&gt;Anyone with read access to the Web.config file could access the authenticated Web application. It is possible to store the SHA-1 or MD5 hash of the password value, rather than storing the password in plaintext. This is somewhat better, but it is still not a secure solution. Using this method, the user name is still not encrypted. First, providing a known user name to a potential attacker makes it easier to perform a brute force attack against the system. Second, there are many reverse-lookup databases of SHA-1 and MD5 hash values available on the Internet. If the password is simple, such as a word found in a dictionary, then it is almost guaranteed to be found in one of these hash dictionaries.&lt;br /&gt;&lt;br /&gt;The most secure way to store login credentials is to not store them in the configuration file. Remove the &amp;lt;credentials&gt; element from your Web.config files in production applications.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;You’re Not secured Yet&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now that you’ve finished reading the top ten list, and you've checked your configuration settings, your applications are secure forever, right? Not just yet. Web.config files operate in a hierarchical inheritance manner. Every Web.config file inherits values from any Web.config file in a parent&lt;br /&gt;directory. That Web.config file in turn inherits values from any Web.config file in its parent&lt;br /&gt;directory, and so on. All Web.config files on the system inherit from the global configuration file&lt;br /&gt;called Machine.config located in the .NET framework directory. The effect of this is that the runtime behavior of your application can be altered simply by modifying a configuration file in a higher directory.&lt;br /&gt;&lt;br /&gt;This can sometimes have unexpected consequences. A system administrator might make a change in a configuration file in response to a problem with a completely separate application, but that change might create a security vulnerability in your application. For example, a user might report that he is not able to access the application without enabling cookies in his browser. The administrator, trying to be helpful, modifies the global configuration file to allow cookieless authentication for all applications.&lt;br /&gt;&lt;br /&gt;To keep your application-specific settings from being unexpectedly modified, the solution is to never rely on default setting values. For example, debugging is disabled by default in configuration files.&lt;br /&gt;&lt;br /&gt;If you’re examining the configuration file for your application and you notice that the debug&lt;br /&gt;attribute is blank, you might assume that debugging is disabled. But it may or may not be disabled—the applied value depends on the value in parent configuration settings on the system. The safest choice is to always explicitly set security-related values in your application’s configuration.&lt;br /&gt;&lt;br /&gt;Ultimately, securing a Web application requires the efforts and diligence of many different groups, from quality assurance to security operations. However, the developer who codes the application itself has an inherent responsibility to instill security into the application from the beginning of the development process. By making security-conscious decisions from the beginning, developers can create applications that users can trust with their confidential information and that are capable of withstanding attacks launched by hackers. Sometimes that process can be as simple as making the right decisions when configuring your application.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;million thank to &lt;/span&gt;&lt;a href="http://h71028.www7.hp.com/ERC/cache/571845-0-0-0-121.html"&gt;&lt;span style="font-size:85%;"&gt;1&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;a href="http://h71028.www7.hp.com/ERC/cache/571914-0-0-0-121.html"&gt;&lt;span style="font-size:85%;"&gt;2&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt; for providing these useful security vulnerabilities&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Have a &lt;span style="color:#3333ff;"&gt;secured programming&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=5254293"&gt;&lt;span style="font-family:arial;font-size:120%;color:#3333ff;"&gt;if this was helpful then please donate as much you want &lt;/span&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5332780573564909986" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 122px; CURSOR: hand; HEIGHT: 47px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_sINvh8Ncl78/SgHXrWhwuaI/AAAAAAAAACE/2ZXqTUfooM4/s320/btn_donateCC_LG.gif" border="0" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Cheers&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-3094615520399119546?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/04/application-security-vulnerabilities-in.html</link><author>noreply@blogger.com (Blog Admin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_sINvh8Ncl78/SgHXrWhwuaI/AAAAAAAAACE/2ZXqTUfooM4/s72-c/btn_donateCC_LG.gif" height="72" width="72" /><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-2589174300224327937</guid><pubDate>Mon, 06 Apr 2009 10:07:00 +0000</pubDate><atom:updated>2009-05-06T11:40:14.547-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">preserve original url after post back</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><category domain="http://www.blogger.com/atom/ns#">asp.net 2.0</category><category domain="http://www.blogger.com/atom/ns#">post back problem</category><category domain="http://www.blogger.com/atom/ns#">url mapping</category><category domain="http://www.blogger.com/atom/ns#">url rewriting</category><title>URL rewriting / mapping in ASP.Net</title><description>URL rewriting or mapping is an important feature of a web application, by which you can give search engine friendly URLs in your application and provide extra security to your application.&lt;br /&gt;&lt;br /&gt;following is very simple approach, how to do that-&lt;br /&gt;&lt;br /&gt;1) You need to add following section in your Web.config&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;system.web&gt;&lt;br /&gt;    &amp;lt;urlMappings enabled="true"&gt;&lt;br /&gt; &amp;lt;add url="~/fakename.aspx" mappedUrl="~/actualpageurl.aspx" /&gt;&lt;br /&gt; &amp;lt;add url="~/Registration.aspx" mappedUrl="~/signup.aspx" /&gt;&lt;br /&gt;    &amp;lt;/urlMappings&gt;&lt;br /&gt;&amp;lt;/system.web&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2) Add ASp.Net folder "App_Browsers" in your application&lt;br /&gt;&lt;br /&gt;&lt;!--/* OpenX iFrame Tag v2.6.4 */--&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--/*&lt;br /&gt;  * This tag has been generated for use on a non-SSL page. If this tag&lt;br /&gt;  * is to be placed on an SSL page, change the&lt;br /&gt;  *   'http://ads.ibibo.com/ad/www/delivery/...'&lt;br /&gt;  * to&lt;br /&gt;  *   'https://ads.ibibo.com/ad/www/delivery/...'&lt;br /&gt;  *&lt;br /&gt;  * The backup image section of this tag has been generated for use on a&lt;br /&gt;  * non-SSL page. If this tag is to be placed on an SSL page, change the&lt;br /&gt;  *   'http://ads.ibibo.com/ad/www/delivery/...'&lt;br /&gt;  * to&lt;br /&gt;  *   'https://ads.ibibo.com/ad/www/delivery/...'&lt;br /&gt;  *&lt;br /&gt;  * If iFrames are not supported by the viewer's browser, then this&lt;br /&gt;  * tag only shows image banners. There is no width or height in these&lt;br /&gt;  * banners, so if you want these tags to allocate space for the ad&lt;br /&gt;  * before it shows, you will need to add this information to the &lt;img&gt;&lt;br /&gt;  * tag.&lt;br /&gt;  */--&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe id='a7b0d64e' name='a7b0d64e' src='http://ads.ibibo.com/ad/www/delivery/afr.php?n=a7b0d64e&amp;amp;zoneid=783&amp;amp;cb=INSERT_RANDOM_NUMBER_HERE' framespacing='0' frameborder='no' scrolling='no' width='468' height='60'&gt;&lt;a href='http://ads.ibibo.com/ad/www/delivery/ck.php?n=adde9b7c&amp;amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'&gt;&lt;img src='http://ads.ibibo.com/ad/www/delivery/avw.php?zoneid=783&amp;amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;amp;n=adde9b7c' border='0' alt='' /&gt;&lt;/a&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;script type='text/javascript' src='http://ads.ibibo.com/ad/www/delivery/ag.php'&gt;&lt;/script&gt;&lt;br /&gt;3) Add a new item in that folder as "Form.browser"&lt;br /&gt;&lt;br /&gt;Code- Form.browser&lt;br /&gt;&lt;br /&gt;&amp;lt;browsers&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;browser refID="Default"&gt;&lt;br /&gt;  &amp;lt;controlAdapters&gt;&lt;br /&gt;   &amp;lt;adapter controlType="System.Web.UI.HtmlControls.HtmlForm"&lt;br /&gt;    adapterType="FormRewriterControlAdapter" /&gt;&lt;br /&gt;  &amp;lt;/controlAdapters&gt;&lt;br /&gt; &amp;lt;/browser&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/browsers&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4) Create a class file as follows&lt;br /&gt;&lt;br /&gt;//Form.cs&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web;&lt;br /&gt;&lt;br /&gt;public class FormRewriterControlAdapter : System.Web.UI.Adapters.ControlAdapter&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    protected override void Render(System.Web.UI.HtmlTextWriter writer)&lt;br /&gt;    {&lt;br /&gt;        base.Render(new RewriteFormHtmlTextWriter(writer));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class RewriteFormHtmlTextWriter : HtmlTextWriter&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    public RewriteFormHtmlTextWriter(HtmlTextWriter writer)&lt;br /&gt;        : base(writer)&lt;br /&gt;    {&lt;br /&gt;        this.InnerWriter = writer.InnerWriter;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public RewriteFormHtmlTextWriter(System.IO.TextWriter writer)&lt;br /&gt;        : base(writer)&lt;br /&gt;    {&lt;br /&gt;        base.InnerWriter = writer;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public override void WriteAttribute(string name, string value, bool fEncode)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        // If the attribute we are writing is the "action" attribute, and we are not on a sub-control, &lt;br /&gt;        // then replace the value to write with the raw URL of the request - which ensures that we'll &lt;br /&gt;        // preserve the PathInfo value on postback scenarios &lt;br /&gt;&lt;br /&gt;        if ((name == "action"))&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            HttpContext Context = default(HttpContext);&lt;br /&gt;            Context = HttpContext.Current;&lt;br /&gt;&lt;br /&gt;            if (Context.Items["ActionAlreadyWritten"] == null)&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                // Because we are using the UrlRewriting.net HttpModule, we will use the &lt;br /&gt;                // Request.RawUrl property within ASP.NET to retrieve the origional URL &lt;br /&gt;                // before it was re-written. You'll want to change the line of code below &lt;br /&gt;                // if you use a different URL rewriting implementation. &lt;br /&gt;&lt;br /&gt;                value = Context.Request.RawUrl;&lt;br /&gt;&lt;br /&gt;                // Indicate that we've already rewritten the &amp;lt;form&gt;'s action attribute to prevent &lt;br /&gt;                // us from rewriting a sub-control under the &amp;lt;form&gt; control &lt;br /&gt;&lt;br /&gt;                Context.Items["ActionAlreadyWritten"] = true;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        base.WriteAttribute(name, value, fEncode);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5) Thats all and you are ready to rewrite your incoming URLs without any complex code for HTTP-module &lt;br /&gt;   and any actionless form.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IMPORTANT: If you go for Actionless form then it has a side effect that disables page validators.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=5254293"&gt;&lt;span style="font-family:arial;font-size:120%;color:#3333ff;"&gt;if this was helpful then please donate as much you want &lt;/span&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5332780573564909986" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 122px; CURSOR: hand; HEIGHT: 47px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_sINvh8Ncl78/SgHXrWhwuaI/AAAAAAAAACE/2ZXqTUfooM4/s320/btn_donateCC_LG.gif" border="0" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Cheers&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-2589174300224327937?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/04/url-rewriting-mapping-in-aspnet.html</link><author>noreply@blogger.com (Blog Admin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_sINvh8Ncl78/SgHXrWhwuaI/AAAAAAAAACE/2ZXqTUfooM4/s72-c/btn_donateCC_LG.gif" height="72" width="72" /><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-3581112443573522961</guid><pubDate>Mon, 06 Apr 2009 08:54:00 +0000</pubDate><atom:updated>2009-05-06T11:37:37.485-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">web application</category><category domain="http://www.blogger.com/atom/ns#">common master page</category><category domain="http://www.blogger.com/atom/ns#">IIS application</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><category domain="http://www.blogger.com/atom/ns#">asp.net 2.0</category><category domain="http://www.blogger.com/atom/ns#">website</category><category domain="http://www.blogger.com/atom/ns#">Share master page</category><category domain="http://www.blogger.com/atom/ns#">use common master page</category><title>Sharing Master Pages across web Applications in ASP.Net</title><description>The MasterPage class available in ASP.NET 2.0 derives from UserControl and just like user controls, master pages can't be shared across IIS applications. There are a few different solutions that have been proposed, such as setting up virtual directories in each IIS application that point to the same physical folder, but there is a way to share master pages across applications with a little work on your part without resorting to duplicating virtual directories across multiple websites. By leveraging the VS.NET 2005 Publish Web Site tool it's possible to create an assembly that contains all of the master page HTML code and C# or VB.NET code, give the assembly a strong name, and install it into the Global Assembly Cache (GAC).&lt;br /&gt;There are several steps involved, so a step-by-step approach follows, and also issues to watch out for when performing these steps.&lt;br /&gt;&lt;br /&gt;- Create an empty Website in VS.NET 2005. Delete everything in it including&lt;br /&gt;App_Data, Default.aspx, and web.config (if it exists).&lt;br /&gt;- Add a master page into the website&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ Master Language="C#" %&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;&lt;br /&gt;&amp;lt;head runat="server"&gt;&lt;br /&gt;&amp;lt;title&gt;Untitled Page &amp;lt;/title&gt;&lt;br /&gt;&amp;lt;/head&gt;&lt;br /&gt;&amp;lt;body&gt;&lt;br /&gt;&amp;lt;form id="form1" runat="server"&gt;&lt;br /&gt;&amp;lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Shared Master Header&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&amp;lt;br /&gt;&lt;br /&gt;&lt;?xml:namespace prefix = asp /&gt;&lt;asp:contentplaceholder id="ContentPlaceHolder1" runat="server"&gt;&lt;br /&gt;&lt;/asp:contentplaceholder&gt;&lt;br /&gt;&amp;lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;Shared Master Footer&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/div&gt;&lt;br /&gt;&amp;lt;/form&gt;&lt;br /&gt;&amp;lt;/body&gt;&lt;br /&gt;&amp;lt;/html&gt;&lt;br /&gt;&lt;br /&gt;- Publish this Website&lt;br /&gt;&lt;br /&gt;- On the screen that follows, select a target location, and check all of the&lt;br /&gt;checkboxes shown in Figure Note that the image shown in Figure references a strong&lt;br /&gt;name key file named keyfile.snk that was created using the sn.exe command-line&lt;br /&gt;tool that ships with .NET. This is required in order to install assemblies into&lt;br /&gt;the GAC. The following syntax can be used to create the key file (run it using the&lt;br /&gt;Visual Studio .NET 2005 command prompt): sn.exe -k keyfile.snk.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_sINvh8Ncl78/SdnDc7So4zI/AAAAAAAAAB0/KTy1HiizXYM/s1600-h/publish1.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5321499336434574130" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 210px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_sINvh8Ncl78/SdnDc7So4zI/AAAAAAAAAB0/KTy1HiizXYM/s320/publish1.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- After the publish operation completes, open the new website in VS.NET 2005 and&lt;br /&gt;add a reference to the newly created assemly in the website&lt;br /&gt;&lt;br /&gt;- Install the assembly into the GAC using gacutil.exe or drag-and-drop it into&lt;br /&gt;c:\Windows\Assembly using Windows Explorer.&lt;br /&gt;&lt;br /&gt;Once you've done this, delete the original assembly as well as the newly created&lt;br /&gt;XML files associated with it from the website.&lt;br /&gt;&lt;br /&gt;- Add a web.config file into the website and add the following within the&lt;br /&gt;&amp;lt;system.web&gt; begin and end tags.&lt;br /&gt;&amp;lt;compilation debug="true"&gt;&lt;br /&gt;&amp;lt;assemblies&gt;&lt;br /&gt;&amp;lt;add assembly="App_Web_masterpagebase.master.cdcab7d2, Version=0.0.0.0,&lt;br /&gt;Culture=neutral, PublicKeyToken=cceb8435cfc68486" /&gt;&lt;br /&gt;&amp;lt;/assemblies&gt;&lt;br /&gt;&amp;lt;/compilation&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;You'll need to change the name of the assembly to the name that is generated for your project (the one you added into the GAC) and change the PublicKeyToken to the one you see in the GAC.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;- Add a master page into the website, but don't create a code-behind page for it(you&lt;br /&gt;can, but it's not needed in this case since the master page is only used to&lt;br /&gt;reference the one installed in the GAC).&lt;br /&gt;&lt;br /&gt;- Remove all code within the new master page and add the following at the top. It&lt;br /&gt;should be the only code in the page.&lt;br /&gt;&amp;lt;%@ Master Language="C#" Inherits="ASP.masterpagebase_master" %&gt;&lt;br /&gt;&lt;strong&gt;If you named the original master page (the one created in step 2)&lt;br /&gt;differently,then you'll need to change the Inherits value. Use the VS.NET object&lt;br /&gt;browser to see the name of the class within the .dll generated in step 4.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;- Create a content page that references MasterPage.master. The default&lt;br /&gt;ContentPlaceHolderID is ContentPlaceHolder1, so use that in the &lt;asp:content&gt;tag&lt;br /&gt;unless you gave the id a different name in step 2.&lt;br /&gt;&lt;br /&gt;After completing these steps, any web application can share the same master page used by other web applications by placing the empty MasterPage.master file into the application and updating the web.config file to point to the master page assembly in the GAC.&lt;br /&gt;&lt;br /&gt;The downfall of this approach is that you have to recompile the base master page and put it back into the GAC each time you need to make a change and the design time support is lacking.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;If you don’t want to install the assembly into GAC then follow a very simple approach as follows-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Publish the base Masterpage website without SN key option, and refer the published assembly in your new web site.&lt;br /&gt;&lt;br /&gt;Now whenever you want to change the base master page republish the base master page website and just rebuild your new website which is referencing base master page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_sINvh8Ncl78/SdnDq8wvJbI/AAAAAAAAAB8/lGs_-Tr13DM/s1600-h/publish.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5321499577347417522" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 210px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_sINvh8Ncl78/SdnDq8wvJbI/AAAAAAAAAB8/lGs_-Tr13DM/s320/publish.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Important:&lt;/strong&gt; Take care of the names referred in INHERITS section of referring master page’s &lt;%@ Master Language="C#" nherits="ASP.masterpagebase_master" %&gt;, since that is an important thing which can cause errors in your website.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Thanks to Dan Wahlin (Ref.) and his &lt;/span&gt;&lt;a href="http://www.simple-talk.com/dotnet/asp.net/asp.net-master-pages-tips-and-tricks/"&gt;&lt;span style="font-size:78%;"&gt;blog&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/asp:content&gt;&lt;asp:content&gt;&lt;/asp:content&gt;&lt;br /&gt;&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=5254293"&gt;&lt;span style="font-family:arial;font-size:120%;color:#3333ff;"&gt;if this was helpful then please donate as much you want &lt;/span&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5332780573564909986" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 122px; CURSOR: hand; HEIGHT: 47px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_sINvh8Ncl78/SgHXrWhwuaI/AAAAAAAAACE/2ZXqTUfooM4/s320/btn_donateCC_LG.gif" border="0" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-3581112443573522961?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/04/sharing-master-pages-across-web.html</link><author>noreply@blogger.com (Blog Admin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_sINvh8Ncl78/SdnDc7So4zI/AAAAAAAAAB0/KTy1HiizXYM/s72-c/publish1.JPG" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5990140650016020298.post-5939680761981850633</guid><pubDate>Sat, 04 Apr 2009 06:14:00 +0000</pubDate><atom:updated>2009-04-03T23:18:04.227-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">image quality</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><category domain="http://www.blogger.com/atom/ns#">image resize quality problem</category><category domain="http://www.blogger.com/atom/ns#">Image resize asp.net</category><category domain="http://www.blogger.com/atom/ns#">customize image resize asp.net 3.5</category><category domain="http://www.blogger.com/atom/ns#">resize image in asp.net 3.5</category><title>Custom image resizing in ASP.net 3.5</title><description>Following is the code that resizes the image cleanly with high quality. This code doesn’t use GetThumbnailImage method and hence uses full size image. &lt;br /&gt;public void ResizeImage(double scaleFactor, Stream fromStream, Stream toStream)&lt;br /&gt;{&lt;br /&gt;    var image = Image.FromStream(fromStream);&lt;br /&gt;    var newWidth = (int)(image.Width * scaleFactor);&lt;br /&gt;    var newHeight = (int)(image.Height * scaleFactor);&lt;br /&gt;    var thumbnailBitmap = new Bitmap(newWidth, newHeight);&lt;br /&gt; &lt;br /&gt;    var thumbnailGraph = Graphics.FromImage(thumbnailBitmap);&lt;br /&gt;    thumbnailGraph.CompositingQuality = CompositingQuality.HighQuality;&lt;br /&gt;    thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;&lt;br /&gt;    thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;&lt;br /&gt; &lt;br /&gt;    var imageRectangle = new Rectangle(0, 0, newWidth, newHeight);&lt;br /&gt;    thumbnailGraph.DrawImage(image, imageRectangle);&lt;br /&gt; &lt;br /&gt;    thumbnailBitmap.Save(toStream, image.RawFormat);&lt;br /&gt; &lt;br /&gt;    thumbnailGraph.Dispose();&lt;br /&gt;    thumbnailBitmap.Dispose();&lt;br /&gt;    image.Dispose();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;RSS Feed&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5990140650016020298-5939680761981850633?l=dotnetkeeda.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotnetkeeda.blogspot.com/2009/04/custom-image-resizing-in-aspnet-35.html</link><author>noreply@blogger.com (Blog Admin)</author><thr:total>0</thr:total></item></channel></rss>

