Skip to main content

Posts

Showing posts from February, 2010

Global.asax file explored....

Global.asax Global.asax file, as the name suggests is a global level(application) level file that contains application wide settings(don not confuse it with web.config settings) The Global.asax file is in the root application directory. It's actually an optional file. It is configured such that it cannot be downloaded. The ASP.NET page framework recognizes automatically any changes that are made to the Global.asax file. What happens when this file is changed in a running application? Answers:The asp.net framework reboots the application. Now let me explain this reboot thing.In simple and to words the appdomain is restarted.Meaning that all browser sessions will become void, state information is flushed out of the memory. Developer's Perspective: The Global.asax file is derived from the HttpApplication class and it maintains a pool of HttpApplication objects, and assigns them to applications as needed. The Global.asax file contains the following events:   Application

ASP.Net Services - Custom SOAP Headers

ASP.Net Services With Custom SOAP Headers  Beginning here, I’ll not be discussing what web services are, WSDL, Disco Files etc, anyone can  easily get tons of data on these, from internet. I am more concerned here about the Security aspect of Webservices. If you are interested in exploring all the aspects of ASP.Net service security, here is the link http://msdn.microsoft.com/en-us/library/w67h0dw7%28VS.80%29.aspx Having said all this time, let’s start the real story. SOAP: Simple Object Access Protocol (uses XML and HTTP) The protocol contains SOAP packets that have following three components. SOAP Envelope: the container in which the actual data will be packaged. SOAP Header (Optional). SOAP Body (generally used for returning results) A typical SOAP message looks like this version ="1.0" encoding ="utf-8" ?> < soap: Envelope xmlns:soap ="http://schemas.xmlsoap.org/soap/envelope/">   < Soap: Header >   soap: Header &

Serialization

What Is Serialization? Serializing is the process of converting an object into a linear sequence of bytes that can be stored or transferred. Deserializing is the process of converting a previously serialized sequence of bytes into an object.   These techniques convert objects into binary, SOAP, or Extensible Markup Language (XML) documents that can be easily stored, transferred, and retrieved. The Following section is meant for Object Serialization and De-serialization Serialization Format                                       Following are the two formatters that are available to be used in serialization/deserialization BinaryFormatter: This formatter is the most efficient way to serialize objects that will be read by only .NET Framework–based applications. It converts the type into a stream of binary data. SoapFormatter : T his is XML-based formatter and is the most reliable way to serialize objects that will be transmitted across a network or read by non–.NET Framework a

C# Basics Revisited - Part I

Core Concepts Revisited: Points to remember Classes   Derived class implicitly contains all members of its base class, except constructors.  A derived class cannot remove the definition of an inherited member, although it can extend the members. An implicit conversion exists from a class type to any of its base class types. For Example: //Base Class public class BaseClass {     public int x, y;         public BaseClass( int x, int y)       {         this .x = x-1;         this .y = y-1;       }     public int Sum()     { return x + y ; }     } //Derived Class public class DerivedClass : BaseClass {     public int z;       public DerivedClass( int x, int y, int z): base (x,y)       {         this .z = z-1;       }     public int Sum1()     { return x + y + z; }     } It is legal to call the  Sum function as follows: BaseClass bc = new BaseClass (); int j=  bc.Sum(); OR BaseClass bc1 = new DerivedClass (4, 5, 6); int j=  bc1.Sum(); In a chain of

Structural Patterns: Decorator Pattern

Decorator Pattern The Decorator pattern provides a way of attaching new state and behavior to an object dynamically.  The original object never comes to know that it is being “decorated”. One important point to remember while implementing the Decorator pattern is that the decorator (class that takes the responsibility of extending or decorating the base class) will inherit the original class and  also contain an object of it This Pattern does is useful when you want to extend the base class functionality, but do not want to use subclasses and inheritance. In shot and sweet terms. OPEN for extension, Closed for modification (do not confuse, if you have heard it somewhere else) The Decorator pattern’s key feature is that it does not rely on inheritance for extending behavior. (i.e. To extend the behavior of existing object, it does not need to inherit all the characteristics of the object to be decorated). . Is-a Relationship The is-a relationship indicates if a class inherits