Introducing asp
Upcoming SlideShare
Loading in...5

Introducing asp






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Introducing asp Introducing asp Presentation Transcript

  • • Communication process between browser and server• Web Server / Web Browser’s Role• Understanding the role of HTTP• Creating File System , FTP, Local, Remote HTTP based websites• Anatomy of an ASPX Page• Single-File vs. Code Behind Pages• Website Compilation• Working with Web Configuration Files
  • 1. A user uses his or her Web browser to initiate a request for a Web server resource.2. HTTP is used to send a GET request to the Web server.3. The Web server processes the GET request on the server (typically locating the requested code and running it).4. The Web server then sends a response back to the Web browser. The HTTP protocol is used to send the HTTP response back to the Web browser.5. The user’s Web browser then processes the response (typically HTML and JavaScript) and renders the Web page for display to the user.
  • 6. The user may then enter data and perform an action such as clicking a submit button that causes his or her data to be sent back to the Web server for processing.7. HTTP is used to POST the data back to the Web server.8. The Web server then processes the POST request (again, calling your code in the process).9. The Web server then sends a response back to the Web browser. HTTP is used to send the HTTP response to the Web browser.10. The Web browser again processes the response and displays the Web page to the user.
  • • HTTP is a text based communication protocol that is used to request Web pages from Web Server and send the response back to browser• HTTP messages are sent between port 80 or 443• A typical command looks like this GET /default.aspx HTTP 1.1 Host
  • • The communication from browser to server is known as REQUEST and that from server to browser is RESPONSE• A Response looks like this : HTTP/1.1 200 OK Server : Microsoft-IIS /7.5 Content-Type: text/html Content-Length: 38 <html><body>Hello </body></html>
  • There are two HTTP methods that can be used to submit the formdata back to the Web server: GET and POST.When the GET verb is used, the form data is appended to the URLas part of the query string.GET /getCustomer.aspx?Id=123&color=blue HTTP/1.1Host: www.northwindtraders.comWhen the POST verb is used, the data is placed into the messagebody of the request as follows:POST /getCustomer.aspx HTTP/1.1Host: www.northwindtraders.comId=123&color=blue
  • The typical .aspx page includes three sections: pagedirectives, code, and page layout.Page directives This section is used to set up theenvironment, specifying how the page should be processed. Forexample, this is where you can indicate an associated codefile, development language, transaction, and more.Code This section contains code to handle events that execute onthe server based on the ASP.NET page processing model.Page Layout The Page layout is written using HTML. Thisincludes body, markups and style information
  • In the single-file model, the compiler generates a new class foryour page. This class inherits from the base Page class. It istypically named with the format ASP.pagename_aspx. Thisclass contains control declarations, event handlers, and relatedcode you have written for your page.The code-behind programming model physically separates youruser interface layout markup and your server-side code into twodistinct files. In this case the .aspx page contains your layoutmarkup and the related .aspx.cs or .aspx.vb file contains theassociated code.
  • Most of the Web Applications are not pre-compiled.Instead, pages and codes are typically copied to a WebServer and then dynamically compiled the first time theyare requested by a user.Web applications can also be pre-compiled using Build->Publish Website option in Visual Studio. In this case theentire website is compiled, error checked and only layoutcode and associated assemblies are copied to the server
  • Pro: The entire application need not be recompiled. Onlythe changed web page is replaced.Con: The first request will be slower and source code is tobe deployed to the server
  • Pro: Since entire application is compiled and error checkedit provides verification that all the pages and theirdependencies can be compiled.Performance for the first user request is improvedCon: Simply copying the code files is simpler as comparedto pre-compilation.
  • • Configuration files allow you to manage the many settings related to your Web site.• Each file is an XML file (with the extension .config) that contains a set of configuration elements. The elements define options such as security information, database connection strings, caching settings, and more.• A given site might actually be configured with multiple .config files.
  • • Configuration files are applied to an executing site based on a hierarchy.• There is a global configuration file for all sites on a given machine called Machine.config. This file is found in the• %SystemRoot%Microsoft.NETFramework<versionNum ber>CONFIG directory.• The next file in the hierarchy is root default Web.config file located in the same directory• The root directory of each website also contain a Web.config file.• Finally each subfolder can optionally contain its own config file
  • Because they are XML files, the configuration files can beopened and modified with any text editor or XML editor.Visual Studio 2008 also provides the Web Site AdministrationTool (WSAT), which can be used to modify many of theconfiguration file settings.
  • The WSAT allows you to edit the following categories of theconfiguration files:Security This setting allows you to set up security for yourWeb site. In this category, you can add users, roles, andpermissions for your Web site.Application Configuration This category is used to modifythe application settings.Provider Configuration This configuration file containssettings that allow you to specify the database provider to usefor maintaining membership and roles