Beginning ASP.NET 4.5.1: in C# and VB
Buy Rights Online Buy Rights

Rights Contact Login For More Details

  • Wiley

More About This Title Beginning ASP.NET 4.5.1: in C# and VB

English

Build your ASP.NET 4.5.1 skills with real-world instruction

In this comprehensive guide to getting started with ASP.NET 4.5.1, best-selling author Imar Spaanjaars provides a firm foundation for coders new to ASP.NET and key insights for those not yet familiar with the important updates in the 4.5.1 release. Readers learn how to build full-featured ASP.NET websites using Visual Studio Express 2013 for Web, Microsoft’s free development tool for ASP.NET web applications. Beginning ASP.NET 4.5.1 guides you through the process of creating a fully functional, database-driven website, from creation of the most basic site structure all the way down to the successful deployment of the website to a production environment.

Beginning ASP.NET 4.5.1: in C# and VB: 

  • Explains how to get started with ASP.NET 4.5.1, including an introduction to Microsoft’s Visual Studio Express 2013 for Web
  • Features helpful examples for designing websites with CSS and HTML and how to overcome common formatting problems
  • Shares techniques for managing server controls in ASP.NET, including standard controls, HTML controls, and data controls
  • Provides real-world tips for creating consistent page layouts throughout your websites
  • Covers practical functionality issues like validating user input, sending e-mail from your website, and processing data at the server
  • Details what the ASP.NET state engine is and why it is important
  • Shows how to access and modify data in a SQL Server database
  • Includes coverage of jQuery, LINQ, and the Entity Framework
  • Explores measures to take for optimal security

English

Imar Spaanjaars, a Microsoft ASP.NET MVP and an ASPInsider, is the CTO of Dynamicweb North America. He is a bestselling author for Wrox and one of the top contributors to the Wrox Community Forum at p2p.wrox.com, with more than 15,000 answers to programmer questions.

English

Foreword xxv

Introduction xxvii

Chapter 1: Getting Started with ASP .NET 4.5.1 1

Microsoft Visual Studio Express for Web 2

Getting Visual Studio 3

Installing Visual Studio Express for Web (VSEW) 3

Creating Your First ASP.NET 4.5.1 Website 5

An Introduction to ASP.NET 4.5.1 9

Understanding HTML 10

A First Look at ASP.NET Markup 15

A Tour of the IDE 16

The Main Development Area 16

Informational Windows 22

Customizing the IDE 23

Rearranging Windows 23

Modifying the Toolbox 24

Customizing the Document Window 26

Customizing Toolbars 27

Customizing Keyboard Shortcuts 28

Resetting Your Changes 28

The Sample Application 29

Practical Tips on Visual Studio 30

Summary 31

Chapter 2: Building an ASP .NET Website 33

Creating Websites with Visual Studio 2013 34

Different Project Types 34

Choosing the Right Website Template 35

Creating and Opening a New Website 37

Working with Files in Your Website 41

The Many File Types of an ASP.NET Website 41

Adding Existing Files 44

Organizing Your Site 45

Special File Types 46

Working with Web Forms 47

The Different Views on Web Forms 47

Choosing between Code Behind and Pages with Inline Code 49

Adding Markup to Your Page 54

Connecting Pages 59

Practical Tips on Working with Web Forms 61

Summary 61

Chapter 3: Designing Your Web Pages 63

Why Do You Need CSS? 64

Problems with Using HTML Formatting 64

How CSS Fixes Formatting Problems 65

An Introduction to CSS 65

CSS — The Language 69

The Style Sheet 70

Adding CSS to Your Pages 82

Working with CSS in Visual Studio 84

Using the CSS Editor 85

Creating Embedded and Inline Style Sheets 89

Applying Styles 93

Managing Styles 94

Practical Tips on Working with CSS 97

Summary 97

Chapter 4: Working with ASP .NET Server Controls 101

Introduction to Server Controls 102

A Closer Look at ASP.NET Server Controls 106

Defining Controls in Your Pages 106

Common Properties for All Controls 106

Types of Controls 109

Standard Controls 109

HTML Controls 122

Data Controls 123

Validation Controls 123

Navigation Controls 123

Login Controls 123

Ajax Extensions 124

WebParts 124

Dynamic Data 124

The ASP.NET State Engine 124

What Is State and Why Is It Important? 124

How the State Engine Works 125

Not All Controls Rely on View State 129

A Note about View State and Performance 130

Practical Tips on Working with Controls 131

Summary 132

Chapter 5: Programming Your ASP .NET Web Pages 135

Introduction to Programming 136

Data Types and Variables 137

Converting and Casting Data Types 140

Using Arrays and Collections 142

Statements 147

Operators 147

Making Decisions 155

Loops 162

Organizing Code 167

Methods: Functions and Subroutines 167

The App_Code Folder 169

Organizing Code with Namespaces 173

Writing Comments 176

Object Orientation Basics 178

Important OO Terminology 178

Events 190

Practical Tips on Programming 191

Summary 192

Chapter 6: Creating Consistent Looking Websites 195

Consistent Page Layout with Master Pages 196

Creating Master Pages 198

Creating Content Pages 200

Using a Centralized Base Page 206

An Introduction to the ASP.NET Page Life Cycle 207

Implementing the Base Page 208

Creating Reusable Page Templates 212

Themes 216

Different Types of Themes 217

Choosing Between Theme and StyleSheetTheme 217

Applying Themes 218

Extending Themes 222

Dynamically Switching Themes 224

Skins 232

Creating a Skin File 233

Named Skins 234

Disable Theming for Specific Controls 235

Practical Tips on Creating Consistent Pages 235

Summary 236

Chapter 7: Navigation 239

Different Ways to Move Around Your Site 240

Understanding Absolute and Relative URLs 240

Understanding Default Documents 243

Using the Navigation Controls 243

Architecture of the Navigation Controls 244

Examining the Web.sitemap File 244

Using the Menu Control 246

Using the TreeView Control 254

Using the SiteMapPath Control 258

Routing 260

Setting up Extension-less URLs 261

Considerations for Extension-less URLs 263

Programmatic Redirection 263

Programmatically Redirecting the Client to a Different Page 264

Server-Side Redirects 266

Practical Tips on Navigation 268

Summary 269

Chapter 8: User Controls 273

Introduction to User Controls 274

Creating User Controls 274

Adding User Controls to a Content Page or Master Page 277

Sitewide Registration of User Controls 280

User Control Caveats 282

Adding Logic to Your User Controls 284

Creating Your Own Data Types for Properties 284

Implementing View State Properties 289

View State Considerations 295

Practical Tips on User Controls 295

Summary 296

Chapter 9: Validating User Input 299

Gathering Data from the User 300

Validating User Input in Web Forms 301

Understanding Request Validation 320

Processing Data at the Server 321

Sending E-mail from Your Website 321

Reading from Text Files 327

Practical Tips on Validating Data 333

Summary 333

Chapter 10: ASP .NET AJAX 337

Introducing Ajax 338

Using ASP.NET AJAX in Your Projects 340

Creating Flicker-free Pages 340

Providing Feedback to Users 345

The Timer Control 350

Using Web Services in Ajax Websites 351

What Are Web Services? 351

Creating Web Services 357

Practical Ajax Tips 365

Summary 366

Chapter 11: jQuery 369

An Introduction to jQuery 370

Introducing NuGet 371

Choosing the Location for Your jQuery Reference 375

Different Ways to Include the jQuery Library 376

jQuery Syntax 380

jQuery Core 380

Selecting Items Using jQuery 381

Modifying the DOM with jQuery 388

CSS Methods 388

Handling Events 390

Miscellaneous jQuery Functionality 391

Common Mistakes When Working with jQuery 392

Effects with jQuery 393

jQuery and Validation 399

Practical Tips on jQuery 403

Summary 403

Chapter 12: Introducing Databases 407

What Is a Database? 408

Different Kinds of Relational Databases 409

Installing SQL Server 2012 Express 410

Using SQL to Work with Database Data 410

Retrieving and Manipulating Data with SQL 414

Reading Data 414

Creating Data 423

Updating Data 424

Deleting Data 424

Creating Your Own Tables 427

Data Types in SQL Server 427

Understanding Primary Keys and Identities 429

Creating Relationships between Tables 432

Practical Database Tips 436

Summary 436

Chapter 13: Displaying and Updating Data 439

Data Controls 439

Data-bound Controls 440

Data Source Controls 442

Other Data Controls 442

Data Source and Data-bound Controls Working Together 443

Displaying and Editing Data with Grid View 443

Inserting Data with Details View 449

Storing Your Connection Strings in Web.config 451

Filtering Data 453

Customizing the Appearance of the Data Controls 459

Configuring Columns or Fields of Data-bound Controls 460

Updating and Inserting Data 466

Using Details View to Insert and Update Data 466

Practical Tips for Displaying and Updating Data 480

Summary 481

Chapter 14: LIN Q and the ADO .NET Entity Framework 485

Introducing LINQ 486

LINQ to Objects 487

LINQ to XML 487

LINQ to ADO.NET 487

Introducing the ADO.NET Entity Framework 488

Mapping Your Data Model to an Object Model 489

Introducing Query Syntax 495

Standard Query Operators 495

Shaping Data with Anonymous Types 499

Using Model Binding with LINQ Queries 504

Introducing Model Binding 505

A Note about Performance 535

Practical LINQ and ADO.NET Entity Framework Tips 536

Summary 536

Chapter 15: Working with Data — Advanced Topics 539

Formatting Your Controls Using Styles 540

An Introduction to Styles 541

Combining Styles, Themes, and Skins 545

Handling Events 549

The ASP.NET Page and Control Life Cycles Revisited 549

The ASP.NET Page Life Cycle and Events in Data Controls 555

Handling Errors That Occur in the

Data Source Controls 560

Hand-Coding Data Access Code 564

Caching 574

Common Pitfalls with Caching Data 575

Different Ways to Cache Data in ASP.NET Web Applications 576

Practical Data Tips 585

Summary 586

Chapter 16: Security in Your ASP .NET Website 589

Introducing Security 590

Identity: Who Are You? 590

Authentication: How Can You Prove Who You Are? 590

Authorization: What Are You Allowed to Do? 591

An Introduction to the ASP.NET Application Services 591

Introducing the Login Controls 593

The Login Controls 598

Configuring Your Web Application 609

The Role Manager 612

The Role Manager Configuration 613

Managing Users with the WSAT 613

Configuring the Web Application to Work with Roles 618

Programmatically Checking Roles 622

Practical Security Tips 625

Summary 626

Chapter 17: Personalizing Websites 629

Understanding Profile 630

Configuring the Profile 631

Using the Profile 637

Other Ways of Dealing with Profile 655

Anonymous Identification 655

Cleaning Up Old Anonymous Profiles 655

Looking at Other Users’ Profiles 657

Practical Personalization Tips 660

Summary 660

Chapter 18: Exception Handling, Debugging, and Tracing 663

Exception Handling 664

Different Types of Errors 664

Catching and Handling Exceptions 667

Global Error Handling and Custom Error Pages 675

The Basics of Debugging 683

Tools Support for Debugging 686

Moving Around in Debugged Code 686

Debugging Windows 687

Debugging Client-Side Script 693

Debugging with the Page Inspector 696

Introducing the Page Inspector 696

Using the Page Inspector 697

Cross-browser Testing with Browser Link 701

Introducing Browser Link 702

Using Browser Link 702

Tracing Your ASP.NET Web Pages 704

Using the Standard Tracing Capabilities 705

Adding Your Own Information to the Trace 708

Tracing and Performance 710

A Security Warning 710

Practical Debugging Tips 711

Summary 712

Chapter 19: Deploying Your Website 715

Preparing Your Website for Deployment 716

Avoiding Hard-Coded Settings 716

The Web.config File 717

Expression Syntax 717

The Web Configuration Manager Class 718

Introducing Bundling and Minification 723

Preparing for Deployment 727

Publishing Your Site 727

Introducing Web.config Transformations 730

Running Your Site Under IIS 734

Installing and Configuring the Web Server 735

Installing and Configuring ASP.NET 737

Understanding Security in IIS 741

NTFS Settings for Planet Wrox 742

Troubleshooting Web Server Errors 745

Moving Data to a Remote Server 747

Exporting Your Data to a File 748

Recreating the Database 750

The Deployment Checklist 751

What’s Next 753

Summary 754

Appendix A: Exercise Answers 757

Appendix B: Configuring SQL Server 2012 781

Index 795

loading