<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SharpDeveloper &#187; .NET articles</title>
	<atom:link href="http://www.sharpdeveloper.net/content/archive/category/net-articles/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sharpdeveloper.net/content</link>
	<description>C# articles and tutorials on SharpDeveloper.NET</description>
	<lastBuildDate>Sun, 09 Oct 2011 17:09:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>No source avaiable (VS2010)</title>
		<link>http://www.sharpdeveloper.net/content/archive/2011/01/10/no-source-avaiable-vs2010.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2011/01/10/no-source-avaiable-vs2010.aspx#comments</comments>
		<pubDate>Mon, 10 Jan 2011 22:03:31 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>

		<guid isPermaLink="false">http://www.sharpdeveloper.net/content/?p=554</guid>
		<description><![CDATA[<p>Did you ever try pausing your code in VS2010? Did you get this very annoying screen that says &#8220;no source available&#8221; ?</p> <p>The solution is simple, install <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/fdbb2036-471e-40a7-b20e-31f8fd5578fa">this extension</a></p> Other Interesting Posts<a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with [...]]]></description>
			<content:encoded><![CDATA[<p>Did you ever try pausing your code in VS2010?  Did you get this very annoying screen that says &#8220;no source available&#8221; ?</p>
<p>The solution is simple, install <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/fdbb2036-471e-40a7-b20e-31f8fd5578fa">this extension</a></p>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2011/01/10/no-source-avaiable-vs2010.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jquery Rich Array Documentation</title>
		<link>http://www.sharpdeveloper.net/content/archive/2010/04/30/jquery-rich-array-documentation.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2010/04/30/jquery-rich-array-documentation.aspx#comments</comments>
		<pubDate>Fri, 30 Apr 2010 20:54:12 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>

		<guid isPermaLink="false">http://www.sharpdeveloper.net/content/?p=538</guid>
		<description><![CDATA[<p>If you want to use the JQuery Rich Array and you were hoping for some documentation, well its inside the .JS file but I am posting it here for reference purposes</p> /*************************************************************************** * Copyright (C) 2007 by Vladimir Kadalashvili * * Vladimir.Kadalashvili@gmail.com * * * * This program is free software; you can redistribute it [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to use the JQuery Rich Array and you were hoping for some documentation, well its inside the .JS file but I am posting it here for reference purposes</p>
<pre class="brush: js">
/***************************************************************************
 *   Copyright (C) 2007 by Vladimir Kadalashvili                                        *
 *   Vladimir.Kadalashvili@gmail.com                                                   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

/*
A simple jQuery plugin for varios manipulations with arrays
*/ 

jQuery.richArray = {

    /*
        Checks whether an array contains some value
	@param {Array} array - an array in which we search for a value
	@param {Mixed} value - the value we search for
	@return {boolean} true if the array contains the value, otherwise false
    */

    in: function(array, value) {
    },

    /*
        Produces the duplicate-free version of the array
	@param {Array} array
	@returns {array}  - an array without duplicates
    */
    unique: function(array) {

    },

    /*
        Finds the difference between two arrays.
	@param {Array} array1
	@param {Array} array2
	@return {Array} array of values which are present in the first array, but not in the second
    */

    diff: function(array1, array2) {

    },

    /*
        Finds the intersection of two arrays
	@param {Array} array1
	@param {Array} array2
	@return {Array} - the array of values wich are present in both arrays
    */

    intersect: function(array1, array2) {

    },

    /*
        Applies filter to the array, using callback function
	@param {Array} array - an array which we apply filter to
	@param {Function} fn - the filter function. If it returns the value that may be evaluated as TRUE, the value will be included to the returned array.
	@param {Object} scope - the scope of the callback function. Default is jQuery.richArray
	@returns {Array} - an array of values for which callback function returned true
    */

    filter: function(array, fn, scope) {

    },

    /*
        Applies callback function for each element in the input array, and returns array of values that this function returned
	@param {Array} array - an array which we should apply callback to
	@param {Function} fn - callback function
	@param scope - the scope of the callback function. Default is jQuery.richArray
    */
    map: function(array, fn, scope) {
    },

    /*
        Computes the sum of all array elements.
	@param {Array} array - an array we should compute the sum for
	@param {Mixed} init - the initial value of the sum. Default is 0.
	@returns {Mixed} the sum of all elements of the input array
    */

    sum: function(array, init) {
    },

    /*
        Calculates the production of all elements of the array
	@param array - an array we should compute production for
	@param init - the initial value. Default is 1.
	@returns {Mixed} - the production of all elements of the input array
    */

    product: function(array, init) {
    },

    /*
        Reduces the array. One-elemen arrays are turned into their unique element, others are retured untouched
	Examples:
	jQuery.richArray.reduce([3]) -&amp;gt; 3
	jQuery.richArray.reduce([3, 5]) -&amp;gt; [3, 5]
    */

    reduce: function(array) {
    },

    /*
        Creates new version of array without null/undefined values
	@param {Array} array - input array
	@returns {Array} - an array without null/undefined values
    */

    compact: function(array) {
    },

    /*
       Creates a new version of the array that doesn&#039;t contain the specified value
       @patam {Array} array - input array
       @param {Mixed} value - the value that shouldn&#039;t be included to the returned array
       @returns {Array} - a new version of the input array without specified value
    */

    without: function(array, value) {
    },

    /*
        If the passed argument is an array, returns it untouched, otherwise returns an empty array.
	For internal use.
    */

    getArray: function(array) {
    },

    /*
        if the passed argument is a function, returns it untouched, otherwise returns an empty function
   */

    getFunction: function(fn) {
        if (!(fn instanceof Function)) fn = new Function();
	return fn;
    }    

};
</pre>
<p>Homepage: <a href="http://vladimir-k.blogspot.com/2008/12/rich-array-jquery-plugin.html">Jquery Rich Array Plugin</a></p>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2010/04/30/jquery-rich-array-documentation.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serialize and Deserialize to JSON from ASP.NET</title>
		<link>http://www.sharpdeveloper.net/content/archive/2010/04/23/serialize-and-deserialize-to-json-from-asp-net.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2010/04/23/serialize-and-deserialize-to-json-from-asp-net.aspx#comments</comments>
		<pubDate>Fri, 23 Apr 2010 19:32:14 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>

		<guid isPermaLink="false">http://www.sharpdeveloper.net/content/?p=534</guid>
		<description><![CDATA[<p>Its very easy to serialize an object to .NET<br /> Simply create some object, normally a custom class with some attributes.<br /> Normally you have a list of these and you want to serialize to JSON to use it from client side code.</p> <p>If you do the following</p> var s = new System.Web.Script.Serialization.JavaScriptSerializer(); string resultJs [...]]]></description>
			<content:encoded><![CDATA[<p>Its very easy to serialize an object to .NET<br />
Simply create some object, normally a custom class with some attributes.<br />
Normally you have a list of these and you want to serialize to JSON to use it from client side code.</p>
<p>If you do the following</p>
<pre class="brush: c#">
var s = new System.Web.Script.Serialization.JavaScriptSerializer();
string resultJs = s.Serialize(result);
</pre>
<p>you will end up with a JSON array that you were looking for:</p>
<pre class="brush: javascript">
[
  { &quot;Desc&quot; : &quot;Corn 100 &quot;,
    &quot;ItemNo&quot; : &quot;123456&quot;,
    &quot;OriginalQty&quot; : 50,
    &quot;Qty&quot; : 50,
    &quot;UnitPrice&quot; : 10.21
  } ,
  { &quot;Desc&quot; : &quot;Ice 100 &quot;,
    &quot;ItemNo&quot; : &quot;323456&quot;,
    &quot;OriginalQty&quot; : 50,
    &quot;Qty&quot; : 50,
    &quot;UnitPrice&quot; : 10.50
  } ,
  { &quot;Desc&quot; : &quot;Meat 100 &quot;,
    &quot;ItemNo&quot; : &quot;423456&quot;,
    &quot;OriginalQty&quot; : 50,
    &quot;Qty&quot; : 50,
    &quot;UnitPrice&quot; : 10.11
  } 

]
</pre>
<p>However if you try to deserialize this back into an object by running </p>
<pre class="brush: c#">
var json = new System.Web.Script.Serialization.JavaScriptSerializer();
var result = json.Deserialize&lt;ShoppingCartItem[]&gt;(jsonItemArray);
    </pre>
<p>You will get a NULL type Exception.</p>
<p>The solution is to create a simple resolver as follows</p>
<pre class="brush: c#">
    using System;
    using System.Web;
    using System.Web.Compilation;
    using System.Web.Script.Serialization;

    namespace XYZ.Util
    {
        /// &lt;summary&gt;
        /// as __type is missing ,we need to add this
        /// &lt;/summary&gt;
        public class ManualResolver : SimpleTypeResolver
        {
            public ManualResolver() { }
            public override Type ResolveType(string id)
            {
                return System.Web.Compilation.BuildManager.GetType(id, false);
            }
        }
    }
    </pre>
<p>2) Use it to serialize</p>
<pre class="brush: c#">
    var s = new System.Web.Script.Serialization.JavaScriptSerializer(new XYZ.Util.ManualResolver());
    string resultJs = s.Serialize(result);
    lblJs.Text = string.Format(&quot;&lt;script&gt;var resultObj = {0};&lt;/script&gt;&quot;, resultJs);
    </pre>
<p>You will get something like the following this time (note new __type included this time)</p>
<pre class="brush: javascript">
[
  {
    &quot;__type&quot;:&quot;XYZ.Data.Entities.ShoppingCartItem, XYZ.Data, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null&quot;,
    &quot;Desc&quot; : &quot;Corn 100 &quot;,
    &quot;ItemNo&quot; : &quot;123456&quot;,
    &quot;OriginalQty&quot; : 50,
    &quot;Qty&quot; : 50,
    &quot;UnitPrice&quot; : 10.21
  } ,
  {
    &quot;__type&quot;:&quot;XYZ.Data.Entities.ShoppingCartItem, XYZ.Data, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null&quot;,
    &quot;Desc&quot; : &quot;Ice 100 &quot;,
    &quot;ItemNo&quot; : &quot;323456&quot;,
    &quot;OriginalQty&quot; : 50,
    &quot;Qty&quot; : 50,
    &quot;UnitPrice&quot; : 10.50
  } ,
  {
    &quot;__type&quot;:&quot;XYZ.Data.Entities.ShoppingCartItem, XYZ.Data, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null&quot;,
    &quot;Desc&quot; : &quot;Meat 100 &quot;,
    &quot;ItemNo&quot; : &quot;423456&quot;,
    &quot;OriginalQty&quot; : 50,
    &quot;Qty&quot; : 50,
    &quot;UnitPrice&quot; : 10.11
  } 

]
</pre>
<p>3) Use it to deserialize</p>
<pre class="brush: c#">
    System.Web.Script.Serialization.JavaScriptSerializer(new XYZ.Util.ManualResolver());
    var result = json.Deserialize&lt;ShoppingCartItem[]&gt;(jsonItemArray);
    </pre>
<p>References: Comment by Manuel Abadia on <a href="http://www.manuelabadia.com/blog/CommentView,guid,50bc4c5a-3e40-4f81-8137-f7843d4a486d.aspx">ASP.NET AJAX Extensions Internals &#8211; Web Service Proxy Generation</a></p>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2010/04/23/serialize-and-deserialize-to-json-from-asp-net.aspx/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flesk Viewstate Optimizer Documentation</title>
		<link>http://www.sharpdeveloper.net/content/archive/2010/03/01/flesk-viewstate-optimizer-documentation.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2010/03/01/flesk-viewstate-optimizer-documentation.aspx#comments</comments>
		<pubDate>Mon, 01 Mar 2010 18:20:46 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>

		<guid isPermaLink="false">http://www.sharpdeveloper.net/content/?p=513</guid>
		<description><![CDATA[<p>I came across this excellent looking tool <a href="http://www.flesk.net/components/vsoptimizer.aspx">Flesk ViewState Optimizer</a> but was not able to find any details or documentation on it.  Apparently the tool used to be commercial but now its free!  I was able to dig up some history on it</p> <p>Flesk.ViewStateOptimizer is a unique technology that overrides sending ViewState object to [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this excellent looking tool <a href="http://www.flesk.net/components/vsoptimizer.aspx">Flesk ViewState Optimizer</a> but was not able to find any details or documentation on it.  Apparently the tool used to be commercial but now its free!  I was able to dig up some history on it</p>
<p><strong>Flesk.ViewStateOptimizer</strong> is a unique technology that overrides sending ViewState object to your client&#8217;s browser! This means that your client&#8217;s browser will no longer receive those large hidden field values, which thus reducing downloading time. Instead, Flesk.ViewStateOptimizer saves the page&#8217;s Viewstate hidden field to a file, on the server side, speeding  up processing time, downloading time and data.
											</p>
<p>Combining <strong>Flesk.ViewStateOptimizer</strong> and <strong>Flesk.Accelerator</strong>,<br />
												you can benefit from reducing downloading data and downloading time up to 30 times faster! No other components<br />
												do the same or give the same results!</p>
<p><strong>Flesk.Accelerator</strong> and <strong>Flesk.ViewStateOptimizer</strong> are now released with versions<br />
												targeted for the .NET Framework v2.0</p>
<p>&nbsp;</p>
<p><strong><font size="2">How it works?<a name="Works"></a></font></strong></p>
<p><strong>Flesk.ViewStateOptimizer</strong> has several viewstate optimization possibilities that can be set through the web.config file.<br /> From viewstate data compression to saving viewstate on server farms, anything can be possible. This means that Flesk.ViewStateOptimizer can persist values using server side Sessions or files saved on shared locaton accessible by a server farm, or by using common viewstate hidden field value on client side, with the ability to compress data.</p>
<p>There are 2 ways to setup Flesk.ViewStateOptimizer on your web application or .Net project:</p>
<ol>
<li>In all your codebehind, instead of inheriting your class with<br />
													System.Web.UI.Page, change the inheritance to Flesk.Accelerator.Page.<br />
													If you use script block codebehind, use the following lines: </p>
<pre class="brush: xml">
&amp;lt;%@ Page  Language=&amp;quot;C#&amp;quot; Inherits=&amp;quot;Flesk.Accelerator.Page&amp;quot; %&amp;gt;
</pre>
</li>
<li>
<p>Flesk.ViewStateOptimizer is designed to meet the requirements of customers that are unable to change<br />
														the base class of their pages.<br />
														As such, Flesk.ViewStateOptimizer provides static methods that allows calling the viewstate procedures<br />
														from within any page class.</p>
<p>														If you have access to the source of your base class, just add the following lines to the code:</p>
<pre class="brush: c#">
protected override void  SavePageStateToPersistenceMedium(object viewStateBag)
{
   Flesk.Accelerator.Page.SavePageStateToPersistenceMedium(this, viewStateBag);
}

protected override object LoadPageStateFromPersistenceMedium()
{
    return Flesk.Accelerator.Page.LoadPageStateFromPersistenceMedium(this);
}
</pre>
<p> If you are using precompiled code you&#8217;ll have to edit your aspx files. If at all possible, add the following<br />
														</p>
<p>														snippet to your aspx file:</p>
<pre class="brush: c#">
protected override PageStatePersister PageStatePersister
{
  get
  {
    return Flesk.Accelerator.Page.GetPageStatePersister(this);
  }
}
</pre>
</p></div>
</li>
</ol>
<div id="Features">
<p>&nbsp;</p>
<p>Flesk.ViewStateOptimizer can use different storage methods:</p>
</p></div>
<ul>
<li>
<div style=""> save to file (saves ViewState into a file, server side)</div>
</li>
<li>
<div style="">
<div style=""> Session (saves ViewState into a Session variable, server side) </div>
</p></div>
</li>
<li> Default (default ViewState saving method, sends hidden fields to client side)</li>
</ul>
<p>Other parameters are:</p>
<ul>
<li> depending on the storage method setting, Flesk.ViewStateOptimizer can be set to compress viewstate value,<br />
													so that it can be significantly smaller than the original value</li>
<li>the request behaviour of viewstate can be set to be generated on the first request to a page and then<br />
													reused in the following postbacks, or to be generated on each request to a page. <br />
													A common scenario where viewstate set to be generated on each request can be usefull is in Content Management<br />
													frameworks:<br />
													page loads up some controls on postback based on some state stored in hidden input values, handles events<br />
													and as a result of those actions purges the control collection and loads new controls.<br />
													Standard Flesk.ViewStateOptimizer configuration persists the Viewstate using the same GUID as the original<br />
													page. <br />
													If the user then hit&#8217;s refresh (F5) in the browser, the data is posted again, the framework loads up it&#8217;s<br />
													controls based on the original state but the viewstate value now matches the new controls. This also happens<br />
													with any change to the viewstate between postbacks, when users back up or use refresh in their browsers.<br />
													<br />
													The solution was to make Flesk.ViewStateOptimizer generate GUID&#8217;s each and every time the viewstate is persisted.<br />
													Only then is the viewstate truly unique for each page. </li>
</ul>
<div style="">
<p>&nbsp;</p>
<p><font size="2"><strong>Features<a name="Features"></a></strong></font></p>
<p> <strong>V1.0</strong></p>
<ul>
<li>Reduces downloading time of your website or web application, by not sending back the page&#8217;s Viewstate<br />
														hidden field.</li>
<li> This component is setup individually. It is not shared by all the webserver&#8217;s websites, but only by<br />
														your website or webapplication. This means that you can install it in your hosting account without changing<br />
														any webserver&#8217;s configuration. </li>
<li> Runs on .NET Framework v1.1 and v2.0. No configuration required. Only a few lines on your web.config<br />
														file is all you need to change. </li>
<li>Greatly reduces bandwidth traffic from your webserver, reduces Posted data from your client&#8217;s browser,<br />
														and speeds up your web application! <br />
														Supported by WebFarms 
													</li>
</ul>
<p> <strong>V1.2</strong></p>
<ul>
<li>Compresses the ViewState value. This means that ViewState is sent and returned to/from client&#8217;s browser<br />
														or saved into local file, on server, compressed, thus reducing ViewState&#8217;s value length and increasing<br />
														speed even more!</li>
<li> This release of the Viewstate Optimizer is designed to meet the requirements of<br />
														customers that are unable to change the base class of their pages. </li>
<li>The Flesk.Accelerator.Page class now provides two static methods that allow calling the viewstate
<p>														procedures from within any page class.</li>
<li>ViewState files can now be persisted on shared location accessible by all servers in a server farm.
</li>
</ul>
<p>From <a href="http://web.archive.org/web/20080501220023/http://www.flesk.net/fleskviewstate.aspx">Archive.Org</a></p>
<p>Not sure what happened to the company but glad they decided to give their product for free now! (GPL license)</p>
<p>Edit Aug 12, 2010</p>
<h1>Web.Config Requirements</h1>
<p>To use this, here is what you put in Web.Config between &lt;configuration&gt; and &lt;/configuration&gt;</p>
<pre class="brush: xml">
  &amp;lt;Flesk.NET&amp;gt;
    &amp;lt;!--
		The StorageMethod parameter sets the ViewState&#039;s storage type.
		Possible values are :

			- File (saves ViewState into a file, server side)
				- StoragePath must specify a write enabled server path ( ~ means site root path)
					If StoragePath is a web path (i.e.: \\MachineName\Dir), when used in webfarms,
					please add the following line under &amp;lt;system.web&amp;gt;
					&amp;lt;identity impersonate=&amp;quot;true&amp;quot; userName=&amp;quot;domain\username&amp;quot; password=&amp;quot;userpass&amp;quot;/&amp;gt;

			- Default (default ViewState saving method, sending hidden fields to client side)

			- Session (saves ViewState into a Session variable, server side)

			- SqlServer (saves the ViewState into a database table)
				- ConnectionString specifies the database connection.
				- TableName specifies the table in the database where the records will be stored.

		New Option :
			Compressed=&amp;quot;true&amp;quot; or Compressed=&amp;quot;false&amp;quot;
			this will compress the ViewState if StorageMethod is Default or File.
			so the ViewState&#039;s value will be significantly smaller than the original value.
			Compression method is not suported by StorageMethod=&amp;quot;Session&amp;quot;

		--&amp;gt;
    &amp;lt;ViewStateOptimizer
			PersistenceHandler=&amp;quot;Flesk.Accelerator.SessionViewstatePersister, Flesk.Accelerator&amp;quot;
			StorageMethod=&amp;quot;SqlServer&amp;quot;
			StoragePath=&amp;quot;~/Files/Logs&amp;quot;
			ConnectionString=&amp;quot;Server=...;Database=...;Uid=...;Pwd=...
			TableName=&amp;quot;app_ViewState&amp;quot;
			Compressed=&amp;quot;false&amp;quot;
			RequestBehavior=&amp;quot;EachLoad&amp;quot;
			ViewStateCleanupInterval=&amp;quot;01:00:00&amp;quot;
			/&amp;gt;
  &amp;lt;/Flesk.NET&amp;gt;
</pre>
<p>Between &lt;configSections&gt; and &lt;/configSections&gt; put the following:</p>
<pre class="brush: xml">
    &amp;lt;sectionGroup name=&amp;quot;Flesk.NET&amp;quot;&amp;gt;
      &amp;lt;section name=&amp;quot;ViewStateOptimizer&amp;quot; type=&amp;quot;Flesk.Accelerator.Viewstate.ConfigHandler, Flesk.ViewState&amp;quot; /&amp;gt;
    &amp;lt;/sectionGroup&amp;gt;
</pre>
<p>Between &lt;httpModules&gt; and &lt;/httpModules&gt; you can put</p>
<pre class="brush: xml">
			&amp;lt;!--
			This HttpModule provides automatic cleanup of viewstate files
			on the start of each session, thus requiring
			the SessionStateModule to be installed as well.
		  --&amp;gt;
			&amp;lt;add name=&amp;quot;ViewstateCleanupModule&amp;quot; type=&amp;quot;Flesk.Accelerator.Viewstate.CleanupModule, Flesk.ViewState&amp;quot;/&amp;gt;
		&amp;lt;/httpModules&amp;gt;
</pre>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2010/03/01/flesk-viewstate-optimizer-documentation.aspx/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>LINQ to Entities Create Function Import Scalar Value Missing</title>
		<link>http://www.sharpdeveloper.net/content/archive/2009/04/09/linq-to-entities-create-function-import-scalar-value-missing.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2009/04/09/linq-to-entities-create-function-import-scalar-value-missing.aspx#comments</comments>
		<pubDate>Thu, 09 Apr 2009 14:27:55 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>

		<guid isPermaLink="false">http://www.sharpdeveloper.net/content/?p=467</guid>
		<description><![CDATA[<p>LINQ to Entities seems really great. It can save you a lot of time in writing unnecessary db connection code, improve the performance many fold, only connect to the db when required (lazy loading), and easy concurrency handling for you.</p> <p>However there is a missing feature which I found out the hard way. If you [...]]]></description>
			<content:encoded><![CDATA[<p>LINQ to Entities seems really great.  It can save you a lot of time in writing unnecessary db connection code, improve the performance many fold, only connect to the db when required (lazy loading), and easy concurrency handling for you.</p>
<p>However there is a missing feature which I found out the hard way.  If you try to do a &#8216;Create Function Import&#8217; and it returns a scalar, the code will not be automatically generated, due to &#8216;lack of time&#8217; from the MS Team:</p>
<p><a href="http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/44a0a7c2-7c1b-43bc-98e0-4d072b94b2ab/">MSDN Forums</a> &#8211; See the post by Noam.</p>
<p>So basically, you are handicapped!  Either write the code yourself or just do it the old fashioned way</p>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2009/04/09/linq-to-entities-create-function-import-scalar-value-missing.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read Pro ASP.NET 2.0 in C# free</title>
		<link>http://www.sharpdeveloper.net/content/archive/2008/11/11/read-pro-aspnet-20-in-c-free.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2008/11/11/read-pro-aspnet-20-in-c-free.aspx#comments</comments>
		<pubDate>Tue, 11 Nov 2008 23:18:18 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>

		<guid isPermaLink="false">http://www.sharpdeveloper.net/content/?p=433</guid>
		<description><![CDATA[<p>Due to a recent agreement between Google and some book publishers, they are going to publish a large number of books online (limited content depending on each publishers agreement).</p> <p>So you can now read <a href="http://books.google.ca/books?id=-K8SBW_WRpUC&#38;pg=PA418&#38;lpg=PA3&#38;dq=asp.net+sql+cache+dependency+overhead&#38;source=web&#38;ots=htf8e6eWim&#38;sig=rvDtJREociAhqufwZHkuLJouxf4&#38;oi=book_result&#38;ct=result&#38;hl=en#PPP5,M1">Pro ASP.NET 2.0 C#</a> for free online (a large chunk of it)!  Click the link for more.  This book is [...]]]></description>
			<content:encoded><![CDATA[<p>Due to a recent agreement between Google and some book publishers, they are going to publish a large number of books online (limited content depending on each publishers agreement).</p>
<p>So you can now read <strong><a href="http://books.google.ca/books?id=-K8SBW_WRpUC&amp;pg=PA418&amp;lpg=PA3&amp;dq=asp.net+sql+cache+dependency+overhead&amp;source=web&amp;ots=htf8e6eWim&amp;sig=rvDtJREociAhqufwZHkuLJouxf4&amp;oi=book_result&amp;ct=result&amp;hl=en#PPP5,M1">Pro ASP.NET 2.0 C#</a> </strong>for free online (a large chunk of it)!  Click the link for more.  This book is jam packed (1000 pages+) with well-written details on everything under the sun in .NET 2.0.  I was in particular looking for SQL Cache Dependency information which I found in there.</p>
<p>Apparently in SQL Server 2000, Cache Dependency is done on a table basis, you cannot have it dependent on a certain condition (for example <strong>select * from CONTACTS where location=&#8217;canada&#8217;</strong>).  If any data at all changes inside CONTACTS then the cache is considered invalidated and you will need fresh data.   Lots of improvements in SQL Server 2005 boys&#8230;.</p>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2008/11/11/read-pro-aspnet-20-in-c-free.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated .NET testing with WatiN</title>
		<link>http://www.sharpdeveloper.net/content/archive/2008/10/20/automated-net-testing-with-watin.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2008/10/20/automated-net-testing-with-watin.aspx#comments</comments>
		<pubDate>Mon, 20 Oct 2008 21:18:28 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.sharpdeveloper.net/content/?p=417</guid>
		<description><![CDATA[<p>This software is super cool.  <a href="http://watin.sourceforge.net/">WatiN &#8211; Automated Web Application Testing!<br /> </a></p> <p>Here&#8217;s how you can use it.  Download it.  Download the <a href="http://watintestrecord.sourceforge.net/">test recorder</a> (it&#8217;s not perfect, but its pretty good).  Create a trivial test case so you know it&#8217;s working.  Then build on that test case.    It will output code for [...]]]></description>
			<content:encoded><![CDATA[<p>This software is super cool.  <a href="http://watin.sourceforge.net/"><strong>WatiN &#8211; Automated Web Application Testing!</strong><br />
</a></p>
<p>Here&#8217;s how you can use it.  Download it.  Download the <a href="http://watintestrecord.sourceforge.net/">test recorder</a> (it&#8217;s not perfect, but its pretty good).  Create a trivial test case so you know it&#8217;s working.  Then build on that test case.    It will output code for NUnit, MBUnit, or even VS2005Test</p>
<p>Load up your VS IDE, then execute it from Visual Studio 2005 or 2008 Test Runner.    It will give you the results right there!  Super cool or what??</p>
<p>With this framework I was able to create some pretty simple test SUPER fast.  &#8211; Login test, check for correct page loaded.   Then I tested some shopping cart logic (adding items, removing items, clearing cart.)</p>
<p>In conclusion you can effectively create tests with WatiN.  Give it a try.  It&#8217;s compatible with practically every testing framework (including Fitnesse) that you probably use.</p>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2008/10/20/automated-net-testing-with-watin.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Your Web.Config From Each Build with CruiseControl</title>
		<link>http://www.sharpdeveloper.net/content/archive/2008/06/17/updating-your-webconfig-from-each-build-with-cruisecontrol.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2008/06/17/updating-your-webconfig-from-each-build-with-cruisecontrol.aspx#comments</comments>
		<pubDate>Tue, 17 Jun 2008 19:10:03 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://migrate.sharpdeveloper.net/content/?p=234</guid>
		<description><![CDATA[If you are running a Web Site Project, yet you still want to have a build number somewhere in your application, this article will explain how you can create a simple tool to have an auto-increment build number and execute it using CruiseControl.NET]]></description>
			<content:encoded><![CDATA[<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">Let&#8217;s say you have CruiseControl.NET all set up nice and hunky dory.&nbsp; Now you love the fact that it labels your each build, and you want to somehow show that from your project.&nbsp; Here is how you can get your CruiseControl.NET project build number into your Web.Config.&nbsp; This concept can be applied to update any file.</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">It&rsquo;s super easy.&nbsp;You will need to add an exec block to your ccnet.config</span></div>
<pre class="brush: c#">
&lt;exec&gt;
&lt;!-- Auto increment web.config build number --&gt;
&lt;executable&gt;E:\Userdata\CruiseControl\Tools\MergeWebConfigValues.exe (my custom tool)&lt;/executable&gt;
&lt;buildArgs&gt;&quot;E:\Program Files (x86)\CruiseControl.NET\server\Main.state&quot; e:\userdata\cruisecontrol\Dev_Main\Web.config&lt;/buildArgs&gt;
&lt;baseDirectory&gt;e:\userdata\cruisecontrol\Dev_Main&lt;/baseDirectory&gt;
&lt;buildTimeoutSeconds&gt;15&lt;/buildTimeoutSeconds&gt;
&lt;/exec&gt;
</pre>
<div style="margin: 0in 0in 0pt;">&nbsp;Now all you need to do is write the <strong>MergeWebConfigValues.exe</strong></div>
<div style="margin: 0in 0in 0pt;">What does it do?<br />
1. It reads the CCNET state file (provided by argument 1) and grabs the last label from there. (The state file is an XML file)<br />
2. It then goes and writes to your Web.Config and updates the build number in there. (or writes to any specified file you like)</div>
<div style="margin: 0in 0in 0pt;">Lastly, update your code to read this value by adding some version or about page to read your Web.Config</div>
<div style="margin: 0in 0in 0pt;">
You now instantly know what version your code is.</div>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2008/06/17/updating-your-webconfig-from-each-build-with-cruisecontrol.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Testing on Your Database</title>
		<link>http://www.sharpdeveloper.net/content/archive/2008/05/22/unit-testing-on-your-database.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2008/05/22/unit-testing-on-your-database.aspx#comments</comments>
		<pubDate>Thu, 22 May 2008 18:09:00 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://migrate.sharpdeveloper.net/content/?p=229</guid>
		<description><![CDATA[<p>When unit testing on your database, you will run into a common problem.</p> <p>Rolling back.</p> <p>So you want to do some unit tests, and then you want to reset your database back to the nice squeaky clean version that doesn&#8217;t have half failed unit tests.</p> <p>So how can you do this?</p> <p>There are many ways [...]]]></description>
			<content:encoded><![CDATA[<p>When unit testing on your database, you will run into a common problem.</p>
<p>Rolling back.</p>
<p>So you want to do some unit tests, and then you want to reset your database back to the nice squeaky clean version that doesn&#8217;t have half failed unit tests.</p>
<p>So how can you do this?</p>
<p>There are many ways to achieve this.</p>
<p>The best way I found (requires Win XP SP2 or Windows Server 2003) is to use Roy&#8217;s Unit Testing Rollback Attribute.&nbsp; Simply inherit his class, add a &quot;DataRollback&quot; attribute, and you are good to go.&nbsp; Using some complicated Interception logic and Enterprise Services (COM+) it rolls back all the database work that was done.&nbsp; It&#8217;s super easy to implement.&nbsp; Here is some sample code that shows you just how easy it is.&nbsp; You just have to download <a href="http://weblogs.asp.net/rosherove/archive/2004/07/20/187863.aspx">XtUnit</a> (an extension to NUnit) to do this. (Full source code available)</p>
<pre class="brush: c#">
using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using TeamAgile.ApplicationBlocks.Interception.UnitTestExtensions;
using NUnit.Framework;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;

namespace DBTest
{
    ///&lt;summary&gt;
    /// Test roll back functionality.
    ///&lt;/summary&gt;
    [TestFixture]
    public class RollbackTest : ExtensibleFixture
    {
        [Test, DataRollBack]
        [Category(&quot;Database&quot;)]
        public void TestInsert()
        {
            //this method will be performed inside a COM+ transaction
            //this requires windows XP SP2 or better
            //Windows Server 2003 works as well.

            string strCnn = &quot;your_conn_string&quot;;
            Guid random = Guid.NewGuid();
            string sqlI = string.Format(@&quot;insert into log4net (message,date,thread,level,logger) values (&#039;{0}&#039;,getdate(),&#039;{1}&#039;,&#039;Debug&#039;,&#039;Test&#039;)&quot;, random.ToString(), System.Threading.Thread.CurrentThread.GetHashCode());
            SqlHelper.ExecuteNonQuery(strCnn, CommandType.Text, sqlI);

            string sqlS = string.Format(@&quot;select count(*) from log4net where message=&#039;{0}&#039;&quot;, random.ToString());
            int rowcount = (int)SqlHelper.ExecuteScalar(strCnn, CommandType.Text, sqlS);
            Assert.That(rowcount &gt; 0, &quot;Cannot find {0}&quot;, random.ToString());
        }
    }
}
</pre>
<div><font size="2"><span style="font-size: 10pt;"></span></font></div>
<div><font size="2"><span style="font-size: 10pt;">This test passes successfully.&nbsp; What does that mean? The insert and select worked perfectly fine.&nbsp; After that, I did a query and found the database to be clean.&nbsp; So the rollback worked too.</span></font> </div>
<div><font size="2"><span style="font-size: 10pt;"></span></font></div>
<div><font size="2"><span style="font-size: 10pt;"></span></font></div>
<div><font size="2"><span style="font-size: 10pt;"></span></font></div>
<div><font size="2"><span style="font-size: 10pt;">There are also other ways to skin this cat (i.e. to achieve this goal).&nbsp; One is to use Spring Framework and extend their Unit Testing class (<em>AbstractTransactionalSpringContextTests</em>), and they will handle rolling back everything.&nbsp; Here is <a href="http://www.cnblogs.com/taotao/archive/2007/08/20/862840.html">an article on this topic</a>, but unfortunately I was not able to make it work for me due to some odd reason.&nbsp; Here&#8217;s hoping you have better luck.&nbsp; If you don&#8217;t have any transactions, and your code is wired to use Spring, it&#8217;s still also very easy, you just need to call <a href="http://www.sharpdeveloper.net/content/archive/2008/04/30/manage-your-transaction-chaos-with-spring-framework.aspx">TransactionManager.Rollback</a>.</span></font></div>
<div><font size="2"><span style="font-size: 10pt;"></span></font><font size="2"><span style="font-size: 10pt;">You can also try to achieve this using Nested Transactions if you have existing transactions implemented via Spring.&nbsp; But then you have to set up checkpoints and stuff like that.&nbsp; </span></font></div>
<div><font size="2"><span style="font-size: 10pt;"></span></font></div>
<div><font size="2"><span style="font-size: 10pt;">I have some other ideas on how to achieve this that I will post later, God willing.</span></font></div>
<div><font size="2"><span style="font-size: 10pt;"></span></font></div>
<div><font size="2"><span style="font-size: 10pt;"></span></font></div>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2008/05/22/unit-testing-on-your-database.aspx/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP VS. ASP.NET</title>
		<link>http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx</link>
		<comments>http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx#comments</comments>
		<pubDate>Thu, 08 May 2008 17:42:09 +0000</pubDate>
		<dc:creator>Sameer</dc:creator>
				<category><![CDATA[.NET articles]]></category>
		<category><![CDATA[Work Related]]></category>

		<guid isPermaLink="false">http://migrate.sharpdeveloper.net/content/?p=227</guid>
		<description><![CDATA[This is a very shallow comparison of my experiences with PHP and ASP.NET Don&#8217;t take this as a religious war or something, the idea is just some basic comparison. &#160; Here is a summary: If you are choosing which technology to use to build an application, use .NET.&#160;You will get more bang for the buck.&#160;With [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">This is a very shallow comparison of my experiences with PHP and ASP.NET</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">Don&rsquo;t take this as a religious war or something, the idea is just some basic comparison.</span></div>
<div style="margin: 0in 0in 0pt;">&nbsp;</div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">Here is a summary: If you are choosing which technology to use to build an application, use .NET.&nbsp;You will get more bang for the buck.&nbsp;With the same effort you will be able to build a much more rich user interface.&nbsp;</span></div>
<div style="margin: 0in 0in 0pt;">&nbsp;</div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">My Disclaimer: Keep in mind there are a lot of great libraries and tools for PHP which I never got to use, I just had a simple PSPad text editor and my handy PHP web site. &nbsp;I really wanted some &ldquo;Intellisense&rdquo; style code completion but I could not get it to work with PHP since I couldn&rsquo;t find a decent IDE (i.e. editor)</span></div>
<div style="margin: 0in 0in 0pt;">&nbsp;</div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">However, it all depends on your requirements.&nbsp;For example, if you are selling something that most of your customers will be on a shared linux hosting environment, then why would you use .NET ?&nbsp;A good example is the software Clipshare, which is a clone of Youtube.&nbsp;The sites purchasing this product are mainly shared hosting customers who have PHP but not .NET.&nbsp;And Mono (.NET port on Linux) is not yet stable or popular enough to use.</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">&nbsp;</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">I did some PHP programming before I started doing .NET fulltime.&nbsp;Before then I couldn&rsquo;t say much about it, but after working with .NET for a few years now, I have much to say.</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">.NET does a very good job in handling the whole life cycle.&nbsp;With PHP you have to do it manually. &nbsp;&nbsp;For example, there is no such concept of &ldquo;Postback&rdquo; with PHP.&nbsp;This is such a basic thing that you can easily check with .NET to see if the page has been submitted and what button was pressed.&nbsp;For example if your &ldquo;btnSubmit&rdquo; was pressed, it will call btnSubmit_Click.&nbsp;With PHP, you have to do this manually.&nbsp;Not to mention how mish mashed your PHP page can be in terms of mixed code and style/HTML elements.</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;"><br />
How about caching? I wanted to implement caching with PHP and I had a fun time, I had to check if the cached output file existed, and then if so, then check how old it is, and so on&#8230; Yeah okay again maybe there are some nice components already done for this, but I didn&rsquo;t have to look very hard to do it with .NET, I simply added a CacheDependency on an XML file (or whatever the case was), and BOOM!&nbsp;It regenerated the file whenever necessary.</span></div>
<div style="margin: 0in 0in 0pt;">&nbsp;</div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;">How about reusable components?&nbsp;With .NET you can create ASCX (Custom Controls) that you can place within a page that expose certain properties and the control itself maintains its state, can have buttons, etc, etc.</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;"><br />
How about master pages (i.e. templates) in .NET?&nbsp;Again, super cool reusability!&nbsp;You can create pages with repeatable parts, with headers, footers, all sorts of fun stuff.</span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 10pt;"><br />
I can go on and on&#8230; &nbsp;but in general, the more I use .NET, the more impressed I am with it.&nbsp;However, what makes it not-so-practical is how expensive Windows Server hosting is.&nbsp;&nbsp;In summary .NET kicks butt!</span></div>
<div style="margin: 0in 0in 0pt;">&nbsp;<br />
<span style="font-weight: bold;">Update Oct 8 2008</span><br style="font-weight: bold;" /><br />
<span style="font-weight: bold;">&nbsp;<br />
<span style="font-weight: bold;">I wanted to add some more meat to this article based on the comments below</p>
<p></span></span>I mentioned that getting Windows Server hosting is more expensive.. However, lets look at this in perspective.&nbsp; What&#8217;s more expensive &#8211; server cost, or development cost?&nbsp; Development cost in most cases far outweighs any particular savings of a Windows license.&nbsp; What this means is even if your application takes two or three times as long to write, then you have lost any potential savings from running a &quot;free&quot; linux box.&nbsp; </p>
<p>Also, I would like to hear about how to unit test with PHP.&nbsp; </p>
<p>.NET offers unit testing via many different frameworks, NUnit probably being the most popular right now.&nbsp;&nbsp; I would like to know how can I unit test in PHP?&nbsp; There is also an extension for NUnit available called NUnitAsp that allows me to test my interface.&nbsp; Another notable extension for Nunit is an automatic database rollback.&nbsp; SWEET!&nbsp; More details to come as time goes by.<span style="font-weight: bold;"><span style="font-weight: bold;"> </span></span></div>
<h3  class="related_post_title">Other Interesting Posts</h3><ul class="related_post"><li><a href="http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx" title="PHP VS. ASP.NET">PHP VS. ASP.NET</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/05/25/creating-sqlparameters-best-practices.aspx" title="Creating SqlParameters Best Practices">Creating SqlParameters Best Practices</a></li><li><a href="http://www.sharpdeveloper.net/content/archive/2007/06/15/creating-maintainable-database-queries-in-c-with-source-code.aspx" title="Creating Maintainable Database Queries In C# (with source code)">Creating Maintainable Database Queries In C# (with source code)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.sharpdeveloper.net/content/archive/2008/05/08/php-vs-aspnet.aspx/feed</wfw:commentRss>
		<slash:comments>91</slash:comments>
		</item>
	</channel>
</rss>

