Saturday, September 7, 2019

IIS -InterNet Information Service

Internet Information Server:



Internet Information Server (IIS) is one of the most popular web servers from Microsoft that is used to host and provide Internet-based services to ASP.NET and ASP Web applications. A web server is responsible for providing a response to requests that come from users. When a request comes from client to server IIS takes that request from users and process it and send response back to users.


Internet Information Server (IIS) has it's own ASP.NET Process Engine to handle the ASP.NET request. The way you configure an ASP.NET application depends on what version of IIS the application is running on.



Application Pooling:


Application Pools are logical groupings of web applications that will execute in a common process, thereby allowing greater granularity of which programs are grouped together in a single process. For instance, if you wanted every Web Application to execute in a separate process, you simply create an Application Pool for each application. The Application Pool is the heart of a website. Application Pools enable us to isolate our Web Application for better security, reliability and availability.



Application Pool




The worker process serves as the process boundary that separates each Application Pool so that when a worker process or application is having an issue or recycles, other applications or worker processes are not affected.



Web Garden and Web Farmimg:

A Web Garden is a site configured to run within multiple processes on a single server. You can still have multiple servers configured in a web farm, but the Web Garden reflects the configuration of a specific individual server. Now I am explaining how to deploy a Web Site on IIS.



Advantage of Application Pool
  1. If we deploy an application in one worker process and it is running and another Application Pool's Web Application is also running and if it has any other problem then it will not be affected by other Application Pool's Web Application.
  2. Deploying an applications to multiple Application Pools enable us to achieve the degree of application isolation that we need, in terms of availability and security.



Web Farm

This is the case where you have only one web server and multiple clients requesting for resources from the same server. But when are is huge amount of incoming traffic for your web sites, one standalone server is not sufficient to process the request. You may need to use multiple servers to host the application and divide the traffic among them. This is called “Web Farm”. So when you are hosting your single web site on multiple web servers over load balancer is called “Web Farm”. The below diagram shows the overall representation of Web Farms.

Web Farms


Web garden

Just to recall, when we are talking about requesting processing within IIS, Worker Process (w3wp.exe) takes care of all of these. Worker Process runs the ASP.NET application in IIS. All the ASP.NET functionality inside IIS runs under the scope of worker process. Worker Process is responsible for handling all kinds of request, response, session data, cache data. Application Pool is the container of worker process. Application pool is used to separate sets of IIS worker processes and enables a better security, reliability, and availability for any web application.
apppools

Now, by default, each and every Application pool contains a single worker process. Application which contains the multiple worker process is called “Web Garden”.










compare Get and Post

 GETPOST
BACK button/ReloadHarmlessData will be re-submitted (the browser should alert the user that the data are about to be re-submitted)
BookmarkedCan be bookmarkedCannot be bookmarked
CachedCan be cachedNot cached
Encoding typeapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded or multipart/form-data. Use multipart encoding for binary data
HistoryParameters remain in browser historyParameters are not saved in browser history
Restrictions on data lengthYes, when sending data, the GET method adds the data to the URL; and the length of a URL is limited (maximum URL length is 2048 characters)No restrictions
Restrictions on data typeOnly ASCII characters allowedNo restrictions. Binary data is also allowed
SecurityGET is less secure compared to POST because data sent is part of the URL

Never use GET when sending passwords or other sensitive information!
POST is a little safer than GET because the parameters are not stored in browser history or in web server logs
VisibilityData is visible to everyone in the URLData is not displayed in the URL

Sunday, September 1, 2019

IS vs AS Operators in C#

is Operator:

The ‘is’ operator in C# is used to check the object type and it returns a bool value: true if the object is the same type and false if not.

For null objects, it returns false.

In other words, The “is” operator is used to check whether the run-time type of an object is compatible with a given type or not.



as Operator:

The ‘as‘ operator does the same job of ‘is‘ operator but the difference is instead of bool,
it returns the object if they are compatible to that type, else it returns null. In otherwords,
The ‘as‘ operator is used to perform conversions between compatible types.