Shailendra Saxena's Technical Blog

Visual Studio 2013 New Features

clock June 29, 2013 08:24 by author ShailendraSaxena


Visual Studio 2013 New Features

One Asp.Net

                Means In One Project we can have ASP.Net Web Forms +MVC+API (All Together)

                Scaffolding for All Frameworks

                New Extensible Identity System OWIN (Open Web Interface for .Net)


clock December 14, 2012 05:52 by author ShailendraSaxena


Serialization is the process of converting an object into a stream of bytes in order to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.

How Serialization Works

This illustration shows the overall process of serialization.

The object is serialized to a stream, which carries not just the data, but information about the object's type, such as its version, culture, and assembly name. From that stream, it can be stored in a database, a file, or memory.

Uses for Serialization

Serialization allows the developer to save the state of an object and recreate it as needed, providing storage of objects as well as data exchange. Through serialization, a developer can perform actions like sending the object to a remote application by means of a Web Service, passing an object from one domain to another, passing an object through a firewall as an XML string, or maintaining security or user-specific information across applications.

Making an Object Serializable

To serialize an object, you need the object to be serialized, a stream to contain the serialized object, and a Formatter. System.Runtime.Serialization contains the classes necessary for serializing and deserializing objects.

Apply the SerializableAttribute attribute to a type to indicate that instances of this type can be serialized. A SerializationException exception is thrown if you attempt to serialize but the type does not have the SerializableAttribute attribute.

If you do not want a field within your class to be serializable, apply the NonSerializedAttribute attribute. If a field of a serializable type contains a pointer, a handle, or some other data structure that is specific to a particular environment, and the field cannot be meaningfully reconstituted in a different environment, then you may want to make it nonserializable.

If a serialized class contains references to objects of other classes that are marked SerializableAttribute, those objects will also be serialized.

Binary and XML Serialization

Either binary or XML serialization can be used. In binary serialization, all members, even those that are read-only, are serialized, and performance is enhanced. XML serialization provides more readable code, as well as greater flexibility of object sharing and usage for interoperability purposes.

Binary Serialization

Binary serialization uses binary encoding to produce compact serialization for uses such as storage or socket-based network streams.

XML Serialization

XML serialization serializes the public fields and properties of an object, or the parameters and return values of methods, into an XML stream that conforms to a specific XML Schema definition language (XSD) document. XML serialization results in strongly typed classes with public properties and fields that are converted to XML. System.Xml.Serialization contains the classes necessary for serializing and deserializing XML.

You can apply attributes to classes and class members in order to control the way the XmlSerializer serializes or deserializes an instance of the class.

SOAP Serialization

XML serialization can also be used to serialize objects into XML streams that conform to the SOAP specification. SOAP is a protocol based on XML, designed specifically to transport procedure calls using XML. As with regular XML serialization, attributes can be used to control the literal-style SOAP messages generated by an XML Web service.

Basic and Custom Serialization

Serialization can be performed in two ways, basic and custom. Basic serialization uses the .NET Framework to automatically serialize the object.

Basic Serialization

The only requirement in basic serialization is that the object has the SerializableAttribute attribute applied. The NonSerializedAttribute can be used to keep specific fields from being serialized.

When you use basic serialization, the versioning of objects may create problems, in which case custom serialization may be preferable. Basic serialization is the easiest way to perform serialization, but it does not provide much control over the process.

Custom Serialization

In custom serialization, you can specify exactly which objects will be serialized and how it will be done. The class must be marked SerializableAttribute and implement the ISerializable interface.

How to run you web application on specific port on localhost

clock November 3, 2012 23:00 by author ShailendraSaxena


Below are the steps

1.       Go to you web app and open property window.

2.       Change use dynamic port to false

3.       In port number type the port number you want to use. e.g. 1001.

Go to Project Properties and change as below.

Specific port and port No.




Web Site project V/S Web Application projects in ASP.Net

clock October 30, 2012 23:44 by author ShailendraSaxena

In ASP.Net we have Web site projects and Web application projects.below are few differences between them.


Web Sites project

Web Application projects

Can Be accessed by any body

Can be accessed by the authorized users

Contains no project file (.csproj or .vbproj).

Contains project file (.csproj or .vbproj)

Most of the times contains static pages

Contains dynamic pages, contains business logic and data is stored in RDBMS

Can never be implemented as a desktop application.

May have exactly the same functionality as a desktop application. It may in fact be a desktop application with a web interface.

Users have access rights to most of the pages

Users have access rights as per the role.



<<  June 2017  >>






Flag Counter


The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign In