SlideShare a Scribd company logo
Developing an ASP.NET Web Application Deepankar Pathak
Agenda Overview of .NET Overview of ASP.NET Creating an ASP.NET Web Form Adding Event Procedures Validating User Input
Overview of .NET
What is the .NET Framework? Developer Tools Clients User Experiences ASP.NET Web Applications XML Web Services Databases .NET Framework
Benefits of .NET Based on Web standards and practices Functionality of .NET classes is universally available Code is organized into hierarchical namespaces and classes Language independent Solves existing problems: Even with the Internet, most applications and devices have trouble communicating with each other Programmers end up writing infrastructure instead of applications Programmers have had to limit their scope or continually learn new languages
The .NET Framework Components Win32 Common Language Runtime .NET Framework Class Library ADO.NET and XML XML Web Services User Interface Visual Basic C++ C# ASP.NET Perl Python … Message Queuing COM+ (Transactions, Partitions,  Object Pooling) IIS WMI
The Common Language Runtime One runtime for all . NET-Based Languages Manages threads and memory Garbage collection Enforces code security Eliminates DLL versioning problems Multiple versions of a DLL can run simultaneously Applications can specify a version of a DLL to use
Using the Class Library The class library is a set of classes (properties and methods) that all .NET applications can use You use objects by referencing the .NET namespaces Using a namespace in C#: Implicit object declaration Explicit object declaration using  namespace_name ; using System.Web.UI.WebControls; ListBox ListBox1; ListBox1.Items.Add("First Item"); System.Web.UI.WebControls.ListBox ListBox1; ListBox1.Items.Add("First Item");
Multiple Language Support The .NET Framework is designed to support many languages More than 20 languages currently supported Microsoft provides Visual Basic .NET, C#,  Visual J# .NET, and JScript .NET Benefits of multiple-language support Code modules are reusable Class Library access is the same for all languages The right language is used for the right task Performance is roughly equal between all languages
Choosing a Language .NET Framework class library is the same regardless of language Performance All languages are compiled to MSIL Only performance difference is how each language compiler compiles to MSIL The runtime compiles all MSIL the same, regardless of its origin Development experience C# is similar to Java, C, Visual C++, and Pascal Visual Basic .NET is similar to Visual Basic Browser compatibility ASP.NET code is server-side code, so browser compatibility is not an issue
Overview of ASP.NET
ASP Web Application Architecture Presentation Tier Business Logic Tier Data Tier UI Pages (.htm) Graphic  Files COM Objects Data Source ADO COM+ Services ASP Page  (.asp)
ASP.NET Web Application Architecture Presentation Tier Business Logic Tier Data Tier Graphic  Files UI Pages (.htm) XML Web Services (.asmx) User Controls (.ascx) Code-Behind File (.aspx.vb or .aspx.cs) Proxy ADO.NET .NET  Objects Data Source COM+ Services COM Objects RCW Web Form  (.aspx)
ASP.NET Coding Changes Page directives Language  attribute must be in set the  @Page  directive Structural changes All functions and variables must be declared within a  <script>  block Only one language per page Render Functions are no longer supported; use  Response.Write Design-Time controls are no longer supported Replaced with Web controls
ASP.NET Runtime Compilation and Execution Native code C# Visual Basic .NET default.aspx Common Language Runtime HTML Which language? Visual Basic .NET compiler C# compiler MSIL JIT compiler
Multimedia: ASP.NET Execution Model
Creating an ASP.NET Web Form
Demonstration: Developing an ASP.NET Web Application Create a Web application Add controls to a Web Form View the HTML generated Add an event procedure
What Is a Web Form? . aspx extension Page attributes @ Page  directive  Controls save state Body attributes Form attributes <%@ Page Language=&quot;C#&quot; Inherits=Project.WebForm1 %> <html> <body ms_positioning=&quot;GridLayout&quot;>   <form id=&quot;Form1&quot; method=&quot;post&quot;  runat=&quot;server&quot; >   </form> </body> </html>
What is a Server Control? Runat=&quot;server&quot; Event procedures run on the server View state saved Properties and methods are available in server-side event procedures <asp:Button id=&quot;Button1&quot; runat=&quot;server&quot;  Text=&quot;Submit&quot;/> private void btn_Click(object sender,  System.EventArgs e) { lblName.Text = txtName.Text; }
Types of Server Controls HTML server controls Based on HTML elements Exist within the System.Web.UI.HtmlControls namespace Web server controls Exist within the   System.Web.UI.WebControls namespace HTML that is generated by the control <input name=&quot;TextBox1&quot; type=&quot;text&quot;  value=&quot;Text_to_Display&quot; Id=&quot;TextBox1&quot;/> <asp:TextBox id=&quot;TextBox1&quot; runat=&quot;server&quot;>Text_to_Display </asp:TextBox> <input type=&quot;text&quot; id=&quot;txtName&quot; runat=&quot;server&quot; />
Maintaining the State of ASP.NET Server Controls Server control state is stored in __VIEWSTATE, a hidden control on the Web Form __VIEWSTATE stores state in a string value of name-value pairs <form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;> <input type=&quot;hidden&quot; name=&quot;__VIEWSTATE&quot;   value=&quot;dDw3NzE0MTExODQ7Oz4=&quot; /> 'HTML here </form> On by default, adjustable at Web Form and control level <%@ Page EnableViewState=&quot;False&quot; %> <asp:ListBox id=&quot;ListName&quot; EnableViewState=&quot;true&quot; runat=&quot;server&quot;> </asp:ListBox>
Demonstration: Using Server Controls to a Web Form Using HTML server controls Displaying browser-specific HTML
Selecting the Appropriate Control You need specific functionality such as a calendar or ad rotator The control will interact with client and server script You are writing a page that might be used by a variety of browsers You are working with existing HTML pages and want to quickly add ASP.NET Web page functionality You prefer a Visual Basic-like programming model You prefer an HTML-like object model Use  Web  Server Controls if: Use HTML Server Controls if: Bandwidth is not a problem Bandwidth is limited
Adding Event Procedures
How to Implement Code Three methods for adding code: Put code in the same file as content (mixed) Put code in a separate <SCRIPT> section of the content file (inline code) Put code in a separate file (code-behind pages) Code-behind pages are the Visual Studio .NET default Form1.aspx Form1.aspx Form1.aspx.vb or Form1.aspx.cs <tags> <tags> code code Separate files Single file Code-Behind Page
Understanding How Code-Behind Pages Work Create separate files for user interface and interface logic Use @ Page directive to link the two files  Page1.aspx <% @ Page Language=&quot;C#&quot; Inherits=&quot;Project.WebForm1&quot; Codebehind=&quot;Page1.aspx.cs&quot;  Src = &quot;Page1.aspx.cs&quot; %> Page1.aspx.cs namespace Project { public class WebForm1 :    System.Web.UI.Page {   } }
What are Event Procedures? Action in response to a user’s interaction with the controls on the page
Demonstration: Using Events Open an ASP.NET page with controls and client-side and server-side event procedures Click on the controls to view client-side and server-side events running In the browser, view the source of the page In the editor, view the event procedure code
Client-Side Event Procedures Internet .HTM  Pages Typically used only with HTML controls Interpreted by the browser and run on the client Do not have access to server resources Use <SCRIPT language=&quot; language &quot;>
Server-Side Event Procedures Used with both Web and HTML server controls Code is compiled and run on the server Have access to server resources Use <SCRIPT language =&quot;language&quot;  runat=&quot;server&quot;> Internet .ASPX  Pages
Creating Event Procedures Visual Studio .NET declares variables and creates an event procedure template in the code-behind page protected System.Web.UI.WebControls.Button  btn ; private void InitializeComponent() {  this. btn.Click  +=  new System.EventHandler(this. btn_Click ); } private void  btn_Click (object sender,  System.EventArgs e) { }
Events in the Web Page Generation Process Events in the Web page generation process ASP.NET server control events are handled when the Web page is posted back to the server Use the Page.IsPostback property to determine if the Web page is being generated for the first time private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // executes only on initial page load } //this code executes on every request } Page_Unload Page_Init Page_Load Server control events
Multimedia
Demonstration: Handling Postback Events
Validating User Input
What Is Input Validation? Verifies that a control value is correctly entered by the user Blocks the processing of a page until all controls are valid  Avoids spoofing or the addition of malicious code
Client-Side and Server-Side Validation ASP.NET can create both client-side and server-side validation Client-side validation  Dependent on browser version Instant feedback Reduces postback cycles Server-side validation Repeats all client-side validation Can validate against stored data Valid? Valid? User Enters  Data No No Yes Yes Error  Message Client Server Web Form Processed
ASP.NET Validation Controls Control Name Purpose RequiredFieldValidator Require user input CompareValidator Compare to another control, a value, or a data type RangeValidator Compare to a range CustomValidator Compare to a custom formula RegularExpressionValidator Compare to a regular expression pattern ValidationSummary Summarize the state of the validation controls on a page
Adding Validation Controls to a Web Form Add a validation control Select the input control to validate Set validation properties 1 2 3 <asp:TextBox id=&quot;txtName&quot; runat=&quot;server&quot; /> <asp: Type_of_Validator   id=&quot; Validator_id &quot; runat=&quot;server&quot;   ControlToValidate=&quot; txtName &quot; ErrorMessage=&quot; Message_for_error_summary &quot;   Display=&quot; static|dynamic|none &quot; Text=&quot; Text_to_display_by_input_control &quot;> </asp: Type_of_Validator>
Combining Validation Controls Can have multiple validation controls on a single input control Only the RequiredFieldValidator checks empty controls
Demonstration: Using Validation Controls Create an ASP.NET Web Form with TextBox and Button controls Add a RequiredFieldValidator control Add a RangeValidator control Add a RegularExpressionValidator control Add a ValidationSummary control
Thanks!
Ad

More Related Content

What's hot (20)

Automated Testing Of Web Applications Using XML
Automated  Testing Of  Web  Applications Using  XMLAutomated  Testing Of  Web  Applications Using  XML
Automated Testing Of Web Applications Using XML
diongillard
 
Flash Testing with Selenium RC
Flash Testing with Selenium RCFlash Testing with Selenium RC
Flash Testing with Selenium RC
Damith Liyanaarachchi
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
Tom Johnson
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
Tom Johnson
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
Web development tool
Web development toolWeb development tool
Web development tool
Deep Bhavsar
 
As pnet
As pnetAs pnet
As pnet
Abhishek Kesharwani
 
React Native
React NativeReact Native
React Native
Heber Silva
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
Amelina Ahmeti
 
Google closure compiler
Google closure compilerGoogle closure compiler
Google closure compiler
Prasad Kancharla
 
API workshop: Deep dive into Java
API workshop: Deep dive into JavaAPI workshop: Deep dive into Java
API workshop: Deep dive into Java
Tom Johnson
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Web workers
Web workersWeb workers
Web workers
Surbhi Mathur
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
Praveen Gorantla
 
Content-Driven Apps with React
Content-Driven Apps with ReactContent-Driven Apps with React
Content-Driven Apps with React
Netcetera
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
Rich Helton
 
API Workshop: Deep dive into code samples
API Workshop: Deep dive into code samplesAPI Workshop: Deep dive into code samples
API Workshop: Deep dive into code samples
Tom Johnson
 
How to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.ioHow to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.io
Katy Slemon
 
Automated Testing Of Web Applications Using XML
Automated  Testing Of  Web  Applications Using  XMLAutomated  Testing Of  Web  Applications Using  XML
Automated Testing Of Web Applications Using XML
diongillard
 
Flash Testing with Selenium RC
Flash Testing with Selenium RCFlash Testing with Selenium RC
Flash Testing with Selenium RC
Damith Liyanaarachchi
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
Tom Johnson
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
Tom Johnson
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
Web development tool
Web development toolWeb development tool
Web development tool
Deep Bhavsar
 
React Native
React NativeReact Native
React Native
Heber Silva
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
Amelina Ahmeti
 
Google closure compiler
Google closure compilerGoogle closure compiler
Google closure compiler
Prasad Kancharla
 
API workshop: Deep dive into Java
API workshop: Deep dive into JavaAPI workshop: Deep dive into Java
API workshop: Deep dive into Java
Tom Johnson
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
Praveen Gorantla
 
Content-Driven Apps with React
Content-Driven Apps with ReactContent-Driven Apps with React
Content-Driven Apps with React
Netcetera
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
Rich Helton
 
API Workshop: Deep dive into code samples
API Workshop: Deep dive into code samplesAPI Workshop: Deep dive into code samples
API Workshop: Deep dive into code samples
Tom Johnson
 
How to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.ioHow to build a chat application with react js, nodejs, and socket.io
How to build a chat application with react js, nodejs, and socket.io
Katy Slemon
 

Similar to How to develop asp web applications (20)

Introduction to asp
Introduction to aspIntroduction to asp
Introduction to asp
Madhuri Kavade
 
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
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
Neeraj Mathur
 
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
Asp.netAsp.net
Asp.net
OpenSource Technologies Pvt. Ltd.
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
application developer
 
introaspnet.ppt
introaspnet.pptintroaspnet.ppt
introaspnet.ppt
IbrahimBurhan6
 
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.pptintroaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
AvijitChaudhuri3
 
Introduction to ASP.net. It provides basic introduction
Introduction to ASP.net. It provides basic introductionIntroduction to ASP.net. It provides basic introduction
Introduction to ASP.net. It provides basic introduction
ssuserbf6ebe
 
introaspnet.ppt
introaspnet.pptintroaspnet.ppt
introaspnet.ppt
asmachehbi
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
Raed Aldahdooh
 
Introductionto asp net-ppt
Introductionto asp net-pptIntroductionto asp net-ppt
Introductionto asp net-ppt
tmasyam
 
Visual Studio.NET
Visual Studio.NETVisual Studio.NET
Visual Studio.NET
salonityagi
 
Unit - 1: ASP.NET Basic
Unit - 1:  ASP.NET BasicUnit - 1:  ASP.NET Basic
Unit - 1: ASP.NET Basic
KALIDHASANR
 
Asp.net tips
Asp.net tipsAsp.net tips
Asp.net tips
actacademy
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
rsnarayanan
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5
Jeff Blankenburg
 
Asp.netrole
Asp.netroleAsp.netrole
Asp.netrole
mani bhushan
 
Walther Aspnet4
Walther Aspnet4Walther Aspnet4
Walther Aspnet4
rsnarayanan
 
Introduction to asp
Introduction to aspIntroduction to asp
Introduction to asp
Madhuri Kavade
 
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
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
Neeraj Mathur
 
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.pptintroaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
AvijitChaudhuri3
 
Introduction to ASP.net. It provides basic introduction
Introduction to ASP.net. It provides basic introductionIntroduction to ASP.net. It provides basic introduction
Introduction to ASP.net. It provides basic introduction
ssuserbf6ebe
 
introaspnet.ppt
introaspnet.pptintroaspnet.ppt
introaspnet.ppt
asmachehbi
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
Raed Aldahdooh
 
Introductionto asp net-ppt
Introductionto asp net-pptIntroductionto asp net-ppt
Introductionto asp net-ppt
tmasyam
 
Visual Studio.NET
Visual Studio.NETVisual Studio.NET
Visual Studio.NET
salonityagi
 
Unit - 1: ASP.NET Basic
Unit - 1:  ASP.NET BasicUnit - 1:  ASP.NET Basic
Unit - 1: ASP.NET Basic
KALIDHASANR
 
Asp.net tips
Asp.net tipsAsp.net tips
Asp.net tips
actacademy
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
rsnarayanan
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5
Jeff Blankenburg
 
Walther Aspnet4
Walther Aspnet4Walther Aspnet4
Walther Aspnet4
rsnarayanan
 
Ad

Recently uploaded (20)

Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Ad

How to develop asp web applications

  • 1. Developing an ASP.NET Web Application Deepankar Pathak
  • 2. Agenda Overview of .NET Overview of ASP.NET Creating an ASP.NET Web Form Adding Event Procedures Validating User Input
  • 4. What is the .NET Framework? Developer Tools Clients User Experiences ASP.NET Web Applications XML Web Services Databases .NET Framework
  • 5. Benefits of .NET Based on Web standards and practices Functionality of .NET classes is universally available Code is organized into hierarchical namespaces and classes Language independent Solves existing problems: Even with the Internet, most applications and devices have trouble communicating with each other Programmers end up writing infrastructure instead of applications Programmers have had to limit their scope or continually learn new languages
  • 6. The .NET Framework Components Win32 Common Language Runtime .NET Framework Class Library ADO.NET and XML XML Web Services User Interface Visual Basic C++ C# ASP.NET Perl Python … Message Queuing COM+ (Transactions, Partitions, Object Pooling) IIS WMI
  • 7. The Common Language Runtime One runtime for all . NET-Based Languages Manages threads and memory Garbage collection Enforces code security Eliminates DLL versioning problems Multiple versions of a DLL can run simultaneously Applications can specify a version of a DLL to use
  • 8. Using the Class Library The class library is a set of classes (properties and methods) that all .NET applications can use You use objects by referencing the .NET namespaces Using a namespace in C#: Implicit object declaration Explicit object declaration using namespace_name ; using System.Web.UI.WebControls; ListBox ListBox1; ListBox1.Items.Add(&quot;First Item&quot;); System.Web.UI.WebControls.ListBox ListBox1; ListBox1.Items.Add(&quot;First Item&quot;);
  • 9. Multiple Language Support The .NET Framework is designed to support many languages More than 20 languages currently supported Microsoft provides Visual Basic .NET, C#, Visual J# .NET, and JScript .NET Benefits of multiple-language support Code modules are reusable Class Library access is the same for all languages The right language is used for the right task Performance is roughly equal between all languages
  • 10. Choosing a Language .NET Framework class library is the same regardless of language Performance All languages are compiled to MSIL Only performance difference is how each language compiler compiles to MSIL The runtime compiles all MSIL the same, regardless of its origin Development experience C# is similar to Java, C, Visual C++, and Pascal Visual Basic .NET is similar to Visual Basic Browser compatibility ASP.NET code is server-side code, so browser compatibility is not an issue
  • 12. ASP Web Application Architecture Presentation Tier Business Logic Tier Data Tier UI Pages (.htm) Graphic Files COM Objects Data Source ADO COM+ Services ASP Page (.asp)
  • 13. ASP.NET Web Application Architecture Presentation Tier Business Logic Tier Data Tier Graphic Files UI Pages (.htm) XML Web Services (.asmx) User Controls (.ascx) Code-Behind File (.aspx.vb or .aspx.cs) Proxy ADO.NET .NET Objects Data Source COM+ Services COM Objects RCW Web Form (.aspx)
  • 14. ASP.NET Coding Changes Page directives Language attribute must be in set the @Page directive Structural changes All functions and variables must be declared within a <script> block Only one language per page Render Functions are no longer supported; use Response.Write Design-Time controls are no longer supported Replaced with Web controls
  • 15. ASP.NET Runtime Compilation and Execution Native code C# Visual Basic .NET default.aspx Common Language Runtime HTML Which language? Visual Basic .NET compiler C# compiler MSIL JIT compiler
  • 18. Demonstration: Developing an ASP.NET Web Application Create a Web application Add controls to a Web Form View the HTML generated Add an event procedure
  • 19. What Is a Web Form? . aspx extension Page attributes @ Page directive Controls save state Body attributes Form attributes <%@ Page Language=&quot;C#&quot; Inherits=Project.WebForm1 %> <html> <body ms_positioning=&quot;GridLayout&quot;> <form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot; > </form> </body> </html>
  • 20. What is a Server Control? Runat=&quot;server&quot; Event procedures run on the server View state saved Properties and methods are available in server-side event procedures <asp:Button id=&quot;Button1&quot; runat=&quot;server&quot; Text=&quot;Submit&quot;/> private void btn_Click(object sender, System.EventArgs e) { lblName.Text = txtName.Text; }
  • 21. Types of Server Controls HTML server controls Based on HTML elements Exist within the System.Web.UI.HtmlControls namespace Web server controls Exist within the System.Web.UI.WebControls namespace HTML that is generated by the control <input name=&quot;TextBox1&quot; type=&quot;text&quot; value=&quot;Text_to_Display&quot; Id=&quot;TextBox1&quot;/> <asp:TextBox id=&quot;TextBox1&quot; runat=&quot;server&quot;>Text_to_Display </asp:TextBox> <input type=&quot;text&quot; id=&quot;txtName&quot; runat=&quot;server&quot; />
  • 22. Maintaining the State of ASP.NET Server Controls Server control state is stored in __VIEWSTATE, a hidden control on the Web Form __VIEWSTATE stores state in a string value of name-value pairs <form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;> <input type=&quot;hidden&quot; name=&quot;__VIEWSTATE&quot; value=&quot;dDw3NzE0MTExODQ7Oz4=&quot; /> 'HTML here </form> On by default, adjustable at Web Form and control level <%@ Page EnableViewState=&quot;False&quot; %> <asp:ListBox id=&quot;ListName&quot; EnableViewState=&quot;true&quot; runat=&quot;server&quot;> </asp:ListBox>
  • 23. Demonstration: Using Server Controls to a Web Form Using HTML server controls Displaying browser-specific HTML
  • 24. Selecting the Appropriate Control You need specific functionality such as a calendar or ad rotator The control will interact with client and server script You are writing a page that might be used by a variety of browsers You are working with existing HTML pages and want to quickly add ASP.NET Web page functionality You prefer a Visual Basic-like programming model You prefer an HTML-like object model Use Web Server Controls if: Use HTML Server Controls if: Bandwidth is not a problem Bandwidth is limited
  • 26. How to Implement Code Three methods for adding code: Put code in the same file as content (mixed) Put code in a separate <SCRIPT> section of the content file (inline code) Put code in a separate file (code-behind pages) Code-behind pages are the Visual Studio .NET default Form1.aspx Form1.aspx Form1.aspx.vb or Form1.aspx.cs <tags> <tags> code code Separate files Single file Code-Behind Page
  • 27. Understanding How Code-Behind Pages Work Create separate files for user interface and interface logic Use @ Page directive to link the two files Page1.aspx <% @ Page Language=&quot;C#&quot; Inherits=&quot;Project.WebForm1&quot; Codebehind=&quot;Page1.aspx.cs&quot; Src = &quot;Page1.aspx.cs&quot; %> Page1.aspx.cs namespace Project { public class WebForm1 : System.Web.UI.Page { } }
  • 28. What are Event Procedures? Action in response to a user’s interaction with the controls on the page
  • 29. Demonstration: Using Events Open an ASP.NET page with controls and client-side and server-side event procedures Click on the controls to view client-side and server-side events running In the browser, view the source of the page In the editor, view the event procedure code
  • 30. Client-Side Event Procedures Internet .HTM Pages Typically used only with HTML controls Interpreted by the browser and run on the client Do not have access to server resources Use <SCRIPT language=&quot; language &quot;>
  • 31. Server-Side Event Procedures Used with both Web and HTML server controls Code is compiled and run on the server Have access to server resources Use <SCRIPT language =&quot;language&quot; runat=&quot;server&quot;> Internet .ASPX Pages
  • 32. Creating Event Procedures Visual Studio .NET declares variables and creates an event procedure template in the code-behind page protected System.Web.UI.WebControls.Button btn ; private void InitializeComponent() { this. btn.Click += new System.EventHandler(this. btn_Click ); } private void btn_Click (object sender, System.EventArgs e) { }
  • 33. Events in the Web Page Generation Process Events in the Web page generation process ASP.NET server control events are handled when the Web page is posted back to the server Use the Page.IsPostback property to determine if the Web page is being generated for the first time private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // executes only on initial page load } //this code executes on every request } Page_Unload Page_Init Page_Load Server control events
  • 37. What Is Input Validation? Verifies that a control value is correctly entered by the user Blocks the processing of a page until all controls are valid Avoids spoofing or the addition of malicious code
  • 38. Client-Side and Server-Side Validation ASP.NET can create both client-side and server-side validation Client-side validation Dependent on browser version Instant feedback Reduces postback cycles Server-side validation Repeats all client-side validation Can validate against stored data Valid? Valid? User Enters Data No No Yes Yes Error Message Client Server Web Form Processed
  • 39. ASP.NET Validation Controls Control Name Purpose RequiredFieldValidator Require user input CompareValidator Compare to another control, a value, or a data type RangeValidator Compare to a range CustomValidator Compare to a custom formula RegularExpressionValidator Compare to a regular expression pattern ValidationSummary Summarize the state of the validation controls on a page
  • 40. Adding Validation Controls to a Web Form Add a validation control Select the input control to validate Set validation properties 1 2 3 <asp:TextBox id=&quot;txtName&quot; runat=&quot;server&quot; /> <asp: Type_of_Validator id=&quot; Validator_id &quot; runat=&quot;server&quot; ControlToValidate=&quot; txtName &quot; ErrorMessage=&quot; Message_for_error_summary &quot; Display=&quot; static|dynamic|none &quot; Text=&quot; Text_to_display_by_input_control &quot;> </asp: Type_of_Validator>
  • 41. Combining Validation Controls Can have multiple validation controls on a single input control Only the RequiredFieldValidator checks empty controls
  • 42. Demonstration: Using Validation Controls Create an ASP.NET Web Form with TextBox and Button controls Add a RequiredFieldValidator control Add a RangeValidator control Add a RegularExpressionValidator control Add a ValidationSummary control

Editor's Notes

  • #14: RCW is the runtime callable wrapper, handles the interface between ASP.NET code and the unmanaged COM object
  • #24: &lt;&lt;may get rid of this one&gt;&gt;
  • #28: Derived from the Page class: Every .aspx page derives from the Page class and inherits all of the methods and properties that the Page class exposes. The @ Page directive defines the page-specific attributed that is used by the ASP.NET page parser and compiler when you build a page. When Visual Studio .NET creates the .aspx page file and the code-behind file for a Web Form, it generates a new class that inherits from the Page class. For example, if you create a new Web Forms page and name it WebForm1 , a new class named WebForm1 is derived from the Page class, as shown in the following code example: public class WebForm1 : System.Web.UI.Page Inheriting from the Page class not only makes all of the members of the Page class available to the code-behind file; it also allows ASP.NET to combine the code in the .aspx page file with the code in the code-behind file into a single compiled class at compile time. This single compiled class contains all of the methods and properties that are exposed by the Page class, as well as the methods and properties that are implemented by your code.