Posts

Showing posts from May, 2012

InProc Advantages and Disadvantages

InProc mode advantages InProc is default mode which works without any configuration. It is easiest option to implement because you don't need to configure anything. Just read and write session variables in code. Other modes, like SQLServer or StateServer modes require additional configuration. One more advantage of InProc mode is that you can put anything in session variables. State Server or SQL Server requires objects to be serializable. But, if you use InProc, you can save any object in session variable even if it is not serializable. InProc mode works on shared web hosting. State Server is usually not allowed, and some shared web hosting providers give option to use SQL Server. In the other hand, InProc works in any hosting package.     InProc mode disadvantages Reliability is first problem when using InProc. When using InProc mode, all sessions are lost whenever web application restarts. Restart could happen very frequently because of numerous re...

Difference between Machine.config and Web.config

Difference between Machine.config and Web.config Machine.config is automatically installed when you install .NET Framework or Visual Studio. Net. Web.config is automatically created when you create an ASP.Net web application project. Machine.config is called machine level configuration file. Only one machine.config file exists on a server. Web.config is called application level configuration file.  Machine.config file is at the highest level in the configuration hierarchy. Web.Config file inherits setting from the machine.config

Label vs Literal

Label vs Literal: Label: <asp: Label id="lblMessage" runat="server" CssClass="anyclass" Text="My Label" /> will be rendered as: <span id="ctl00_ContentPlaceHolder1_lblMessage" class="anyclass">My Label</span> //assuming you are using masterpage Literal: <asp:Literal id="ltrMessage" runat="server" Text="My Literal" /> will be rendered as: My Literal  In any case (with or without masterpage), extra <span> element with id is added to rendered HTML. You can see from the difference in rendering of Label and Literal control that Labels should be used only when any kind of styling needs to be applied to the Text rendered by Label. In my case, most of the time we are giving styles to the TD element and no extra styling required for Text inside TD element. In that case, you must use Literal control to minimize the amount of HTML rendered in browser.