Wednesday, 30 January 2013

what is web.config in ASP.NET ? ?

Hi all,

This is my first Article in my blog so please apologize for my english and if i convey anything
wrongly tell me

The time you start developing web application from that moment to until you finish your application
web.config file plays a major role for securing your application and also it handles all the
requirements at the application level but we must understand what we will do by means of
web.config file.

We must Remember the fallowing when we think about web.Config

> Web.config stored in XML format which makes us easier to work.
> We can have any number of web.config files for an application .Each web.config files
    applies their settings to thier own directory
> It inherit form the folder location "systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Web.config location" 
>IIS is configured in such way that it prevent the web.config file from browser access.
  
see Bellow the hierarchy of wen.config

<configuration>

        <configSections>
            <sectionGroup>
            </sectionGroup>
        </configSections>

        <system.web>
        </system.web>

        <connectionStrings>
        </connectionStrings>

        <appSettings>
        </appSettings>
        

</configuration>
 
 
So,for web.config file have the root element configuration tag,Each element 
can have any number attribute and child elements.

Let me Discuss some General Configuration settings in web.config file
 
<system.web>

The most common thing we work in configuration hierarchy is system.web.

<system.web
        <assemblies>
<add assembly="System, Version=1.0.5000.0, Culture=neutral/>
 </assemblies>

</system.web>
 
Page Settings 

Page settings is used for the general settings of all the pages, we can
set the general settings like sessionstate,viewstate,buffer, etc.,
 
<pages buffer ="true" styleSheetTheme="" theme ="Acqua"
              masterPageFile ="MasterPage.master"
              enableEventValidation="true"> 
 
Custom error Settings 

By using this we can configure the application level errors in these 
section.
 
<customErrors defaultRedirect ="Error.aspx" mode ="Off">
   <error statusCode ="401" redirect ="page.aspx"/>
</customErrors> 


Here we have default redirect and mode attribute which specifies 
the default redirect page and on/off mode respectively
 
 redirecting the default page depends upon the error status code .
 
400-bad request
401-unauthorized
404-not found
408-request time
 
By using web.config file we can give authentication,autorization,membership,
provider,role,profile 



 


 
 



 

 
 





Sunday, 27 January 2013

Inertview Questons in DOTNET

What Is CLR ?

CLR is Common Language Runtime is the runtime that converts a MSIL code into the host machine language code. It is the execution engine for .NET Framework applications. It provides a number of services, including:
What is CTS?   
CTS is Common Type System, which describes how types are declared, used and managed. CTS facilitate cross-language integration, type safety, and high performance code execution.
What is CLS? 
CLS Is Common Language Specification, is a specification that defines the rules to support language integration. This is done in such a way, that programs written in any language (.NET compliant) can interoperate with one another. This also can take full advantage of inheritance, polymorphism, exceptions, and other features. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one-step towards that.
What is an Intermediate Language?
(IL) Intermediate Language Or (CIL) Common Intermediate Language Or (MSIL) Microsoft Intermediate Language, is one of the Core component of the .NET Framework. Any .NET source codes written in any .net supportive language (C#,VB.net etc), when compiled are converted to MSIL. This MSIL, when installed or at the Runtime, gets converted to machine code. The Runtime conversion of MSIL code to the machine code is handled by a component called as the Just In Time (JIT) Complier.
What is Just In Time Compiler?
It is a compiler which converts MS IL (Microsoft Intermediate Language) code to Native Code (i.e. CPU-specific code that runs on the same computer architecture). Just-In-Time compiler- it converts the language that you write in .Net into machine language that a computer can understand. 
There are 3 types of JITs
Pre-JIT compiler
       Compiles entire code into native code completely in a single Operation
Econo JIT compiler

      Compiles only methods(Code) called at Runtime
Normal JIT compiler
      Compiles only that part of code called at Runtime and places in cache
 What is Managed Code? 
Managed code runs inside the environment of CLR i.e. .NET runtime. In short, all IL are managed code. However, if you are using some third party software example VB6 or VC++ component they are unmanaged code, as .NET runtime (CLR) does not have control over the source code execution of these languages.
A runtime-aware compiler compiles the IL into native executable code within a managed execution environment that ensures type safety, array bound and index checking, exception handling, and garbage collection. Also, many unproductive programming tasks are automatically taken care of, such as type safety checking, memory management, and destruction of unneeded objects. You can therefore focus on the business logic of your applications and write them using fewer lines of code. The result is shorter development time and more secure and stable applications.
 What is UnManaged Code?
Unmanaged code is defined as 
>CLR cannot understand the code
>CLR cannot instruct the code a
>second time compilation is unmanaged code and it is understand only by the machine