Build Your Own ASP.NET 4 Website Using C# & VB Chapter 1: Introducing ASP.NET and the.net Pla;orm
Outlines IntroducIon What is ASP.NET? Advantages of ASP.NET Installing the Required SoOware WriIng your first ASP.NET page
IntroducIon ASP.NET is one of the most popular web development technologies on the planet. The first version was released in 2002, and since then, Microso> has con?nued the tradi?on of releasing a powerful web development framework that allows web developers to do more with less.
IntroducIon (Cont.) ASP.NET has experienced rapid growth among the established corporate world, as well as becoming the choice for many freelance developers.
IntroducIon (Cont.) ASP.NET has many advantages: Well- established IDE (Integrated Development Environment) called Microso> Visual Studio. Advanced security and performance frameworks that handle many of the mundane tasks automa?cally on the server side.
IntroducIon (Cont.) ASP.NET lets you write web applica?ons in a variety of familiar programming languages. We will focus only on the two most popular.net languages, Visual Basic.NET (o>en referred to simply as VB.NET or VB) and C# (pronounced See- Sharp ).
IntroducIon (Cont.) ASP.NET 4 (now 5) is the latest itera?on in the.net framework. Introducing many new features that build upon its predecessor to improve performance, security, and interoperability with the latest browsers. It comes available with new development tools.
What is ASP.NET? ASP.NET is a sophis?cated and powerful web development framework. Development with ASP.NET requires not only an understanding of HTML and web design, but a firm grasp of the concepts of object oriented programming and development. ASP.NET is a server- side technology for developing web applica?ons based on the Microso>.NET Framework
In the case of ASP.NET, the code in the page is read by the server and used to generate the HTML, JavaScript, and CSS, which is then sent to the browser. A server- side technology: it runs on the web server. Client- side technology: such as HTML, JavaScript, and Cascading Style Sheets (CSS) it runs on the web browser. When a web browser requests a web page created with only client- side technologies, (front page) the web server simply grabs the files that the browser (or client) requests and sends them the Clint web browser. The client is en?rely responsible for reading the markup in those files and interpre?ng that markup to display the page on the screen.
What is ASP.NET? (Cont.) User The transac?on starts and ends with the user. The user operates on the web client so>ware and interprets the results. Web client This is the so>ware program that the person uses to interact with the web applica?on. The client is usually a web browser, such as Internet Explorer or Firefox. Web server This is the so>ware program located on the server. It processes requests made by the web client.
What is ASP.NET? (Cont.) ASP.NET is a technology for developing web applica?ons A web applica?on is dynamic in nature, and o>en considered to be a web version of standard desktop so>ware. Google Mail is an excellent example of a web applica?on. Web applica?ons usually (but not always) store informa?on in a database, and allow visitors to the site to access and change that informa?on. Many different programming technologies and supported languages have been developed to create web applica?ons such as PHP and JSP.
What is ASP.NET? (Cont.) ASP.NET uses the MicrosoB.NET Framework. The.NET Framework collects all the technologies needed for building Windows desktop applica?ons, web applica?ons, web services, and so on into a single package, and makes them available to many programming languages.
Advantages of ASP.NET ASP.NET lets you write the server- side code using your favorite programming language or at least the one you prefer from the long list of supported languages. The.NET Framework currently supports over 40 languages, and many of these may be used to build ASP.NET websites. ASP.NET pages are compiled, not interpreted. This allows a big jump in performance, compared to the old days of ASP.
Advantages of ASP.NET (Cont.) ASP.NET allows you to separate the server- side code in your pages from the HTML layout. When you re working with a team composed of programmers and design specialists, this separa?on is a great help, as it lets programmers modify the server- side code without stepping on the designers carefully cra>ed HTML and vice versa.
Advantages of ASP.NET (Cont.) ASP.NET makes it easy to reuse common User Interface elements in many web forms. You can get excellent tools that assist in developing ASP.NET web applica?ons. Security mechanisms such as membership roles and logins, as well as SQL Injec?on aback preven?on, are automa?cally enabled out- of- the- box with an ASP.NET web app.
Installing the Required SoOware (page 6-11) Visual Web Developer 2010 Express EdiIon This is a powerful, free web development environment for ASP.NET 4.0. It includes features such as a powerful code, HTML and CSS editor, project debugging, IntelliSense (Microso> s code autocomple?on technology), database integra?on with the ability to design databases and data structures visually, and much more.
Installing the Required SoOware (page 5-11).NET Framework 4 and the.net Framework SoOware Development Kit (SDK) As we ve already discussed, the.net Framework drives ASP.NET. You re likely to have the.net Framework already, as it installs automa?cally through the Windows Update service. Otherwise, it ll be installed together with Visual Studio. MicrosoO SQL Server 2008 R2 Express EdiIon This is the free, but s?ll fully func?onal, version of SQL Server 2008. This so>ware is a Rela?onal Database Management System whose purpose is to store, manage, and retrieve data as quickly and reliably as possible SQL Server Management Studio Express Because the Express Edi?on of SQL Server doesn t ship with any visual management tools, you can use this free tool, also developed by Microso>, to access your SQL Server 2008 database.
Demo - WriIng Your First ASP.NET Page
WriIng Your First ASP.NET Page Web Server Control
WriIng Your First ASP.NET Page The Label control is one of the simplest controls in.net, which lets you insert dynamic content into the page. The asp: part of the tag name iden?fies it as a built- in ASP.NET tag. <asp:label/> is probably one of the most frequently used. The runat="server" abribute value iden?fies the tag as something that needs to be handled on the server.
WriIng Your First ASP.NET Page
C# version contains a defini?on for a method called Page_Load. This is the method that executes automa?cally when the project is executed, and we want to use it to write the code that will display the current?me inside the Label control.
public par?al class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { mytimelabel.text = DateTime.Now.ToString(); } }
WriIng Your First ASP.NET Page
Html source code returned to the client (i.e. browser)
Your Task for Today Please download and install VS from the link provided in the website. Contact your lecturer or lab instructor in case you come across any problems. Also, download the ASP.NET book and study from it. The slides are just to guide you through the content.