Skip to main content

Posts

Showing posts from 2010

Asp.Net 4.0: An Overview-Part-II

This post is in continuation with the series started in my earlier post and continues to explore the remaining features as described in the post. Let’s start by considering the point 2 in the earlier post i.e. Shrinking Session State Shrinking Session State  ASP.NET (3.5) provides two default options for storing session state across a Web farm: a session-state provider that invokes an out-of-process session-state server, and a session-state provider that stores data in a Microsoft SQL Server database.session state has to be serialized before it is sent to remote as both options involve storing state information outside a Web application's worker process the size of the serialized data can grow quite large as more data is added to the session state. ASP.NET 4 introduces a new compression option( compressionEnabled ) .When this configuration option is set to true, ASP.NET will compress (and decompress) serialized session state by using the .NET Framework System.IO.Compression.GZipStr

Asp.Net 4.0: An Overview-Part-I

Asp.net 4.0 introduces a lot of new features and controls that can be broadly categorized as depicted below. 1. Server Side enhancements 2. New Controls 3. ASP.Net MVC enhancements 4. Dynamic Data This post covers only the First part i.e. Server Side enhancements. Server Side Enhancements A) Caching Enhancements B) Shrinking Session State C) Performance Monitoring Improvements  D) Shrinking Web.config E) Shrinking session state F) View state on individual controls   Caching Enhancements Prior to Asp.net 4.0, page output is stored in memory in a private area of the ASP.NET cache. If the Caching is done for large number of pages, the output cache puts additional pressure on the web server by consuming memory and generating frequent updates to the cache object. ASP.NET 4.0 introduces new concept of  storing page responses outside the ASP.NET worker process. The new Cache API enables the usage of any of the storages that includes storing cache data in disk, storing cache data using custom

URL Encryption/URL Rewriting

One of the main security checks that the most of the sites implement is URL encryption. URL encryption in simple terms converts the human readable address into encrypted format. Most of the times only a part of the URL is encrypted that makes it secure by hiding I the inner implementation details used on the page. Consider an example: Imagine a page which provides user details and let’s assume that the URL for that is http://[site]/users?user_id=[userid]. The same page is called over and again, just y differing the user_id parameter. The simplest approach is to encrypt this value so that it becomes hard to guess the user_id and prevent unauthorized access. (Assuming that Role-based security is not used, as provided in ASP.Net). This looks simple; however one of the side-effects arising out of this could be JavaScript or any code that reads the value from Querysting. To avoid this issue we need to encrypt the page when it is rendered and decrypt the values when there is a need. Easier s

Choosing Right data Access Technology

One of the major and critical decisons to make while developing any software is the Data Access. It sometimes becomes very confusing and crucial to decide among ADO.net, ADO.Net Entitiy Framework, WCF etc for data access. The link here provides a quick guidance for making the decision on Data access. Hope this was Helpful. Till next we connect, Happy Learning!

Common .Net Interview Questions and Why are they asked?

There are many .Net Questions that every interviewer(in general) asks. Through this, I am starting a series of discussions where in I'll be discussing these questions and provide ample satisfactory answers to them. The intent here is to realise the importance of these questions and help the needy(those who are preparing for interviews) and also who believe in knowing the basics rather than just blindly implementing the .Net classes/Interfaces. Starting the First part of this series is All time Classic question #1 Question: What is the difference between Abstract Classes and Interface? The moment this question is asked the candidates generally start uttering the bookish definitions, some of them are . a) Access modifiers: Interfaces--Implicitly Public() , Classes can use use Access Modifiers. b) No implementation in Interfaces, Classes can have implementations as well. c)Abstract classes can't be instantiated . Some more experienced candidates might get into some further details

UML 2.0 (Unified Modeling Language)

You must be wondering why is UML described in this blog (Advanced .Net concepts).Before you start feeling “IT’s time wastage”, let me re-assure you about its importance by restoring to a real life example. Although “Kites” (Indian movie released in 2010) was a blunder at the box-office , however it gives us an opportunity to fit the UML discussion in the story line(although it never had any story).  Let’s start by asking Why UML. The answer, the Hero of the movie did not understand Spanish and the lady didn’t know English (mess created), would have been avoided if both of them knew a common language (might be Hindi!!!).  Any software is a global product involving Architects, designers, developers/Coders (situation is same as described above) .To develop, the pre-requisite is “understanding” and UML shortens the cycle involved in understanding.  The UML is applicable to object-oriented problem solving.  Object oriented solutions begin with the construction of a model. A model is an ab

UML 2.0 (Unified Modeling Language)

You must be wondering why is UML described in this blog (Advanced .Net concepts).Before you start feeling “IT’s time wastage”, let me re-assure you about its importance by restoring to a real life example. Although “Kites” (Indian movie released in 2010) was a blunder at the box-office , however it gives us an opportunity to fit the UML discussion in the story line(although it never had any story).  Let’s start by asking Why UML. The answer, the Hero of the movie did not understand Spanish and the lady didn’t know English (mess created), would have been avoided if both of them knew a common language (might be Hindi!!!).  Any software is a global product involving Architects, designers, developers/Coders (situation is same as described above) .To develop, the pre-requisite is “understanding” and UML shortens the cycle involved in understanding.  The UML is applicable to object-oriented problem solving.  Object oriented solutions begin with the co

Covariance and Contravariance-General Discussion

If you have just started the exploration of .Net Framework 4.0, two terms namely Covariance and Contravariance might have been heard. The concept that these terms encapsulate are used by most developer almost daily, however there has never been any botheration about the terminologies. Now, what actually these terms mean and how are these going to affect us as a developer, if we dive in to the details. The simple answer is it’s always good to know your tools before actually using them. Enough philosophy, let’s get to the business. Starting the discussion let me reiterate that in addition to Covariance and Contravariance, there is another terminology, Invariance. I’ll by start here by diving into the details of Invariance and then proceed further. Invariance: Invariance can be better understood by considering the types in .Net.>net has basically two type, value-types and reference-types. Value types (int, double etc) are invariant i.e. the types can’t be interchanged either

ExpandoObject Class Part-I

ExpandoObject Class Today I’ll cover the basics of ExpandoObject, which is similar to “dynamic”(covered in last post). The major dfference in Dynamic and ExpandoObject class is the fact that using an instance of this class, members can be dynamically added and removed at run time.In addition it can be used to get abd set the values of dynamically added members. The class is a part of System.Dynamic namespace This class implements the following interfaces. IDynamicMetaObjectProvider IDictionary ICollection > IEnumerable > IEnumerable INotifyPropertyChanged Example: dynamic expcheck = new ExpandoObject(); expcheck.Test = " This is Pradeep's Test"; Response.Write(expcheck.Test); Response.Write(expcheck.Test.GetType()); In the example above, an object of ExpandoObject class is created and and property(“Test”) is added to the object at runtime. To verify the concept, I print out the values and the output shows the value of the proper

C# 4.0 dynamic Objects-Part-I

 C# 4.0 dynamic Objects Revisiting the C# 4.0 article (see my earlier post), new features introduced in C# 4.o can be grouped under the following Dynamic binding Named and optional arguments Variance Today I’ll discuss the most interesting feature the “Dynamic Programming”. C# 4.0 introduces a new static type called dynamic (under using System.Dynamic namespace) Dynamic objects expose members such as properties and methods at run time rather than at compile time. At compile time the dynamic object is assumed (no static binding) to support any specified operation and it is only at runtime that the error will crop up if the concerned operation is not supported. The type dynamic can be considered as a special version of the object type . Any object can be implicitly converted to dynamic with type checking postponed until runtime. Conversely, expressions of type dynamic can be implicitly converted to object , or any other type, as long as there exists a conversion at runtime.

DLR-Expando Object

ExpandoObject Class This class represents an object whose members can be dynamically added and removed at run time. This class implements the following intefaces IDynamicMetaObjectProvider IDictionary ICollection > IEnumerable > IEnumerable INotifyPropertyChanged (for details about these interfaces please go theough MSDN documentation) The ExpandoObject class enables developer to add and delete members of its instances at run time. This class is also used to set and get values of these members. It  supports dynamic binding, which enables developers to use standard syntax rather than  more complex complex syntax that are currently used. For example: consider an object _Pobj which has associated member named MyMember It can be invoked as _Pobj.MyMember rather than _Pobj .GetAttribute("MyMember"). The ExpandoObject class implements the standard Dynamic Language Runtime (DLR) interface IDynamicMetaObjectProvider, which enables to share instance

Dynamic Language Runtime (DLR)-An introduction

This month, I will try to to explore the .Net Framework 4.0 . Starting in the series is a general introduction to Dynamic runtime library. The DLR adds a set of services to the CLR for better supporting dynamic languages. Following are the key components of DLR. Common hosting model Expression Trees:shared abstract semantic tree representation DynamicSites,SiteBinders ,Rules:support to make it easy to generate fast dynamic code IdynamicMetaObjectProvider:shared dynamic type system Utilities :default binder, tuples, big integers, adapters for existing static types to participate in the IDynamicMetaObjectProvider protocol, support for new static types to easily participate in IDynamicMetaObjectProvider protocol Following figure  sums up all the key components of DLR Common Hosting ScriptRuntime : This is the starting point for hosting. The ScriptRuntime represents global script state, such as referenced assemblies and a global object (a ScriptScope). You can have m