Thursday 16 February 2017

ASP.NET interview questions Part-3

1. Ques: What is serialization ? What is uses for serialization ?
Answer:
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.

Uses for serialization as given bellow
  • Storing user preferences in an object.
  • Maintaining security information across pages and applications.
  • Modification of XML documents without using the DOM.
  • Passing an object from on application to another.
  • Passing an object from one domain to another.
  • Passing an object through a firewall as an XML string. 

2. Ques: What is difference between XML Serialization and Binary Serialization ?
Answer:
XML Serialization:
  • XML serialization is serializing an object into an XML file.
  • It use namespace named System.Xml.Serialization. 
  • XML Serialization is more efficient and fast than Binary Serialization.
  • Xml is more interoperable and human readable than binary.
  • Xml Serializer need not mention serializable attribute on the class.
Binary Serialization:
  • Binary serialization is  serializing an object into a Binary file.
  • It use namespace System.RunTime.Serialization.Formatters.Binary.
  • Binary Serialization is more efficient and fast than XML Serialization.
  • Binary serializer need serializable attribute.     

3. Ques: What is of Globalization and Localization in ASP.NET? 
Answer :
Globalization is the process of designing the application for users of different languages across the Globe (multiple cultures). To do globalization we need to use Resource Files.

In Localization designing the application so that application behave as per the current culture and locale.

4. Ques: What is the App Domain in ASP.NET? What are the features of App Domain.
Answer :
App Domain is Lightweight process which is both a container and boundary. it is logical isolation boundary created around .NET applications so that applications do not access or affect each other.
App Domains are generally created by Hosts for example Internet Explorer and Asp.net.

Application domains have the following features:
  • Better efficiency by executing long-running processes. 
  • It provides security by restricting the direct access code from one application to the code of another application.
  • Reliability by using isolation of tasks.
  • App Domain makes the boundary for code safety.
  • Each app domain runs on its own security level.

5. Ques: What is the authentication in ASP.NET? 
Answer :
Authentication is the process of determining the authenticity of a user based on the user’s credentials.
ASP.NET provides three ways to authenticate a user:

Forms authentication: This authentication mode is cookies based authentication, where the user name and the password are stored either in a text file or the database
<configuration>
    <system.web>    
    <authentication mode="Forms">
    <forms loginUrl="login.aspx">
        <credentialspasswordFormat="Clear">
            <user name="admin" password="admin!@#" />
        </credentials>
    </forms>
    </authentication>        
    <authorization>
    </system.web>
</configuration>

Windows authentication: It authenticates users based on the users' Windows accounts.
<authentication mode="Windows"/>
<authorization>
<allow users ="*" />
</authorization>

Passport authentication: Passport authentication is a centralized authentication service that uses Microsoft's Passport Service to authenticate the users of an application.

<configuration>
  <system.web>
    <authenticationmode="Passport">
      <passportredirectUrl="login.aspx" />
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>
  </system.web>
</configuration>


6. Ques: What is Authorization in ASP.NET? 
Authorization is provide the accessibility to a resource for a authenticated user. authorization can only work with authenticated users.
Three types of authorization in ASP.NET.

  • 1. URL Authorization
  • 2. File Authorization
  • 3. Authorization based on ACLs

7. Ques: What is an Impersonation?
Answer:
  • It is the process of executing code in the context of another user identity.
  • It is the mechanism in the ASP.NET which decide under which account web application should be run.
  • By default Impersonation is off, we need to enable it in Web.config file.
  • By default all the ASP.NET applications run under the ASP.NET user account. If you set the impersonation to TRUE in the Web.config file then that application runs under the current user's account who has logged in that machine. <identity impersonate="true" /> 
We can use the impersonation in this two scenarios:
  • To give each web application different permissions.
  • To use existing Windows user permission.

8. Ques: How Can you change a Master Page dynamically at runtime?
Answer:
Yes. To change a master page, set the MasterPageFile property to point to the .master page during the PreInit page event.


9. Ques:  How many web.config files can I have in an application?
Answer:
You can keep multiple web.config files in an application. You can place a Web.config file inside a folder or wherever you need (apart from some exceptions) to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.


10. Ques: What are Themes?
Themes are made up of skins, cascading style sheets (CSS), images, and other resources, and they are created within special folders in the server structure. Themes are like CSS styles - they both define a set of common attributes that can be applied to controls and elements on any page, however CSS is limited to the presentation elements of a control. Themes allow the customisation of any property of an Asp.net control, such as text values, icon glyphs, template layouts and so on.

No comments:

Post a Comment

Thank you for comment