Tuesday, November 3, 2015

Module I ASP.NET 4.5 Lecture 1

Browser Server Communication 

1- User types URL ()/Clicks Hyper link etc, Browser Sends request to that address using Http
2- If the server is active it accepts the request
3- If the requested resource is HTML or image the server reads the file from local drive and sends it to browser
4- If the resource is a dynamic file such as aspx, the server checks Application Mapping/Handler Mapping to determine the piece of code required to execute this file.
5- The file is then execute and output is sent to browser.

Contents of ASPX File

An ASPX file contains 
- Static HTML, Javascript or CSS. These are sent directly to the browser
- ASP.NET Server control,. These controls are placed in your ASPX page and when they are processed, they emit HTML that is inserted in the page
- Programming Code, You can embed code, like Visual Basic .NET or C#, directly in a page. In addition, you can place code in a separate code file (Code Beside/Code Behind). This code can be executed by runtime automatically or in response to a particular event like Button_Click or Page_Load 

New Project Vs New Web Site

Visual Studio allows you to choose between a website and a web application
Web Site Projects 
- Suitable when a single person is doing work
- It is made of a folder in which a number of files are stored. All files in the folder are considered to be part of project
- Deployment is easy as it involves simply making a folder available to webserver
- Updates can be made by simply copying the file on the server

Web Application Projects 
- Suitable when a team of people are working on a single web site 
- Is compatible with tools that manages versioning like Team Foundation Server
- Maintains a proj file which records the contents of the application and developers have more control over compilation and deployment
- Has support for Technologies like MVC and WebAPI

Four Main Development Frameworks Supported by ASP.NET

ASP.NET Web Forms
- Allows declarative and control-based programming using Microsoft Windows Forms (WinForms) and WPF/XAML/Silverlight. 
- WYSIWYG (What you see is what you get) designer-driven development model
- Suitable for rapid application development (RAD) - Enables programmers to develop web applications without getting command on other web related technologies like HTML and javaScript

Development is based on patterns and principles like testdriven development, separation of concerns, inversion of control (IoC), and dependency injection (DI). 
Encourages separating the business logic layer of a web application from its presentation layer. 

ASP.NET Web Pages
Development is done in similar way as it is done in other web technologies like PHP. 
HTML pages are created and then server-based code is added to the page in order to dynamically control how that markup is rendered. 
A lightweight framework 

ASP.NET Single Page Applications (SPA)
Applications that include significant client-side interactions using HTML 5, CSS 3 and JavaScript. 
Uses knockout.js and ASP.NET Web API.  community-created SPA templates are also available for download

Starting With ASP.NET 

Getting Started with Basics
- Create a new Web Site by Selecting File -> New Web Site 
- Choose Empty Website from List of Templates
- Specify a name for the site and Press Save
- Select Website -> Add New Item 
- In the Add New Item Dialog, Choose Visual C#, select Webform and then press add

As a result of the above, you can find a new file added under the website in Solution Explorer

Designing the page using WYSIWYG (Design View)
- Select Design from the bottom
- Select View -> Toolbars and make sure Formatting toolbar is selected. 
- Write any text on the page and use "B" or "I" on the formattint toolbar to add and tags

The Formatting toolbar can be used to add some basic HTML tags to the page. A list of tags is also provided in block format dropdown from which you can choose Headings, List and other HTML elements

The formatting toolbar provides similar interface as that of MS Word but adds HTML and CSS in the source of the page. 

The Style of Bullets and numbering can be modified using the Format -> Bullets and Numbering menu

Table can be inserted using  Table -> Insert Table. This will cause the "Insert Table" Dialog to be opened where the programmer can specify the Rows, columns and other settings 

If the borders of the table are not visible, select Visible Borders from View -> Visual Aids

Saturday, November 3, 2012

Changing TargetFramework of ASP.NET project in VB

I recently faced a situation where we had to run one project on server running .NET 2.0. The project was ASP.NET application using VB.NET.

In C# you easily find the targetframework option in the applications tab of properties dialogbox but in VB.NET i was struggling to find that

Later on I found that you can go to project properties -> Compile -> Advance Compile Options where the target framework option can be found

Tuesday, August 7, 2012

Introduction to Web Applications (MAJU Fall 2012)

Learning Objective:
To introduce Web Applications in simplist terms and to introduce the key players involved

What are web applications?
Simplist definition:Stored on a server and accessed via A Web Browser

Whats the advantage?
- Code resides at a single place
- Clients need no installation therefore there is no need of high processing and memory capabilities at client end
- Incase new feature needs to be coded then update is required at the server only. In other words maintenance is easy

Why Study Web Application?
- Due to easy maintenance companies donot hestiate to chose web based solutions
- Requires less processing power at the client end
- Can be very easily made available over the internet so that remote users can also use the application

Entities Involved
- Web Browser
- Web Server
- Database Server (optional)

Web Browser: Has the responsibility of displaying the output to the end user

Web Server:
Has the responsibility of processing the request of user and preparinng the response

Database Server:Stores the data that is important to users

To understand the role of each lets take example of restaurant and compare it with Web Applications:
-You give your order to the waiter
-In web application you place request on web browser
-The waiter takes the order to the cook
-The browser sends the request to server
-The cook reads the order and prepares dishes
-The webserver reads the request and prepares response
- To prepare the dishes the cook obtains ingrediants from the server
- To prepare the response server obtains data from Database Server
- The cook gives the prepared dishes to the waiter
- The Server sends the prepared response to the browser
- The Waiter brings the dishes to you
- The browser displays the prepared response to you

Communication Between Browser and Server- The scenario of Browser and Server is more complex than that of Waiter and Cook. Both Waiter and Cook belong to the same restaurant, but browser and server and normally made by different companies
- If browser of each company applies a different set of rules to ensure successfull transit of data to server then developing a server will become a very complex task as server will have to have knowledge of varying rules of each browser
- Similary if server made by each company applies different set of rules to send respone then making browsers will become very difficult
- The solution is to have a standard set of rules that all browsers and servers use. This standard set of rules is known as Hyper text Transfer protocol
- Similary the contents of the response contain a standard language which Hyper text markup language

Friday, February 24, 2012

Mapping ER Models into Relations (For Students of Database Systems)

I was about to write something on this topic but found a resource that contains the contents I was willing to discuss.
Do visit the link below and get the copy of material for future reference

Friday, January 6, 2012

Database Systems Lecture 1 & 2 (MAJU Spring 2012)

Topics of the Lesson:
• Introduction of Database
• File-based systems
• Database management systems
• Comparison between File-based system and Database management systems

Functions of DBMS
Introducing Database:
The simplest definition is given by Date (1999, p. 2) according to which Database is a
collection of computerized data files. In simple words it is computerized
record keeping.

Examples of Database Applications
• Purchases from the supermarket
• Purchases using your credit card
• Booking a holiday at the travel agents
• Using the local library
• Taking out insurance
• Using the Internet
• Studying at university

File-based Systems
• Collection of application programs that perform services for the end users (e.g. reports).
• Each program defines and manages its own data
• E.g. is a C++ system that accepts and stores data. In such case the sequence in which the fields are recorded is coded in the program, not in the file.

Limitations of File-Based Approach

• Separation and isolation of data
– Each program maintains its own set of data.
– Users of one program may be unaware of potentially useful data held by other programs.
– Duplication of data
– Same data is held by different programs.
– Wasted space and potentially different values and/or different formats for the same item.

• Duplication of data
– Same data is held by different programs.
– Wasted space and potentially different values and/or different formats for the same item.

Database Approach

• Arose because:
– Definition of data was embedded in application programs, rather than being stored separately and independently.
– No control over access and manipulation of data beyond that imposed by application programs.

– the database and Database Management System (DBMS).

Formal definition of Database
• Shared collection of logically related data (and a description of this data), designed to meet the information needs of an organization.
• System catalog (metadata) provides description of data to enable program–data independence.
• Logically related data comprises entities, attributes, and relationships of an organization’s

Database Management System (DBMS)
• A software system that enables users to define, create, and maintain the database and that provides controlled access to this database.
• Allows each user to have his or her own view of the database.
• A view is essentially some subset of the database.

Functions of Database Management System
· Provide Security
· Data Integrity
· Provide controlled concurrency
· Reduced data redundancy
· Crash Recovery
· Backup and Recovery

Friday, August 12, 2011

Introduction to WIX (Windows Installer XML)

Recently I have got an opportunity to work on creating installers for some of our products. In past I never got involved in post development activities but during my current job I spent some time in development related to deployment.
I have discovered there is a whole world out there to explore. Even the tip of the ice berg is quite vast.
Initially I created installers based on MSI technology using Visual Studio. However, I experienced that the approach was not friendly when it come to incorporate some product changes in installer. This is because we need to recompile the entire project and subsequently do some changes to resultant installer via orca. Addition/updation is a very common requirement in the web-based products we sell. For example, sometimes there is a small change like css update of an image/icon changes. This approach, which I was using required someone to rebuild the Visual Studio project which implies that visual studio is present on the machine. In addition, another dependency exists in the form of a person who knows visual studio and has some experience of creating installers.
Eventually a need of such an approach was felt which could free us from such dependencies.
The research resulted in the discovery of Microsoft WIX (Windows Installer Xml). WIX which is based on MSI technology allows us to descriptively create installers using XML files. There are tools through which people only specify the folders that need to be part of the installer and facilities are available to almost do whatever that is necessary while creating installer. Plug-ins are also available to integrate WIX with visual studio.
However, it must be kept in mind that the learning curve is quite steep. To facilitate people who are interested in learning WIX, I am listing some of the resources that I found useful. I will be adding some more resources to the list after filtering the collection I have

Creating WIX Installer for ASP.NET Web Application

From MSI to WiX

WIX Tutorial

Logging in IIS 7

Location of Log file:

Pre-Requisite of Logging:
On Windows Server 2008 R2, following role service must be installed (In other Windows OS the following module must be enabled)
• Http Logging

Enabling and Disabling Logging:

If the pre requisite is installed the “Logging Icon” will appear in the “IIS” category of IIS Manager ([Server] Home Screen)
By default it is enabled, however it can be disabled or other configuration can be changed