Sunday, July 28, 2019

Why we used Method overriding?

Ans:

When we need to Extend the parent Class Method's behavior  with some modifications.

This is the situation where we inherit the class and override the methods which are required as per
our business requirement.


What is Webconfig, Appconfig, MachineConfig.

WebConfig:

It is a configuration file, which is used in web application and it can be an ASP.NET project or MVC project. Some project contains multiple web.config file inside the same project but with different folder. They have their unique benefits. You can create several web.config file in each folder with their unique benefits as per your project requirement.

It is used to store the application level configuration. Sometimes it inherits the setting from the machine.config. It parses at runtime, means if you make any changes then web application will load all the settings in the config file. You don’t need to create a web.config file because it is auto generated when you create a new web application. If you want to create a web.config manually you can create it.


Machine Config:

It is a special type of configuration file which creates into the OS when you install visual studio. This stores machine level configuration setting. Only one machine.config file exists into the system and it stores highest level of configuration settings.

Machine.config settings apply to all web applications which is residing on the server. The setting of machine.config can be overridden by web.config’s settings. If your system does not contain the machine.config then you cannot execute the application.


Path of Machine.config
    32-bit System

    %windir%\Microsoft.NET\Framework\[version]\config\machine.config

    64-bit System
    %windir%\Microsoft.NET\Framework64\[version]\config\machine.config.

    Appconfig:
It is also a special type of configuration file which is basically used with Windows Services, Windows application, Console Apps or it can be WPF application or any others.

It parses at compile time; it means if you edit the app.config when program is running, then you need to restart the application to reload the configuration setting into the program.

When you run the application which contains the app.config, at the time of compilation a copy of app.config with different name moves into build folder for running the application, So that's why we need to restart the program if any changes made in app.config.

It is not added auto when you create a project, to add this you need to go to solution explorer and choose Add New Item and choose “Application Configuration File”. Windows application always contains the App.config file into the project.



Friday, July 12, 2019

Default time out



  1. The Default Expiration Period for Session is 20 Minutes.
  2. The Default Expiration Period for Cookie is 30 Minutes.
  3. Maximum Size of ViewState is 25% of Page Size

Sunday, July 7, 2019

Serialization

what is Serialization?

Ans: 

Serialization is a process to convert a complex objects into stream of bytes for storage (database, file, cache, etc) or transfer. Its main purpose is to save the state of an object.

Deseailization: Vice-versa


What Are The Types Of Serialization?

Answer :

The types of Serializations are given bellow:

1  Binary Serialization
            In this process all the public, private, read only members are serialized and convert into stream of bytes. This is used when we want a complete conversion of our objects.

2  SOAP Serialization
         In this process only public members are converted into SOAP format. This is used in web services.
 
3  XML Serialization


            In this process only public members are converted into XML. This is a custom serialization. Required namespaces: System.Xml, System.Xml.Serialization.


Answer :
For example consider, we have a very complex object and we need XML format to show it on HTML page. Then we can create a XML file in the disk, writes all the necessary data on the XML file, and use it for the HTML page. But this is not good approach for large number of users. Extra space is required; anyone can see the XML file which creates security issue. We can overcome it by using XML serialization.


Uses of Serialization

  1. To save the state of an object into a file, database etc. and use it latter.
  2. To send an object from one process to another (App Domain) on the same machine and also send it over wire to a process running on another machine.
  3. To create a clone of the original object as a backup while working on the main object.
  4. A set of objects can easily be copied to the system’s clipboard and then pasted into the same or another application