Sunday 10 February 2013

ASP.NET Folder structure Fallowed by VS

Hi Friends,

In my previous article i explained  about webconfig

Now i'm going to explain about Folder structure Derived by VS

App-Code Folder:


In this folder we store the shared class file and business logic  i mean file like dll,class file,  this can be referenced automatically  by your application

Main thing is items in the folder are recompiled when any changes are detected

App-Data Folder:

Contains application data files including .mdf database file, XML file and other data store files.
The App_Data folder is used by ASP.NET to store the application's local database, such as the
database for maintaining the role information.

App-Themes:

This contains the files that related to appearance of the web pages and control. The files like .CSS and .SKIN files 

Bin Folder

This contains the compiles assemblies such as .dll files for control, components, or other code that you want
to reference to your application

This above  folder are we use frequently in your application, if you want to more about folder structure
refer the fallowing link

http://msdn.microsoft.com/en-us/library/ex526337(v=vs.100).aspx

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





Thursday 15 November 2012

.Net Framework Features, from .Net 2.0 to 4.5


  • .Net Framework 2.0 Features
    • ADO.NET 2.0
    • SQL Server data provider (SqlClient)
    • XML
    • .NET Remoting
    • ASP.NET 2.0
  • .Net Framework 3.0/3.5 Features
    • Windows Presentation Foundation (WPF)
    • Windows Communication Foundation (WCF)
    • Windows Workflow Foundation (WWF)
    • Windows Card Space (WCS)
    • Core New Features and Improvements
      • Auto Implemented
      • Implicit Typed local variable
      • Implicitly Typed Arrays
      • Anonymous Types
      • Extension Methods(3.5 new feature)
      • Object and Collection Initializers
      • Lambda Expressions
  • .Net Framework 4.0 Features
    •     Application Compatibility and Deployment
    •     Core New Features and Improvements
      • BigInteger and Complex Numbers
      • Tuples
      • Covariance and Contravariance
      • Dynamic Language Runtime
    •     Managed Extensibility Framework
    •     Parallel Computing
    •     Networking
    •     Web
    •     Client
    •     Data
    •     Windows Communication Foundation
    •     Windows Workflow Foundation
  • .Net Framework 4.5 Features
    •  .NET for Windows Store Apps
    • Portable Class Libraries
    • Core New Features and Improvements
    • Tools
    • Parallel Computing
    • Web
    • Windows Presentation Foundation (WPF)
    • Windows Communication Foundation (WCF)
    • Windows Workflow Foundation (WF)
  • Conclusion

.Net Framework 2.0 Features



ADO.NET

New features in ADO.NET include support for user-defined types (UDT), asynchronous database operations, XML data types, large value types, snapshot isolation, and new attributes that allow applications to support multiple active result sets (MARS) with SQL Server 2005

ASP.NET


The Microsoft .NET Framework 2.0 includes significant enhancements to all areas of ASP.NET. For Web page development, new controls make it easier to add commonly used functionality to dynamic Web pages. New data controls make it possible to display and edit data on an ASP.NET Web page without writing code. An improved code-behind model makes developing ASP.NET pages easier and more robust. Caching features provide several new ways to cache pages, including the ability to build cache dependency on tables in a SQL Server database.
ASP.NET accommodates a wide variety of browsers and devices. By default, controls render output that is compatible with XHTML 1.1 standards. You can use device filtering to specify different property values on the same control for different browsers.

.NET Remoting

.NET Framework Remoting now supports IPv6 addresses and the exchange of generic types. The classes in the System.Runtime.Remoting.Channels.Tcp namespace support authentication and encryption using the Security Support Provider Interface (SSPI). Classes in the new System.Runtime.Remoting.Channels.Ipc namespace allow applications on the same computer to communicate quickly without using the network. Finally, you can now configure the connection cache time-out and the number of method retries, which can improve the performance of network load-balanced remote clusters.

XML

The new System.Xml.XmlReaderSettings class allows to specify the type of verifications which must be done when using a subclass of XmlReader to read XML data.
It is now possible to partially validate a DOM tree loaded within an instance of XmlDocument.
It is now possible to modify a DOM tree stored in an XmlDocument instance through the XPathNavigator cursor API.

.Net Framework 3.0/3.5 Features


Windows Presentation Foundation (WPF)

Windows Presentation Foundation (WPF) is a next-generation presentation system for building Windows client applications. The core of WPF is a resolution-independent and vector-based rendering engine that is built to take advantage of modern graphics hardware.
 WPF extends the core with a comprehensive set of application-development features that include Extensible Application Markup Language (XAML), controls, data binding, layout, 2-D and 3-Dgraphics, animation, styles, templates, documents, media, text, and typography. WPF is included in the Microsoft .NET Framework, so you can build applications that incorporate other elements of the .NET Framework class library.
To support some of the more powerful WPF capabilities and to simplify the programming experience, WPF includes additional programming constructs that enhance properties and events: dependency properties and routed events.

Windows Communication Foundation (WCF)


Windows Communication Foundation (WCF) is Microsoft’s unified programming model for building service-oriented applications. WCF allows you to build all kinds of distributed applications including 'traditional' Web Services so that your services support SOAP and will therefore be compatible with older .NET (and other) technologies. WCF is not just about pure SOAP over the wire - you can work with an Info set, and create a binary representation of your SOAP message that can then be sent along with your choice of protocol. This is for those who are particularly concerned about performance and have traditionally turned to .NET remoting.

Windows Workflow Foundation (WWF)


Windows Workflow Foundation, a core component of .NET Framework 3.0, provides a programming model, run-time engine, and tools for building workflow applications
A workflow is created and maintained by the workflow run-time engine. There can be several workflow engines within an application domain, and each workflow engine can support multiple workflows running concurrently. The run-time enables idle workflows to be unloaded from memory, persisted to a store, and reloaded whenever input is received.
Workflows can be authored in code, XAML markup, or a combination of both, known as code-separation, which is similar to the ASP.NET mode
Windows CardSpace (WCS):
Windows CardSpace (InfoCard) is a Digital Identity to online services. Digital Identity means how user will electronically represent them. Like as a debit/credit card each card has digital identity and password. If any user go to use the site on internet then he enter their username and password, for identity, but this is not secure. To reduce these types of problems WCS works.
WCS (originally called Info Card) helps people keep track of their digital identities as distinct information cards. If a Web site accepts WCS logins, users attempting to log in to that site will see a WCS selection. By choosing a card, users also choose a digital identity that will be used to access this site. CardSpace and the new supporting technologies will change how you authenticate into an application, whether it sits on the Web, your phone, or your desktop.

Core New Features and Improvements


Some core new features and improvements are implemented in .Net 3.0/3.5

1. Auto Implemented Property

2. Implicit Typed local variable

3. Implicitly Typed Arrays

4. Anonymous Types

5. Extension Methods (3.5 new feature)

6. Object and Collection Initializers

7. Lambda Expressions



.Net Framework 4.0 Features


Common Language Runtime (CLR)

Application Compatibility and Deployment

                   .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions but there are some changes that were made to improve security, standards compliance, correctness, reliability, and performance.     

Managed Extensibility Framework

          MEF is a new library in .NET Framework 4 that helps you build extensible and composable applications. 

Parallel Computing

          In involves writing multithreaded and asynchronous code that simplify the work of application developers.It enables the developers to write efficiently,fine-grained and scalable code.

Networking

  Networking improvements are as follows:
1. Security improvements for Windows authentication
2. Support for Network Address Translation
3. Secure Sockets Layer (SSL) support
4. Improved support for mail headers

Web

 ASP.NET version 4 introduces new features in the following areas:
1. Core Services
2. Web Forms
3. Web Forms Control
4. Visual Web Developer
5. Multi-targeting


.Net Framework 4.5 Features

 .NET for Windows Store Apps

Windows Store apps are designed for specific form factors and leverage the power of the Windows operating system. A subset of the .NET Framework 4.5 is available for building Windows Store apps for Windows by using C# or Visual Basic.

Portable Class Libraries

The Portable Class Library project in Visual Studio 2012 enables you to write and build managed assemblies that work on multiple .NET Framework platforms. Using a Portable Class Library project, you choose the platforms (such as Windows Phone and .NET for Windows Store apps) to target.

ASP.NET 4.5

ASP.NET 4.5 includes the following new features:
  • Support for new HTML5 form types.
  • Support for model binders in Web Forms. These let you bind data controls directly to data-access methods, and automatically convert user input to and from .NET Framework data types.
  • Support for unobtrusive JavaScript in client-side validation scripts.
  • Improved handling of client script through bundling and minification for improved page performance.
  • Integrated encoding routines from the AntiXSS library (previously an external library) to protect from cross-site scripting attacks.
  • Support for WebSockets protocol.

 

Windows Presentation Foundation (WPF) Features in 4.5

In the .NET Framework 4.5, Windows Presentation Foundation (WPF) contains changes and improvements in the following areas:
  • The new Ribbon control, which enables you to implement a ribbon user interface that hosts a Quick Access Toolbar, Application Menu, and tabs.
  • The new INotifyDataErrorInfo interface, which supports synchronous and asynchronous data validation.
  • New features for the VirtualizingPanel and Dispatcher classes.
  • Improved performance when displaying large sets of grouped data, and by accessing collections on non-UI threads.
  • Data binding to static properties, data binding to custom types that implement the ICustomTypeProvider interface, and retrieval of data binding information from a binding expression.
  • Repositioning of data as the values change (live shaping).
  • Ability to check whether the data context for an item container is disconnected.
  • Ability to set the amount of time that should elapse between property changes and data source updates.
  • Improved support for implementing weak event patterns. Also, events can now accept markup extensions.

 

Windows Communication Foundation (WCF) Features in 4.5

In the .NET Framework 4.5, the following features have been added to make it simpler to write and maintain Windows Communication Foundation (WCF) applications:
  • Simplification of generated configuration files.
  • Support for contract-first development.
  • Ability to configure ASP.NET compatibility mode more easily.
  • Changes in default transport property values to reduce the likelihood that you will have to set them.
  • Updates to the XmlDictionaryReaderQuotas class to reduce the likelihood that you will have to manually configure quotas for XML dictionary readers.
  • Validation of WCF configuration files by Visual Studio as part of the build process, so you can detect configuration errors before you run your application.
  • New asynchronous streaming support.
  • New HTTPS protocol mapping to make it easier to expose an endpoint over HTTPS with Internet Information Services (IIS).
  • Ability to generate metadata in a single WSDL document by appending ?singleWSDL to the service URL.
  • Websockets support to enable true bidirectional communication over ports 80 and 443 with performance characteristics similar to the TCP transport.
  • Support for configuring services in code.
  • XML Editor tooltips.

Windows Workflow Foundation (WF) Features in 4.5

Several new features have been added to Windows Workflow Foundation (WF) in the .NET Framework 4.5. These new features include:
  • State machine workflows, which were first introduced as part of the .NET Framework 4.0.1 (.NET Framework 4 Platform Update 1). This update included several new classes and activities that enabled developers to create state machine workflows. These classes and activities were updated for the .NET Framework 4.5 to include:
    • The ability to set breakpoints on states.
    • The ability to copy and paste transitions in the workflow designer.
    • Designer support for shared trigger transition creation.



Friday 24 August 2012

Get And Set Property

Definition:
         public class MyClass
{
    private int _age;

    public int Age
    {
          get{ return _age;  }
          set{ _age = value; }
    }
}
Uses:

  • You need to more than just a simple get/set - in this case, you should just avoid using automatic properties for this member.
  • You want to avoid the performace hit of going through the get or set and just use the member directly - in this case, I'd be suprised if there really was a performace hit. The simple get/set members are very very easy to inline, and in my (admitly limited) testing I haven't found a difference to using the automatic properties vs accessing the member directly.
  • You only want to have public read access (i.e. just a 'get') and the class write to the member diectly - in this case, you can use a private set in your automatic property. i.e.
    public class MyClass
    {
        public int Age {get; private set;} }
This usually covers most the reasons for wanting to directly get to the backing field used by the automatic properties.
Example Program :

using System;

class Example
{
    int number;
    public int Number
    {
 get
 {
     return number;
 }
 set
 {
     number = value;
 }
    }
}

class Program
{
    static void Main()
    {
 Example example = new Example();
 example.Number = 5; // set { }
 Console.WriteLine(example.Number); // get { }
    }
}
OutPut:
       5

Sunday 12 August 2012

Microsoft TechEd 2012 on the Go.. Are you attending?

Well,  Microsoft is going Big with their event TechEd 2012 which will be held just in 2 days.Everyone is excited to visit Bangaluru for this awesome event and learn lot of technology

Visit the link below to know more about the event
Microsoft TechEd India 2012 -> Go Big

Working with NotificationUI on browsers with HTML5


Notification is one of the interesting thing that browsers are adding support to. Generally when we think of Web notification we always go for some HTML popup or using a new window through Javascript. But those html are generally does not follow any standards or even looks different to the user to different sites. Hence few of the notifications lacks consistency. HTML5 introduces new notification specs which enable the browser to send its own notification rather than going with custom notifications from the developer.
The notifications is now currently implemented in Chrome, but it will be implemented in latest releases of other browsers too. Let us look how to use notification  in your browser.
To request for notification use the following code :
window.webkitNotifications.requestPermission();
When the browser asks for notification, it will popup one message to the user to allow or deny. If the user allows the notification, the notification service gets enabled and the site can send notification to the browser.
if (window.webkitNotifications.checkPermission() == 0) {
var notification = window.webkitNotifications.createNotification(imgpath, 'Notification received', 'Hii, this is special notification');
notification.show();
}
So when we use createNotification it will create a notification object with the image , title and the message which needs to be notified. The show() method will show the notification to the user.