Docsity

ASP.NET: web programming, Apuntes de Programación Informática

Vista previa parcial del texto

¡Descarga ASP.NET: web programming y más Apuntes en PDF de Programación Informática solo en Docsity!

University College of Southeast Norway

http://home.hit.no/~hansha

ASP.NET

Web Programming

Hans-Petter Halvorsen, 2016. 11. 01

1 Introduction ASP.NET is a framework for creating web sites, apps and services with HTML, CSS and JavaScript. 1.1 Visual Studio Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It can be used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all platforms supported by Microsoft Windows, Windows Phone, Windows CE, .NET Framework, .NET Compact Framework and Microsoft Silverlight. Below we see the integrated development environment (IDE) in Visual Studio: New projects are created from the “New Project” window:

5 Introduction 1.2 C# C# is pronounced “see sharp”. C# is an object-oriented programming language and part of the .NET family from Microsoft. C# is very similar to C++ and Java. C# is developed by Microsoft and works only on the Windows platform. 1.3 .NET Framework The .NET Framework (pronounced “dot net”) is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allow language interoperability (each language can use code written in other languages). The .NET library is available to all the programming languages that .NET supports. Programs written for the .NET Framework execute in a software environment, known as the Common Language Runtime (CLR), an application virtual machine that provides important services such as security, memory management, and exception handling. The class library and the CLR together constitute the .NET Framework. 1.4 Object-Oriented Programming (OOP)

2 Visual Studio 2.1 Introduction Home page of Visual Studio: http://www.microsoft.com/visualstudio There exist different versions of Visual Studio, such as Visual Studio Express (free), Visual Studio Professional, Visual Studio Premium and Visual Studio Ultimate. 2.2 Getting Started

2.2.1 Integrated Development Environment (IDE)

The Visual Studio product family shares a single integrated development environment (IDE) that is composed of several elements: the Menu bar, Standard toolbar, various tool windows docked or auto-hidden on the left, bottom, and right sides, as well as the editor space. The tool windows, menus, and toolbars available depend on the type of project or file you are working in. Below we see the Visual Studio IDE (Integrated Development Environment):

8 Visual Studio

2.2.2 New Project

The first thing you do when you want to create a new application is to create a new project. This can be done from the Start Page: Or from the File menu: Then the “New Project” window appears:

10 Visual Studio The Toolbox contains all the controls, etc. we can use in our user interface. In order to use them in our user interface, we just drag and drop them to the “Form”, as shown below:

2.2.5 Editors and Designers

Visual Studio has different editors and design tools. Graphical User Interface Designer:

11 Visual Studio Code Editor:

2.2.6 Properties window

Each control we have on our user interface has lots of Properties we can set. This is done in the Properties window:

3 Introduction to Web Programming 3.1 Introduction Today most of the applications focus on the Internet, where the applications can be viewed in a standard Web Browser. Static Web pages are based on HTML and CSS. In order to create more advanced applications, we need more powerful tools. A useful web site for learning more about web development: http://www.w3schools.com Important frameworks and tools for creating dynamic web pages:

  • ASP.NET
  • AJAX/ ASP.NET AJAX
  • JavaScript

14 Introduction to Web

  • Silverlight These frameworks and tools will be explained below. 3.2 Web Browser The purpose of a web browser is to read HTML documents and compose them into visual or audible web pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page. Today we have the following major Web Browsers:
  • Internet Explorer (by Microsoft)
  • Firefox (by Mozilla)
  • Chrome (by Google)
  • Safari (by Apple)
  • Opera (by Opera from Norway) 3.3 HTML HTML, which stands for HyperText Markup Language, is the predominant markup language for web pages. HTML is the basic building-blocks of webpages.

16 Introduction to Web

A useful web site for learning more about JavaScript: http://www.w3schools.com/js 3.6 ASP.NET ASP.NET is a web application framework developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. ASP.NET is part of the Visual Studio package. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language, such as C# and VB.NET. ASP.NET web pages or webpage, known officially as Web Forms], are the main building block for application development. Web forms are contained in files with an “.aspx” extension. 3.7 AJAX/ ASP.NET AJAX **AJAX** is an acronym for Asynchronous JavaScript and XML. AJAX is a group of interrelated web development methods used on the client-side to create interactive web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. **ASP.NET AJAX** is a set of extensions to ASP.NET developed by Microsoft for implementing AJAX functionality. 3.8 Silverlight Microsoft Silverlight is an application framework for writing and running browser plug-ins or other rich internet applications, with features and purposes similar to those of Adobe Flash. The run-time environment for Silverlight is available as a plug-in for most web browsers. Silverlight is also one of the two application development platforms for Windows Phone 7/8. The latest version is Silverlight 5 .0.

17 Introduction to Web Silverlight is based on WPF, so in Silverlight applications, user interfaces are declared in Extensible Application Markup Language (XAML) and programmed using a subset of the .NET Framework.

19 Introduction to ASP.NET Video: http://www.asp.net/aspnet/overview/making-websites-with-aspnet/making-websites-with-aspnet New Web Project Dialog: Select Project Name, Loction and Solution Name. Next, seelct the template you want to use.

20 Introduction to ASP.NET 4.2 ASP.NET Web Pages In ASP.NET Web Pages you include server code directly into the HTML syntax, similar to PHP and Classic ASP. ASP.NET Web Pages uses Singe Page Model (The server-side code is mixed in between the HTML). It uses the the Razor syntax (.cshtml files) A tool called Microsoft WebMatrix is optimized for this development model, but you can also use Visual Studio if you want to. http://www.w3schools.com/aspnet 4.3 ASP.NET SPA SPA – Single Page Application For more information: http://www.asp.net/single-page-application 4.4 ASP.NET MVC MVC – Model - View – Controller