--

...

--

...

--

...

--

...

--

....

Saturday, 26 May 2018

Cookies


Cookies

It is small amount of info stored by web server on client machine.

Types of Cookies :

  • Temperary Cookie (the info will be lost when user closes the browser or logout).
  • Permanent Cookie(persistent cookie) : the info will be stored on client machine till the time specified).

For Example

UserName
Password
protected void Button1_Click(object sender, EventArgs e)
{
     ///////////////////////// temporary cookie creation
    HttpCookie cook = new HttpCookie("vilas");
    DateTime dt = DateTime.Now;
    cook.Values.Add("currentdatetime", dt.ToString());
    cook.Values.Add("username", TextBox1.Text);
    cook.Values.Add("password", TextBox2.Text);
    Response.Cookies.Add(cook);
    Label3.Text = "temp cookie created";
}
protected void Button2_Click(object sender, EventArgs e)
{
          ///////////////////////// permanent cookie creation
          HttpCookie cook = new HttpCookie("conco");
          DateTime dt = DateTime.Now;
          cook.Values.Add("currentdatetime", dt.ToString());
          cook.Values.Add("username", TextBox1.Text);
          cook.Values.Add("password", TextBox2.Text);

          ///////////////////////// for permanant
          cook.Expires = dt.AddMinutes(10);
          // DateTime dt1=new DateTime(10,31,2014);
         // cook.Expires = dt1;
          Response.Cookies.Add(cook);
          Label3.Text = "perm cookie created";
}
protected void Button3_Click(object sender, EventArgs e)
{
          ///////////////////////// reading cookie
          HttpCookie cook = Request.Cookies["conco"];
          if (cook != null)
          {
          string dat, user, pass;
          dat = cook.Values["currentdatetime"].ToString();
          user = cook.Values["username"].ToString();
          pass = cook.Values["password"].ToString();
          Label3.Text="date time of creation of cookie is " + d + "--"+"user name is " + u + "--"+"password is " + p + "--";
          }
          else
          {
          Label3.Text = "no cookie present";
          }
}

Friday, 25 May 2018

ADO.NET


ADO.NET (ActiveX Data Objects)

.NET uses ADO.NET (Activex Data Objects) as its primary data access and manipulation protocol.

Database programming can be done thru Controls and Coding.

Database Programming can be done using MS Access, Oracle, MS SQL Server or any ODBC Complaint Database. (Open Database Connectivity).

Steps for database programming :

  • Establish connection with database using respective provider and driver.
  • Open database.
  • Store, Delete, Modify or Read data.
  • Show/Process the data
  • Close database.

Required Namespaces for Providers

ACCESS System.Data.Oledb
Oracle System.Data.OracleClient
SQL Server System.Data.SqlClient
ODBC System.Data.ODBC

Classes of respective Namespaces

ACCESS Oracle SQL Server ODBC
OleDbConnection OracleConnection SqlConnection OdbcConnection
OleDbDataAdapter OracleDataAdapter SqlDataAdapter OdbcDataAdapter
OleDbDataReader OracleDataReader SqlDataReader OdbcDataAdapter
OleDbCommand OracleCommand SqlCommand OdbcCommand
DataSet(System.Data) DataSet DataSet DataSet

Connected Database Programming :

In this type of program client is always connected with server and data is retrieved from it continuously. If you close the connection then we can’t read data. In this type of programming we have to use SqlConnection, SqlCommand, SqlDataReader Classes.

Sequence to use classes in CONNECTED Database Programming

  1. OledbConnection
  2. OledbDataReader
  3. OledbCommand

Using TreeView Control


Treeview

To display Text in tree fashion.

  • Click on Edit Nodes or Nodes (from properties window)
  • Click on Add Root Node
  • Click on Add Child Node
  • Type Node Text in Text property,
    • Select Image File Name for ImageUrl property
    • Select file name for navigation in NavigateUrl property
    • Select True / False from Show Checkbox property
    • Select True / False from Checked property
    • Type _blank in Target property for opening the file in new window
    • Select True/False from Expanded property (for Root item).

Also we can specify SiteMap as Data Source for treeview. For this create a web.sitemap enter all the url’s which you like to use as Hyperlinks,create SiteMapDataSource using web.sitemap then specify SiteMapDataSource as DataSource for the TreeView.

Thursday, 10 May 2018

What we can Develop by using .NET


  1. C#.Net
    • Console Applications
    • Windows Applications
    • Class Libraries
    • User Defined Controls
  2. ASP.Net
    • Web Applications
    • Web Services
    • Web Controls
  3. Windows 8 APPS
    • Mobile Controls
    • Mobile Applications
  4. WCF Service Application (WCF-Windows Communication Foundation)
  5. WPF Application (Windows Presentation Foundation)
  6. WPF Browser Application
  7. Silver light Application
  8. SharePoint
  9. Cloud Computing

Sunday, 6 May 2018

What is IL Code and What is JIT ?

Q.) What is IL Code?
A.) Partially Compiled code or half compiled code.
Q.) Why is It half compiled and not fully compiled?
A.) When we compile our CODE (OS, hardware, config) compiler who converts the source code into the machine language.
When he compiles our code he takes various parameters like OS,hardware, config files.
Let us consider the code which is compiled in windows 7 and as per the situation the     properties is taken like (OS, hardware, config) and optimal code is compiled as per that environment. Now if we try to run the same application on windows 8 then it will run but it will not optimally run means the required performance benefits as compare to windows 7.
So in .NET it compiles the code and converts the code into half compiled format called as IL code. And at Run time one more entity called as JIT compiler. So the JIT comes and takes all the parameters like (OS, hardware, config) and depends on these properties and compiles the optimal code for the same movement.
So at the Run time compiler can figure out what are the parameters and compile the Optimal code as per the environment.

Q.) Who compiles the IL Code to Machine Language and how?
A.) JIT
    How : 1) Per File , 2) Per Method / Function , 3) Code Fragment and all the 3 ways are dependent on JIT which is not controlled from outside.

Q.) What are Types of JIT ?
A.) 3 Types :
    a) Normal JIT : Dynamically requires Method and Stored in Memory (RAM).
    b) Econo JIT : Dynamically and not stored in memory.
    c) Pre-JIT : Full Compilation(Ngen.exe).Native Image Generator.
Q.) How can i force my compilation to Ecnon or Normal JIT?
A.) We cannot.It is internal. If the memory is more then Normal JIT may work and if the memory is low then the Econo JIT will work. CPU power is higher then Normal JIT is Used.

Tuesday, 1 May 2018

Characteristics of C#

  1. Simple : C# simplifies C++ by eliminating irksome operators such as ->, :: and pointers. C# treats integer and Boolean data types as two entirely different types. This means that the use of = in place of == in if statements will be caught by the compiler.
  2. Consistent : C# supports an unified type system which eliminates the problem of varying ranges of integer types. All types are treated as objects and developers can extend the type system simply and easily.
  3. Modern : It is modern language due to a number of features it supports like Automatic garbage collection, Rich intrinsic model for error handling, Decimal data type for financial applications, Modern approach to debugging and Robust security model.
  4. Object-Oriented : C# is truly object-oriented. It supports all the three tenets of object-oriented systems, namely, Encapsulation, Inheritance, Polymorphism. The entire C# class model is built on top of the Virtual Object System (VOS) of the .NET framework. In C# everything is an object. There are no more global functions, variables and constants.
  5. Type-safe : It promotes robust programs. C# incorporates a number of type-safe measures.
    • All dynamically allocated objects and arrays are initialized to zero.
    • Use of any uninitialised variables produces an error message by the compiler.
    • Access to arrays are range-checked and warned if it goes out-of-bounds.
    • C# does not permit unsafe casts.
    • C# enforces overflow checking in arithmetic operations.
    • Reference parameters that are passed are type-safe.
    • C# supports automatic garbage collection.
  6. Versionable : Making new versions of software modules work with the existing applications is known as versioning. C# provides support for versioning with the help of new and override keywords. With this support, a programmer can guarantee that his new class library will maintain binary compatibility with existing client applications.
  7. Compatible : C# enforces the .NET common language specifications and therefore allows inter-operation with other .NET languages.
    • C# provides support for transparent access to standard COM and OLE automation.
    • C# also permits interoperation with C-style APIs.
  8. Flexible : Although C# does not support pointers, we may declare certain classes and methods as ‘unsafe’ and then use pointers to manipulate them. However, these codes will not be type-safe.
  9. Inter-operability: C# provides support for using COM objects, no matter what language was used to author them. C# also supports a special feature that enables a program to call out any native API.

Features of .NET

How does .NET achieve the goal

  1. Web Services (Web services are called as Health storm service through which ones data can be utilized by other people without re-entry of the data of the client). The centre of the .NET architecture.
  2. ADO.Net Datasets & XML support through out the platform (Allows access to disconnected distributed databases. It creates Dataset containing database schemas).
  3. In .NET framework common data types are defined using this data type you can share data between different applications and Microsoft has told to all the software vendors to develop compilers according to these common data types, so that their compilers become .NET Complaint.
  4. Threading is built-in.
  5. Cross language inheritance is one of the best feature of .NET.
  6. Cross language debugging is also possible.
  7. Visual Studio.NET IDE is the GUI editor for all .NET languages.
  8. Under .NET after compilation all languages will generate Intermediate Language Code (IL).
  9. No need of registration, GUIDs.
  10. Multiple versions of the same component can be run side-by-side.
  11. No “DLL Hell”.
  12. Applications will run directly from CD.
  13. Applications install only the core logic.
  14. No need to install runtime libraries.
  15. No need to copy the .dll files with the code.
  16. Object Oriented Paradigm.
    • Classes
    • Objects
    • Data Abstraction
    • Encapsulation
    • Inheritance
    • Polymorphism
    • Interfaces
  17. Common Language Runtime (CLR)
  18. Common Language Specification (CLS) - Common Language Specifications for Cross Language Implementation.
  19. Garbage Collection
  20. Interoperability
  21. Web Applications (ASP.NET)

Introduction to C# .NET

It  is  pure  object  oriented  programming  language.  Also  it  is  Event Driven Programming Language. It is case sensitive. ...