Wednesday, September 18, 2013

Difference Between Forms Authentication and Windows authentication


Forms Authentication

·         Forms Authentication is a process to allow only authenticated user with valid credential to view a particular page or group of pages/folders and stop unauthenticated or anonymous user outside the secure boundary.

·         It’s mainly to protect the particular folder or page from the group of user or particular user. Form authentication stores all the user details inside a cookie.

·         User details consist of the User roles, User name. However the page is disable cookies function, then it works by passing all the values in Query string.

Windows authentication

·         Windows authentication is the default authentication method of the ASP.NET application. Windows authentication it will use local windows user and groups to do authentication and authorization for your ASP.NET pages. Web application can use the same security that applies to your windows application which will authenticate to your window like user names, passwords, and permissions. Mainly used for intranet application.

·         In order to use windows authentication, you need to make sure your web application's hosting and client user's machine meet the requirements. Generally, both the client and server machines should be in the same local network environment, and they should be part of the same Windows domain (or trusted domain).

Difference Between Authentication and Authorization


Wednesday, April 17, 2013

Difference between C and C++

C++, as the name suggests, is a superset of C. As a matter of fact, C++ can run most of C code while C cannot run C++ code.

1. C follows the procedural programming paradigm while C++ is a multi-paradigm language(procedural as well as object oriented)
In case of C, importance is given to the steps or procedure of the program while C++ focuses on the data rather than the process.
Also, it is easier to implement/edit the code in case of C++ for the same reason.
2. In case of C, the data is not secured while the data is secured(hidden) in C++
This difference is due to specific OOP features like Data Hiding which are not present in C.
3. C is a low-level language while C++ is a middle-level language (Relatively, Please see the discussion at the end of the post)
C is regarded as a low-level language(difficult interpretation & less user friendly) while C++ has features of both low-level(concentration on whats going on in the machine hardware) & high-level languages(concentration on the program itself) & hence is regarded as a middle-level language.
4. C uses the top-down approach while C++ uses the bottom-up approach
In case of C, the program is formulated step by step, each step is processed into detail while in C++, the base elements are first formulated which then are linked together to give rise to larger systems.
5. C is function-driven while C++ is object-driven
Functions are the building blocks of a C program while objects are building blocks of a C++ program.
6. C++ supports function overloading while C does not
Overloading means two functions having the same name in the same program. This can be done only in C++ with the help of Polymorphism(an OOP feature)
7. We can use functions inside structures in C++ but not in C.
In case of C++, functions can be used inside a structure while structures cannot contain functions in C.
8. The NAMESPACE feature in C++ is absent in case of C
C++ uses NAMESPACE which avoid name collisions. For instance, two students enrolled in the same university cannot have the same roll number while two students in different universities might have the same roll number. The universities are two different namespace & hence contain the same roll number(identifier) but the same university(one namespace) cannot have two students with the same roll number(identifier)
9. The standard input & output functions differ in the two languages
C uses scanf & printf while C++ uses cin>> & cout<< as their respective input & output functions
10. C++ allows the use of reference variables while C does not
Reference variables allow two variable names to point to the same memory location. We cannot use these variables in C programming.
11. C++ supports Exception Handling while C does not.
C does not support it “formally” but it can always be implemented by other methods. Though you don’t have the framework to throw & catch exceptions as in C++.

Difference Between Namespace and Assembly


Assembly will contain Namespaces, Classes, Data types it's a small unit of code for deployment. Assembly defines the name of the .dll file.

Namespace is used in order to avoid conflict of user defined classes.
Namespace:
1) it is a Collection of names wherein each name is Unique.
2) They form the logical boundary for a Group of classes.
3) Namespace must be specified in Project-Properties.
Assembly:
1) It is an Output Unit.
2) It is a unit of Deployment & a unit of versioning.
3) Assemblies contain MSIL code.
4) Assemblies are Self-Describing. [e.g. metadata,manifest]
5)An assembly is the primary building block of a .NET Framework application.
6) It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files).
7) All managed types and resources are marked either as accessible only within their implementation unit, or by code outside that unit.

Differences between method overloading and method overriding

Method Overloading
Method Overriding
Definition
In Method Overloading, Methods of the same class shares the same name but each method must have different number of parameters or parameters having different types and order. In Method Overriding, sub class have the same method with same name and exactly the same number and type of parameters and same return type as a super class.
Meaning
Method Overloading means more than one method shares the same name in the class but having different signature. Method Overriding means method of base class is re-defined in the derived class having same signature.
Behavior
Method Overloading is to “add” or “extend” more to method’s behavior. Method Overriding is to “Change” existing behavior of method.
Overloading and Overriding is a kind of polymorphism.Polymorphism means “one name, many forms”.
Polymorphism
It is a compile time polymorphism. It is a run time polymorphism.
Inheritance It may or may not need inheritance in Method Overloading. It always requires inheritance in Method Overriding.
Signature In Method Overloading, methods must have different signature. In Method Overriding, methods must have same signature.
Relationship of Methods In Method Overloading, relationship is there between methods of same class. In Method Overriding, relationship is there between methods of super class and sub class.
Criteria
In Method Overloading, methods have same name different signatures but in the same class. In Method Overriding, methods have same name and same signature but in the different class.
No. of Classes
Method Overloading does not require more than one class for overloading. Method Overriding requires at least two classes for overriding.
Example
Class Add
{
   int sum(int a, int b)
   {
     return a + b;
   }
  int sum(int a)
  {
    return a + 10;
   }
}
Class A  // Super Class
{
  void display(int num)
  {
     print num ;
   }
}
//Class B inherits Class A
Class B //Sub Class
{
  void display(int num)
  {
     print num ;
   }
}

Difference between response.redirect and server.transfer

Respose.redirect
---------------------------------------------------
  • Respose.redirect can use another appliaction url.
  • It has round trip.
  • Its much slower than server.transfer.
  • Here also the data can pass through server variables and query string. It simply redirect the page from one page to another.
  • Eg: Response.Redirect("Default.aspx")
Server.transfer
---------------------------------------------------
  • In server.transfer we can use with in that application only.
  • It has not round trip.
  • it has faster than response.redirect
  • The main advantage of this transfer the first page to second page with better performance. The data can pass through variables, query string and also can retrive from the previous page control value.
        Eg: Server.Transfer("Default.aspx");

NOTE :By the way according to the requirement we can transfer one page to another page.

Tuesday, April 16, 2013

Difference between a Label and Literal control in asp.net

Lable
System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Label
<asp:Label ID="lblFirstName" runat="server" CssClass="myCssClass"Text="First Name" />
Literal
System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.Literal 
<asp:Literal id="litFirstName" runat="server" Text="First Name" />
Now, bind your controls with some text :-
lblFirstName.Text = "text";
litFirstName.Text = "text";

Output will be show html of page run-time

<span id="lblFirstName">text</span>
<br />
text
------------------------------------------------------------------------------
we see that the label text is wrapped around a span tag and the literal text is simply putting a text in it. 
label control has much more properties than the literal control, so choose wisely.