SlideShare a Scribd company logo
CIS 451: Introduction to ASP.NET Dr. Ralph D. Westfall January, 2009
Web Development Problem HTML designed to display static pages only interactive when user clicks links can’t provide animation   except  animated GIFs can’t create custom pages for specific types of customers can’t use databases, spreadsheets, etc. no security capabilities in HTML itself except hiding  passwords  <input type=&quot;password&quot; etc. using long directory/file names works somewhat, but it's not HTML
Solution 1: Client Side Scripts JavaScript (dominant product) can do animation,  rollovers , message boxes calculations , validation of user inputs incorporate customized content into pages e.g. based on day/time, user inputs, etc. provide limited access to user’s system system date, browser, plug-in information set cookies (data for server for next visit)
Client Side Scripts (continued) what (client side) JavaScript can’t do connect with databases, and possibly other applications on the server  provide meaningful security for access control (but  JavaScript Source  has some &quot;hackish&quot; scripts) hiding proprietary code if it's in the HTML file or user has a tool to find it (e.g.,  Web Developer  add-on for Firefox)
Solution 2: Server Side Scripts use common gateway interface ( CGI ) offer database & security capabilities written in C, C++, Perl, etc. relatively difficult to program & maintain use server resources relatively inefficiently separate programs in addition to HTML but this is probably an advantage
Solution 3: ASP Active Server Pages released by Microsoft in 1996 works with Microsoft servers Windows Server 2008 free  Visual Web Developer Express 2008  IDE includes a lightweight personal  web server for developing ASP.NET applications so does Visual Studio
Solution 3: ASP (continued) simple language can go in same files as HTML code provides many of the capabilities of CGI uses server resources more efficiently than CGI using ASP server extensions, can work with non-Microsoft servers, but …
ASP.NET major revision of ASP can use different languages, not just VB.NET   VB.NET code looks more like Java than the VBScript used previously .NET code is compiled into MSIL (Microsoft Intermediate Language) MSIL is then interpreted into machine language that runs on the server
ASP.NET: Many Languages HTML (of course!) Visual Basic.NET can also use C# and J# with VWDX .NET supports over 30  other languages C++ and JScript (Microsoft's version of JavaScript) work with Visual Studio.NET other (non Microsoft) languages can also work with Visual Studio.NET
Tools To Develop & Use ASP.NET a tool to create code  text editors: Notepad, TextPad, etc.  HTML authoring tools: Dreamweaver, FrontPage, etc. Visual Studio.NET, Web Matrix or  Visual Web Developer Express 2008  (free!) IIS or VWDX on your computer or  free 14-day ASP.NET hosting web browser
Creating an ASP.NET Page create an HTML document add ASP code in appropriate places save with extension of .aspx if don't have local server on computer,  upload to a remote ASP.NET server Cal Poly Intranet server  won't  run ASP view in browser (file can be on local machine with server or remote server)
Simple ASP.NET Page  (not Visual Studio) create a document with HTML code add .NET code within HTML (inline)  at top, need  <%@ Page Language=&quot;VB&quot; %> save with extension of .aspx  upload to remote server (if don't have Web Matrix or IIS) or paste into VS  view in browser
hello.aspx <%@ Page Language=&quot;VB&quot; %> <html> <body> <!-- paste below </form> tag--> <% Response.Write(&quot;<P>Hello, world!&quot;) %> <P>The time is: <% = Now() %> </body> </html>  <!-- View Source in browser -->
ASP.NET Coding within HTML use <% at  start, %> at end on same line (inline) <% = Time %> or on multiple lines (block) <% Response.Write &quot;<P>Hello, world!&quot; Response.Write 'like VB.NET Debug.Write  %>
ASP.NET Output in HTML ASP inside a HTML tag <P>The time is: <% = Time %> use  <% =   followed by a variable or a function that returns data, then  %> variable can come from server itself, or from client machine, or can be defined in code elsewhere in same or another ASP file <% Dim strCar as String=&quot;Geo&quot; %>  <P>The car is: <% = strCar %>
Generating ASP Output - 2 ASP.NET code can write text and also  data from ASP.NET variables hit counter example <% nHits = nHits + 1 Response.Write &quot;Hits = &quot; & nHits 'text    variable %>
Generating ASP Output - 3 can mix text, HTML, and ASP.NET variables in code this includes using ASP to write HTML tags, in addition to writing variables and text
fontsize.aspx <%  Dim intI as Integer For intI = 1 to 7  %>  <!-HTML inside ASP loop-> <font size = <% = intI %> > Size is <% = intI %> </font><br/> <% Next %>    <!-note->  <!-what will you see from this?-> <!-fontcolor.aspx  'notes->
Using ASP.NET with Forms use HTML or ASP page to create a form be sure all form fields have id = &quot;[  ]&quot; and also name = &quot;[  ]&quot;  'same as for id= use an ASP.NET page to process inputs action attribute in form has name of an ASP.NET file, and use Input (Submit) button form field values accessible to ASP as  Request.QueryString(&quot;[form field name]&quot;)
form2.html <html><body> <form method=&quot;get&quot;  action=&quot;resp2.aspx&quot;> Last Name <input type=&quot;text&quot; name=&quot;custName&quot; id=&quot;custName&quot;> </body></html>  <!--need to refresh?-->
Default.aspx <%@ Page Language=&quot;VB&quot; %> <html><body> Input from form: <% Dim strCustName as String strCustName = _ Request.QueryString(&quot;custName&quot;) Response.Write(&quot;last name is &quot; & _  strCustName) %></body></html>
Using ASP.NET with Forms - 2 if have more than just one text field, must have a Submit button  on form <input type=submit  [etc.]>   after development would use  <form method=&quot;post&quot;   [etc.]> when using post, also need to change every Request.QueryString to Request.Form in the ASP page identified by the action
Using Visual Studio.NET for ASP using Visual Studio.NET or Visual Web Developer Express 2008  Create: Web Site… ASP.NET Web Site add a Label to Default.aspx designer and expand it vertically and horizontally to occupy 25% of the screen double click the screen (outside of the label) to start a Page_Load Sub paste code on following page into Sub
VB.NET Web Code Dim i As Integer Dim colr() As String = {&quot;000000&quot;, &quot;333300&quot;,  _   &quot;666600&quot;, &quot;999900&quot;, &quot;cccc00&quot;, &quot;ffff00&quot;} Dim output As String = &quot;&quot; For i = 0 To 5 output &= &quot;<h1><font color=#&quot; & colr(i)  _ & &quot;>&quot; & colr(i) & &quot;</font></h1>&quot; Next Label1.Text = output
Run Code click Start (first time) modify the web.config…>OK view code and then make changes as necessary
ASP.NET Code Samples CIS 451 ASP Code Samples W3 Schools online tutorials and demonstration code
Ad

More Related Content

What's hot (20)

Php
PhpPhp
Php
Mindtree
 
Screen Pages - Mage Titans - i18n Translations - Magento 2
Screen Pages  - Mage Titans - i18n Translations - Magento 2Screen Pages  - Mage Titans - i18n Translations - Magento 2
Screen Pages - Mage Titans - i18n Translations - Magento 2
Tadhg Bowe
 
Razor and the Art of Templating
Razor and the Art of TemplatingRazor and the Art of Templating
Razor and the Art of Templating
Jess Chadwick
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 Boilerplate
Michael Enslow
 
Delhi student's day
Delhi student's dayDelhi student's day
Delhi student's day
Ankur Mishra
 
How to add watermark to image using php
How to add watermark to image using phpHow to add watermark to image using php
How to add watermark to image using php
YourBlogCoach1
 
Part 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinterPart 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinter
Mohamed Essam
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
teach4uin
 
Controls
ControlsControls
Controls
Iblesoft
 
Front End Publishing for WordPress
Front End Publishing for WordPressFront End Publishing for WordPress
Front End Publishing for WordPress
rfair404
 
DODN2009 - Jump Start Silverlight
DODN2009 - Jump Start SilverlightDODN2009 - Jump Start Silverlight
DODN2009 - Jump Start Silverlight
Clint Edmonson
 
Flex_rest_optimization
Flex_rest_optimizationFlex_rest_optimization
Flex_rest_optimization
Khou Suylong
 
Web I - 04 - Forms
Web I - 04 - FormsWeb I - 04 - Forms
Web I - 04 - Forms
Randy Connolly
 
Entities
EntitiesEntities
Entities
guestda2f7b
 
Entities
EntitiesEntities
Entities
guestda2f7b
 
What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0
Jess Chadwick
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
phuphax
 
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
RIA RUI Society
 
Lecture 3 Javascript1
Lecture 3  Javascript1Lecture 3  Javascript1
Lecture 3 Javascript1
Sur College of Applied Sciences
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3
Jeffrey Barke
 
Screen Pages - Mage Titans - i18n Translations - Magento 2
Screen Pages  - Mage Titans - i18n Translations - Magento 2Screen Pages  - Mage Titans - i18n Translations - Magento 2
Screen Pages - Mage Titans - i18n Translations - Magento 2
Tadhg Bowe
 
Razor and the Art of Templating
Razor and the Art of TemplatingRazor and the Art of Templating
Razor and the Art of Templating
Jess Chadwick
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 Boilerplate
Michael Enslow
 
Delhi student's day
Delhi student's dayDelhi student's day
Delhi student's day
Ankur Mishra
 
How to add watermark to image using php
How to add watermark to image using phpHow to add watermark to image using php
How to add watermark to image using php
YourBlogCoach1
 
Part 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinterPart 4 Introduction to Gui with tkinter
Part 4 Introduction to Gui with tkinter
Mohamed Essam
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
teach4uin
 
Front End Publishing for WordPress
Front End Publishing for WordPressFront End Publishing for WordPress
Front End Publishing for WordPress
rfair404
 
DODN2009 - Jump Start Silverlight
DODN2009 - Jump Start SilverlightDODN2009 - Jump Start Silverlight
DODN2009 - Jump Start Silverlight
Clint Edmonson
 
Flex_rest_optimization
Flex_rest_optimizationFlex_rest_optimization
Flex_rest_optimization
Khou Suylong
 
What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0
Jess Chadwick
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
phuphax
 
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
RIA RUI Society
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3
Jeffrey Barke
 

Viewers also liked (7)

Microsoft PowerPoint - ASP ASAP
Microsoft PowerPoint - ASP ASAPMicrosoft PowerPoint - ASP ASAP
Microsoft PowerPoint - ASP ASAP
webhostingguy
 
Presentation
PresentationPresentation
Presentation
webhostingguy
 
home.ubalt.edu
home.ubalt.eduhome.ubalt.edu
home.ubalt.edu
webhostingguy
 
Scaleable Enterprise Computing Andre Hill
Scaleable Enterprise Computing Andre HillScaleable Enterprise Computing Andre Hill
Scaleable Enterprise Computing Andre Hill
webhostingguy
 
download presentation
download presentationdownload presentation
download presentation
webhostingguy
 
Global Phishing Survey: Domain Name Use and Trends in 2007
Global Phishing Survey: Domain Name Use and Trends in 2007Global Phishing Survey: Domain Name Use and Trends in 2007
Global Phishing Survey: Domain Name Use and Trends in 2007
webhostingguy
 
nOOb-1.1-Dev-Env-pt-II.ppt
nOOb-1.1-Dev-Env-pt-II.pptnOOb-1.1-Dev-Env-pt-II.ppt
nOOb-1.1-Dev-Env-pt-II.ppt
webhostingguy
 
Microsoft PowerPoint - ASP ASAP
Microsoft PowerPoint - ASP ASAPMicrosoft PowerPoint - ASP ASAP
Microsoft PowerPoint - ASP ASAP
webhostingguy
 
Scaleable Enterprise Computing Andre Hill
Scaleable Enterprise Computing Andre HillScaleable Enterprise Computing Andre Hill
Scaleable Enterprise Computing Andre Hill
webhostingguy
 
download presentation
download presentationdownload presentation
download presentation
webhostingguy
 
Global Phishing Survey: Domain Name Use and Trends in 2007
Global Phishing Survey: Domain Name Use and Trends in 2007Global Phishing Survey: Domain Name Use and Trends in 2007
Global Phishing Survey: Domain Name Use and Trends in 2007
webhostingguy
 
nOOb-1.1-Dev-Env-pt-II.ppt
nOOb-1.1-Dev-Env-pt-II.pptnOOb-1.1-Dev-Env-pt-II.ppt
nOOb-1.1-Dev-Env-pt-II.ppt
webhostingguy
 
Ad

Similar to CIS 451: Introduction to ASP.NET (20)

Intro To Asp Net And Web Forms
Intro To Asp Net And Web FormsIntro To Asp Net And Web Forms
Intro To Asp Net And Web Forms
SAMIR BHOGAYTA
 
Web II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side developmentWeb II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side development
Randy Connolly
 
Vb.Net Web Forms
Vb.Net  Web FormsVb.Net  Web Forms
Vb.Net Web Forms
Dutch Dasanaike {LION}
 
2310 b 04
2310 b 042310 b 04
2310 b 04
Krazy Koder
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
Stephan Schmidt
 
Internet Environment
Internet  EnvironmentInternet  Environment
Internet Environment
guest8fdbdd
 
Migration from ASP to ASP.NET
Migration from ASP to ASP.NETMigration from ASP to ASP.NET
Migration from ASP to ASP.NET
Information Technology
 
ASP_NET Features
ASP_NET FeaturesASP_NET Features
ASP_NET Features
Biswadip Goswami
 
HTML5 Fundamentals
HTML5 FundamentalsHTML5 Fundamentals
HTML5 Fundamentals
Doncho Minkov
 
php
phpphp
php
bhuvana553
 
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp VictoriaWidgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Jeff Richards
 
Introduction To Asp.Net Ajax
Introduction To Asp.Net AjaxIntroduction To Asp.Net Ajax
Introduction To Asp.Net Ajax
Jeff Blankenburg
 
Before start
Before startBefore start
Before start
Medhat Dawoud
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 
How to develop asp web applications
How to develop asp web applicationsHow to develop asp web applications
How to develop asp web applications
Deepankar Pathak
 
JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1
Gene Babon
 
Tugas Pw [6] (2)
Tugas Pw [6] (2)Tugas Pw [6] (2)
Tugas Pw [6] (2)
Hafiizh Fardhani
 
Tugas Pw [6]
Tugas Pw [6]Tugas Pw [6]
Tugas Pw [6]
guestca37172
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
CGI Presentation
CGI PresentationCGI Presentation
CGI Presentation
Sopan Shewale
 
Intro To Asp Net And Web Forms
Intro To Asp Net And Web FormsIntro To Asp Net And Web Forms
Intro To Asp Net And Web Forms
SAMIR BHOGAYTA
 
Web II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side developmentWeb II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side development
Randy Connolly
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
Stephan Schmidt
 
Internet Environment
Internet  EnvironmentInternet  Environment
Internet Environment
guest8fdbdd
 
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp VictoriaWidgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Jeff Richards
 
Introduction To Asp.Net Ajax
Introduction To Asp.Net AjaxIntroduction To Asp.Net Ajax
Introduction To Asp.Net Ajax
Jeff Blankenburg
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 
How to develop asp web applications
How to develop asp web applicationsHow to develop asp web applications
How to develop asp web applications
Deepankar Pathak
 
JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1
Gene Babon
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
Ad

More from webhostingguy (20)

File Upload
File UploadFile Upload
File Upload
webhostingguy
 
Running and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test FrameworkRunning and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test Framework
webhostingguy
 
MySQL and memcached Guide
MySQL and memcached GuideMySQL and memcached Guide
MySQL and memcached Guide
webhostingguy
 
Novell® iChain® 2.3
Novell® iChain® 2.3Novell® iChain® 2.3
Novell® iChain® 2.3
webhostingguy
 
Load-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serversLoad-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web servers
webhostingguy
 
SQL Server 2008 Consolidation
SQL Server 2008 ConsolidationSQL Server 2008 Consolidation
SQL Server 2008 Consolidation
webhostingguy
 
What is mod_perl?
What is mod_perl?What is mod_perl?
What is mod_perl?
webhostingguy
 
What is mod_perl?
What is mod_perl?What is mod_perl?
What is mod_perl?
webhostingguy
 
Master Service Agreement
Master Service AgreementMaster Service Agreement
Master Service Agreement
webhostingguy
 
Notes8
Notes8Notes8
Notes8
webhostingguy
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
webhostingguy
 
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
webhostingguy
 
Managing Diverse IT Infrastructure
Managing Diverse IT InfrastructureManaging Diverse IT Infrastructure
Managing Diverse IT Infrastructure
webhostingguy
 
Web design for business.ppt
Web design for business.pptWeb design for business.ppt
Web design for business.ppt
webhostingguy
 
IT Power Management Strategy
IT Power Management Strategy IT Power Management Strategy
IT Power Management Strategy
webhostingguy
 
Excel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for MerchandisersExcel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for Merchandisers
webhostingguy
 
OLUG_xen.ppt
OLUG_xen.pptOLUG_xen.ppt
OLUG_xen.ppt
webhostingguy
 
Parallels Hosting Products
Parallels Hosting ProductsParallels Hosting Products
Parallels Hosting Products
webhostingguy
 
Microsoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 MbMicrosoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 Mb
webhostingguy
 
Reseller's Guide
Reseller's GuideReseller's Guide
Reseller's Guide
webhostingguy
 
Running and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test FrameworkRunning and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test Framework
webhostingguy
 
MySQL and memcached Guide
MySQL and memcached GuideMySQL and memcached Guide
MySQL and memcached Guide
webhostingguy
 
Novell® iChain® 2.3
Novell® iChain® 2.3Novell® iChain® 2.3
Novell® iChain® 2.3
webhostingguy
 
Load-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serversLoad-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web servers
webhostingguy
 
SQL Server 2008 Consolidation
SQL Server 2008 ConsolidationSQL Server 2008 Consolidation
SQL Server 2008 Consolidation
webhostingguy
 
Master Service Agreement
Master Service AgreementMaster Service Agreement
Master Service Agreement
webhostingguy
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
webhostingguy
 
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
webhostingguy
 
Managing Diverse IT Infrastructure
Managing Diverse IT InfrastructureManaging Diverse IT Infrastructure
Managing Diverse IT Infrastructure
webhostingguy
 
Web design for business.ppt
Web design for business.pptWeb design for business.ppt
Web design for business.ppt
webhostingguy
 
IT Power Management Strategy
IT Power Management Strategy IT Power Management Strategy
IT Power Management Strategy
webhostingguy
 
Excel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for MerchandisersExcel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for Merchandisers
webhostingguy
 
Parallels Hosting Products
Parallels Hosting ProductsParallels Hosting Products
Parallels Hosting Products
webhostingguy
 
Microsoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 MbMicrosoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 Mb
webhostingguy
 

CIS 451: Introduction to ASP.NET

  • 1. CIS 451: Introduction to ASP.NET Dr. Ralph D. Westfall January, 2009
  • 2. Web Development Problem HTML designed to display static pages only interactive when user clicks links can’t provide animation except animated GIFs can’t create custom pages for specific types of customers can’t use databases, spreadsheets, etc. no security capabilities in HTML itself except hiding passwords <input type=&quot;password&quot; etc. using long directory/file names works somewhat, but it's not HTML
  • 3. Solution 1: Client Side Scripts JavaScript (dominant product) can do animation, rollovers , message boxes calculations , validation of user inputs incorporate customized content into pages e.g. based on day/time, user inputs, etc. provide limited access to user’s system system date, browser, plug-in information set cookies (data for server for next visit)
  • 4. Client Side Scripts (continued) what (client side) JavaScript can’t do connect with databases, and possibly other applications on the server provide meaningful security for access control (but JavaScript Source has some &quot;hackish&quot; scripts) hiding proprietary code if it's in the HTML file or user has a tool to find it (e.g., Web Developer add-on for Firefox)
  • 5. Solution 2: Server Side Scripts use common gateway interface ( CGI ) offer database & security capabilities written in C, C++, Perl, etc. relatively difficult to program & maintain use server resources relatively inefficiently separate programs in addition to HTML but this is probably an advantage
  • 6. Solution 3: ASP Active Server Pages released by Microsoft in 1996 works with Microsoft servers Windows Server 2008 free Visual Web Developer Express 2008 IDE includes a lightweight personal web server for developing ASP.NET applications so does Visual Studio
  • 7. Solution 3: ASP (continued) simple language can go in same files as HTML code provides many of the capabilities of CGI uses server resources more efficiently than CGI using ASP server extensions, can work with non-Microsoft servers, but …
  • 8. ASP.NET major revision of ASP can use different languages, not just VB.NET VB.NET code looks more like Java than the VBScript used previously .NET code is compiled into MSIL (Microsoft Intermediate Language) MSIL is then interpreted into machine language that runs on the server
  • 9. ASP.NET: Many Languages HTML (of course!) Visual Basic.NET can also use C# and J# with VWDX .NET supports over 30 other languages C++ and JScript (Microsoft's version of JavaScript) work with Visual Studio.NET other (non Microsoft) languages can also work with Visual Studio.NET
  • 10. Tools To Develop & Use ASP.NET a tool to create code text editors: Notepad, TextPad, etc. HTML authoring tools: Dreamweaver, FrontPage, etc. Visual Studio.NET, Web Matrix or Visual Web Developer Express 2008 (free!) IIS or VWDX on your computer or free 14-day ASP.NET hosting web browser
  • 11. Creating an ASP.NET Page create an HTML document add ASP code in appropriate places save with extension of .aspx if don't have local server on computer, upload to a remote ASP.NET server Cal Poly Intranet server won't run ASP view in browser (file can be on local machine with server or remote server)
  • 12. Simple ASP.NET Page (not Visual Studio) create a document with HTML code add .NET code within HTML (inline) at top, need <%@ Page Language=&quot;VB&quot; %> save with extension of .aspx upload to remote server (if don't have Web Matrix or IIS) or paste into VS view in browser
  • 13. hello.aspx <%@ Page Language=&quot;VB&quot; %> <html> <body> <!-- paste below </form> tag--> <% Response.Write(&quot;<P>Hello, world!&quot;) %> <P>The time is: <% = Now() %> </body> </html> <!-- View Source in browser -->
  • 14. ASP.NET Coding within HTML use <% at start, %> at end on same line (inline) <% = Time %> or on multiple lines (block) <% Response.Write &quot;<P>Hello, world!&quot; Response.Write 'like VB.NET Debug.Write %>
  • 15. ASP.NET Output in HTML ASP inside a HTML tag <P>The time is: <% = Time %> use <% = followed by a variable or a function that returns data, then %> variable can come from server itself, or from client machine, or can be defined in code elsewhere in same or another ASP file <% Dim strCar as String=&quot;Geo&quot; %> <P>The car is: <% = strCar %>
  • 16. Generating ASP Output - 2 ASP.NET code can write text and also data from ASP.NET variables hit counter example <% nHits = nHits + 1 Response.Write &quot;Hits = &quot; & nHits 'text variable %>
  • 17. Generating ASP Output - 3 can mix text, HTML, and ASP.NET variables in code this includes using ASP to write HTML tags, in addition to writing variables and text
  • 18. fontsize.aspx <% Dim intI as Integer For intI = 1 to 7 %> <!-HTML inside ASP loop-> <font size = <% = intI %> > Size is <% = intI %> </font><br/> <% Next %> <!-note-> <!-what will you see from this?-> <!-fontcolor.aspx 'notes->
  • 19. Using ASP.NET with Forms use HTML or ASP page to create a form be sure all form fields have id = &quot;[ ]&quot; and also name = &quot;[ ]&quot; 'same as for id= use an ASP.NET page to process inputs action attribute in form has name of an ASP.NET file, and use Input (Submit) button form field values accessible to ASP as Request.QueryString(&quot;[form field name]&quot;)
  • 20. form2.html <html><body> <form method=&quot;get&quot; action=&quot;resp2.aspx&quot;> Last Name <input type=&quot;text&quot; name=&quot;custName&quot; id=&quot;custName&quot;> </body></html> <!--need to refresh?-->
  • 21. Default.aspx <%@ Page Language=&quot;VB&quot; %> <html><body> Input from form: <% Dim strCustName as String strCustName = _ Request.QueryString(&quot;custName&quot;) Response.Write(&quot;last name is &quot; & _ strCustName) %></body></html>
  • 22. Using ASP.NET with Forms - 2 if have more than just one text field, must have a Submit button on form <input type=submit [etc.]> after development would use <form method=&quot;post&quot; [etc.]> when using post, also need to change every Request.QueryString to Request.Form in the ASP page identified by the action
  • 23. Using Visual Studio.NET for ASP using Visual Studio.NET or Visual Web Developer Express 2008 Create: Web Site… ASP.NET Web Site add a Label to Default.aspx designer and expand it vertically and horizontally to occupy 25% of the screen double click the screen (outside of the label) to start a Page_Load Sub paste code on following page into Sub
  • 24. VB.NET Web Code Dim i As Integer Dim colr() As String = {&quot;000000&quot;, &quot;333300&quot;, _ &quot;666600&quot;, &quot;999900&quot;, &quot;cccc00&quot;, &quot;ffff00&quot;} Dim output As String = &quot;&quot; For i = 0 To 5 output &= &quot;<h1><font color=#&quot; & colr(i) _ & &quot;>&quot; & colr(i) & &quot;</font></h1>&quot; Next Label1.Text = output
  • 25. Run Code click Start (first time) modify the web.config…>OK view code and then make changes as necessary
  • 26. ASP.NET Code Samples CIS 451 ASP Code Samples W3 Schools online tutorials and demonstration code

Editor's Notes

  • #14: http://134.71.196.107/westfall/
  • #24: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim intI As Integer Dim output As String = &amp;quot;&amp;quot; For intI = 1 To 7 output += &amp;quot;&lt;font size = &amp;quot; &amp; intI &amp; &amp;quot;&gt;&amp;quot; _ &amp; &amp;quot;Size is &amp;quot; &amp; intI &amp; &amp;quot;&lt;/font&gt;&lt;br&gt;&amp;quot; Next Label1.Text = output End Sub
  翻译: