Difference between ASP.NET 3.5 and ASP.NET 4.0
- S.NoASP.NET 3.5ASP.NET 4.0
1Whether Client data can be directly accessed ?In ASP.NET 3.5, the data from the client side cannot be directly accessed. The client side data can only be accessed using script manager’s Page methods,interface named ICallbackEventHandleror by using the componentXMLHttpHandler.Whether Client data can be directly accessed ?In ASP.NET 4, the data from the client side can be directly accessed using client data view and client data context objects.Following methods are available in ASP.NET 4.0 to access Client data directly,1) Client data controls
2) Client templates
3) Client data context
2Whether we can set MetaTags (Keywords,Description) in the Page Directive?In ASP.NET 3.5, two meta tags can be used, one with name as keywords and other with name as description to record the keywords and description for SEO purpose.Whether we can set MetaTags (Keywords,Description) in the Page Directive?The meta keywords and metadescription is really useful for SEOoptimization of the web page. InASP.NET 4, the keywords anddescription can be included as part of page directive itself. 3 Whether ViewState can be applied at the Control level ?
ASP.NET 3.5 EnableViewState property cannot be used to apply ViewState at the Control level.It is mainly used at the page level.Its default value is True and its acceptable values ae True and False.
Whether ViewState can be applied at the Control level ?
In ASP.NET 4, ViewState mechanism is improved to set ViewState at the Contol level besides at the page level set by EnableViewState property in ASP.NET 3.5 .Its default value is Inherit and acceptable values are Enabled,Disabled and Inherit.
4How ASP.NET 3.5 identifies ClientID ?In ASP.NET 3.5, ClientId property has to be used to find the dynamically generated client id.How ASP.NET 4.0 identifies ClientID ?In ASP.NET 4, a property calledClientIDMode is newly introduced to identify and record the ClientId easily.ClientIDMode has following values.AutoID – Same as ASP.NET 3.5
Static – There won’t be any separate clientid generated at run time
Predictable-These are used particularly in datacontrols. Format is like clientIDrowsuffix with the clientid vlaue
Inherit- This value specifies that a control’s ID generation is the same as its parent.
The default value of ClientIDMode for a page is Predictable. The default value of ClientIDMode for a control is Inherit. Because the default for controls is Inherit, the default generation mode is Predictable.
5Whether permanent redirection is possible or not ?There is no RedirectPermanent() method available in ASP.NET 3.5.Redirect method is less useful than the RedirectPermanent method. It will cause search engine results to be less current, and this can also impact performance because visitors will not be accessing the best URL. Redirect may be most useful for login pages or more complex situations.
Whether permanent redirection is possible or not ?ASP.Net 4.0 introduced a new URL redirection method RedirectPermanent() which avoids round trips.
We can implement this as shown below:
RedirectPermanent("/newpath/newpage.aspx");RedirectPermanent returns a 301 HTTP response—it redirects permanently to another location. Search engines such as Google and Bing will change their indexes to point to the new page directly. To call RedirectPermanent you will need to get the Response object from the HttpContext.Then, you can call RedirectPermanent: if you pass false as the second parameter, you can perform further actions and avoid an exception.
6Output Caching Enhancement:OutPut Cache in ASP.Net 3.5 has a limitation - generated content always has to be stored in memory, and on servers that are experiencing heavy traffic, the memory consumed by output caching can compete with memory demands from other portions of a Web application.Output Caching Enhancement:ASP.NET 4 adds an extensibility point to output caching that enables you to configure one or more custom output-cache providers. Output-cache providers can use any storage mechanism to persist HTML content. This makes it possible to create custom output-cache providers for diverse persistence mechanisms, which can include local or remote disks, cloud storage, and distributed cache engines.In order to know how to implement Custom Output Caching, please refer to the following URL, 7QueryExtender Control for filtering the data returned by EntityDataSource and LinqDataSource controls:There is no QueryExtender control available in ASP.NET 3.5 to filter the data returned by DataSource Controls( EntityDataSource and LinqDataSource).It has to explicitly use 'Where clause' in the data source.
QueryExtender Control for filtering the data returned by EntityDataSource and LinqDataSource controls:QueryExtender Control is an add-on to the DataSource Controls: EntityDataSource and LinqDataSource. QueryExtender is used to filter the data returned by these controls. As the QueryExtender control relies on LINQ, the filter is applied on the database server before the data is sent to the page, which results in very efficient operations.i.e., QueryExtender Control is intended to be used to create filters for data that is retrieved from a data source, without using an explicit Where clause in the data source. The control can be used to filter data in the markup of a Web page by using declarative syntax.
<meta name="keywords" content="These, are, my, keywords" /> <meta name="description" content="This is the description of my page" />
< %@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" Keywords="Keyword1,Key2,Key3,etc" Description="description" %>
<asp:LinqDataSource ID="dataSource" runat="server" TableName="Products"></asp:LinqDataSource> <asp:QueryExtender TargetControlID="dataSource" runat="server"> <asp:SearchExpression DataFields="ProductName, Supplier.CompanyName" SearchType="StartsWith"> <asp:ControlParameter ControlID="TextBoxSearch" /> </asp:SearchExpression> </asp:QueryExtender>