Tuesday, March 15, 2011

Dot Net Interview Questions

Is it possible to derive your class from a base class and implement interfaces at the same time?
Yes its possible, we can use it like this
You have a specific requiremnt due to which you have to use a reserved keywords as an identifier name. How will you do that? Is it possible?
Yes its possible, You can precede the identifier with the @ symbol. This overrides the compiler error and enables you to use a keyword as an identifier.
What do you understand by unsafe mode in C#?

The C# language supports a special mode, called unsafe mode, that enables you to work directly with memory from within your C# code.
This special C# construct is called unsafe mode because your code is no longer safe from the memory-management protection offered by the CLR. In unsafe mode, your C# code is allowed to access memory directly, and it can suffer from the same class of memory-related bugs found in C and C++ code if you're not extremely careful with the way you manage memory

When to Use Asp Net Web Services

(i) Communicating through a Firewall:- When building a distributed application with 100s/1000s of users spread over multiple locations, there is always the problem of communicating between client and server because of firewalls and proxy servers. Exposing your middle tier components as Web Services and invoking the directly from a Windows UI is a very valid option.
(ii) Application Integration:- When integrating applications written in various languages and running on disparate systems. Or even applications running on the same platform that have been written by separate vendors.
(iii) Business-to-Business Integration:- This is an enabler for B2B intergtation which allows one to expose vital business processes to authorized supplier and customers. An example would be exposing electronic ordering and invoicing, allowing customers to send you purchase orders and suppliers to send you invoices electronically.
(iv) Software Reuse :- This takes place at multiple levels. Code Reuse at the Source code level or binary componet-based resuse. The limiting factor here is that you can reuse the code but not the data behind it. Webservice overcome this limitation. A scenario could be when you are building an app that aggregates the functionality of serveral other Applicatons. Each of these functions could be performed by individual apps, but there is value in perhaps combining the the multiple apps to present a unifiend view in a Portal or Intranet.

Thursday, February 10, 2011

Service Oriented Architectures (SOA)

SOA describes an information technology architecture that enables distributed computing environments with many different types of computing platforms and applications. Web services in asp net are one of the technologies that help make SOAs possible. As a concept, SOA has been around since the 1980s, but many early IT technologies failed to achieve the goal of linking different types of applications and systems. By making early investments with .NET, Microsoft has helped provide the building blocks that today are putting many enterprise customers on the path to successfully implementing SOAs. With SOAs, companies can benefit from the unimpeded flow of information that is the hallmark of connected systems.

Functioning of Web Services Protocols

Http-Get:- This is standard protocol that helps client to communicate with server with HTTP.When client send a request to server via HTTP request and reuired parameter are attached with the querystring.Example:-http://www.zuhaibhyder.blogspot.com/dotnet/login.aspx?id=zuhaib&pwd=abc and we get the value from querystring.Request.querystring("id")Request.querystring("pwd").
Http-Post:-This is same as Http-Get but the diffrence is that in place of sending parameters onto the URL information is send with HTTP request message with some extra information which contains Parameters and their values.This Protocols is limited to sending name/value pairs.
SOAP:-The only diffrence is that its relies on the XML as compares to Http-Get,Http-Post.SOAP can send not only the name/value pairs but also some complex object also as for example datatypes,class,objects.SOAP can also uses request/reponse model as Http-Get,Http-post but it is not limited to Request/Response it can also send types of message.Because its uses XML that is pure text so firewalls not created so much problem because its easily converted in to HTML.

Three-Tier Architecture

The three-tier architecture was comes into existence to improve management of code and contents and to improve the performance of the web based applications.There are mainly three layers in three-tier architecture.the are define as follows
1. Presentation
2. Business Logic
3. Database

1. First layer Presentation contains mainly the interface code, and this is shown to user. This code could contain any technology that can be used on the client side like HTML, JavaScript or VBScript etc.
2. Second layer is Business Logic which contains all the code of the server-side .This layer have code to interact with database database and to query, manipulate, pass data to user interface and handle any input from the UI as well.
3. Third layer Data represents the data store like MS Access, SQL Server, an XML file, an Excel file or even a text file containing data also some addtional database are also added to that layers.

Dot net questions

What is Heap?A portion of memory reserved for a program to use for the temporary storage of data structures whose existence or size cannot be determined until the program is running.

What is Garbage Collection? How it works in Dot Net Framework?
Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. Garbage Collection, which runs in the background collecting unused object references, freeing us from having to ensure we always destroy them. The garbage collector (GC) in .NET works without intervention of the developer ie. a developer does not have to track memory usage and worry about when to free memory. The Microsoft .NET CLR (Common Language Runtime) requires that all resources be allocated from the managed heap. The managed heap-objects are automatically freed when they are no longer needed by the application. GC in .Net is not deterministic that is, the .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are destroyed and the memory is freed up.

Some Dot Net Questions

1. What does the "EnableViewState" property do?EnableViewState stores the current state of the page and the objects in it like text boxes, buttons, tables etc. So this helps not losing the state between the round trips between client and server. But this is a very expensive on browser. It delays rendering on the browser, so you should enable it only for the important fields/objects.

2. What is the difference between Server.Transfer and Response.Redirect?
Server.Transfer transfers the currnet context of the page to the next page and also avoids double roundtrips. Where as Response.Redirect could only pass querystring and also requires roundtrip.

3. Whats an assembly?
An assembly is the primary building block of .NET. It's a reusable, self-describing,versionable deployment unit for types and resources. They are self-describing so to allow the .NET runtime to fully understand the application and enforce dependency and versioning rules.

4. What base class do all web forms inherit from?
System.web.UI.Page class. But for UserControl its System.Web.UI.UserControl

5. what method do you use to explicitly kill a users session?
Session.Abandon

AJAX Basics

ASP.NET AJAX enables you to take full advantage of the capabilities of the browser to deliver richer Web experiences that work on any modern browser
ASP.NET AJAX enables ASP.NET developers to enrich their existing Web applications with incredible ease

ASP.NET AJAX makes it possible to easily take advantage of AJAX techniques on the Web and enables you to create ASP.NET pages with a rich, responsive UI, and server communication. However, ASP.NET AJAX isn’t just for ASP.NET development. You can take advantage of the rich client framework to easily build client-centric Web applications that integrate with any backend data provider.

How AJAX works.....

So here is AJAX architecture for your better understandig..

AJAX - What's the buzz all about?

In the era of high-tech words buzzing around - there is a chance you might have come across AJAX. Surely, AJAX is one of the technologies that are being widely adopted and used. At first glance, you might be thinking:

What is AJAX?

I am not just going to say it stands for Asynchronous Javascript And XML... If you have worked over web applications (or atleast have used one), for each dynamic content to be fetched from web server, you need to make a call to a specific page. The call (or request) in return, sends you a complete page (response). Traditionally, it would refresh or reload a webpage for each new request. Simply put forward, you click a link, you make a request and you wait for the server to respond. This is called the "call-and-response" interaction model. AJAX, as a down-to-earth intro, is a technique in which your web application interacts with your web server - 'behind the scenes'. This means, while you are viewing a web-page - it is 'silently' posting and retrieving data from the webserver without letting you know (i.e. without refreshing the page). This is the AJAX-way of interacting.

why are we so hearing about ajax these days?

Well, the basic fact, AJAX is a 'technique', and not a 'new' tool. The technique is based on simple JavaScript and XML usage - which has been around since 1997-98. This approach has recently came in a more wider 'public' view after it was used 'extensively' in G-mail (an ajax-based web-mail client)

Conclusion


AJAX makes applications behave similar to that of a desktop application. A bridge between web-apps and desktop-apps, you might say. With javascript and xml combined, possibilities are end-less - which are yet to be exploited to its fullest.

Dot net architecture in depth

Here is more descriptive architecture

ASP.net Architecture

This section provides an overview of the ASP.NET infrastructure and subsystemrelationships, as they relate to the subject of security. The following illustration shows the relationships among the security systems in ASP.NET.


As the illustration shows, all Web clients communicate with ASP.NET applications through IIS. IIS deciphers and optionally authenticates the request. If Allow Anonymous is turned on, no authentication occurs. IIS also finds the requested resource ( such as an ASP.NET application ), and, if the client is authorized, returns the appropriate resource.
In addition to the built-in ASP.NET security features, an ASP.NET application can use the low-level security features of the .NET Framework.
Integrating with IIS
This release of ASP.NET uses IIS 5.0 as the primary host environment. When considering ASP.NET authentication, you should understand the interaction with IIS authentication services.
IIS always assumes that a set of credentials maps to a Windows NT account and uses them to authenticate a user. There are three different kinds of authentication available in IIS 5.0: basic, digest, and Integrated Windows Authentication ( NTLM or Kerberos ). You can select the type of authentication to use in the IIS administrative services.
If you request a URL containing an ASP.NET application, the request and authentication information are handed off to the application.