Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

professional asp.net 4.5 in c# and vb
PREMIUM
Số trang
1444
Kích thước
45.4 MB
Định dạng
PDF
Lượt xem
789

professional asp.net 4.5 in c# and vb

Nội dung xem thử

Mô tả chi tiết

www.it-ebooks.info

ffirs.indd i 4/10/2013 9:08:25 PM

www.it-ebooks.info

PROFESSIONAL ASP.NET 4.5 IN C# AND VB

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xliii

PART I ASP.NET FUNDAMENTALS

CHAPTER 1 One ASP.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

CHAPTER 2 HTML5 and CSS3 Design with ASP.NET . . . . . . . . . . . . . . . . . . . . . . . . . . .17

CHAPTER 3 ASP.NET Web Forms Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

PART II CONTROLS

CHAPTER 4 ASP.NET Server Controls and Client-Side Scripts . . . . . . . . . . . . . . . . . 103

CHAPTER 5 ASP.NET Web Server Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

CHAPTER 6 Validation Server Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

CHAPTER 7 User and Server Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

PART III DATA ACCESS

CHAPTER 8 Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

CHAPTER 9 Model Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

CHAPTER 10 Querying with LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371

CHAPTER 11 Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411

CHAPTER 12 ASP.NET Dynamic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443

CHAPTER 13 Working with Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455

PART IV PROVIDERS

CHAPTER 14 Introduction to the Provider Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

CHAPTER 15 Extending the Provider Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

PART V ASP.NET FEATURES

CHAPTER 16 Working with Master Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591

CHAPTER 17 Site Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621

CHAPTER 18 Personalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671

CHAPTER 19 Membership and Role Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701

CHAPTER 20 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759

Continues

ffirs.indd i 4/10/2013 9:08:25 PM

www.it-ebooks.info

PART VI APPLICATION STATE

CHAPTER 21 State Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791

CHAPTER 22 Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823

PART VII CLIENT-SIDE DEVELOPMENT

CHAPTER 23 ASP.NET AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857

CHAPTER 24 Ajax Control Toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895

CHAPTER 25 jQuery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957

CHAPTER 26 Real-Time Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983

CHAPTER 27 Developing Websites with Mobile in Mind . . . . . . . . . . . . . . . . . . . . . . 1001

PART VIII APPLICATION CONFIGURATION AND DEPLOYMENT

CHAPTER 28 Confi guration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1027

CHAPTER 29 Debugging and Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075

CHAPTER 30 Modules and Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1105

CHAPTER 31 Asynchronous Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1121

CHAPTER 32 Building Global Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1135

CHAPTER 33 Packaging and Deploying ASP.NET Applications . . . . . . . . . . . . . . . . .1163

PART IX ADDITIONAL ASP.NET TECHNOLOGIES

CHAPTER 34 ASP.NET MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1187

CHAPTER 35 ASP.NET Web Pages and Razor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1215

PART X APPENDIXES

APPENDIX A Migrating Older ASP.NET Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1239

APPENDIX B COM Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1247

APPENDIX C ASP.NET Ultimate Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1257

APPENDIX D Administration and Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1269

APPENDIX E Dynamic Types and Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1295

APPENDIX F ASP.NET Online Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1305

APPENDIX G Visual Studio Extensibility with NuGet . . . . . . . . . . . . . . . . . . . . . . . . . . 1309

INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1333

ffirs.indd ii 4/10/2013 9:08:26 PM

www.it-ebooks.info

PROFESSIONAL

ASP.NET 4.5 in C# and VB

ffirs.indd iii 4/10/2013 9:08:26 PM

www.it-ebooks.info

ffirs.indd iv 4/10/2013 9:08:26 PM

www.it-ebooks.info

PROFESSIONAL

ASP.NET 4.5 in C# and VB

Jason N. Gaylord

Christian Wenz

Pranav Rastogi

Todd Miranda

Scott Hanselman

ffirs.indd v 4/10/2013 9:08:26 PM

www.it-ebooks.info

Professional ASP.NET 4.5 in C# and VB

Published by

John Wiley & Sons, Inc.

10475 Crosspoint Boulevard

Indianapolis, IN 46256

www.wiley.com

Copyright © 2013 by John Wiley & Sons, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-1-118-31182-0

ISBN: 978-1-118-42438-4 (ebk)

ISBN: 978-1-118-33205-4 (ebk)

ISBN: 978-1-118-33534-5 (ebk)

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,

electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108

of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization

through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,

MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the

Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011,

fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with

respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including

without limitation warranties of fi tness for a particular purpose. No warranty may be created or extended by sales or pro￾motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold

with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services.

If professional assistance is required, the services of a competent professional person should be sought. Neither the pub￾lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to

in this work as a citation and/or a potential source of further information does not mean that the author or the publisher

endorses the information the organization or Web site may provide or recommendations it may make. Further, readers

should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was

written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the

United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with stan￾dard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such

as a CD or DVD that is not included in the version you purchased, you may download this material at http://book

support.wiley.com. For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2013933610

Trademarks: Wiley, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or

registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other countries, and may

not be used without written permission. All other trademarks are the property of their respective owners. John Wiley &

Sons, Inc., is not associated with any product or vendor mentioned in this book.

ffirs.indd vi 4/10/2013 9:08:26 PM

www.it-ebooks.info

To my loving wife, Lisa, and our four awesome

children.

—Jason N. Gaylord

I would like to dedicate this book with the following

quote, to my mother who has been instrumental in my

upbringing and is an integral part of my life. Abraham

Lincoln said, “All that I am, or hope to be, I owe to

my angel mother.”

—Pranav Rastogi

To Kelly, Amber, and Sydney

—Todd Miranda

To my wife and the two little boys I work for.

—Scott Hanselman

ffirs.indd vii 4/10/2013 9:08:27 PM

www.it-ebooks.info

ffirs.indd viii 4/10/2013 9:08:27 PM

www.it-ebooks.info

ABOUT THE AUTHORS

JASON N. GAYLORD is an application developer and Director of Technology at United

One Resources in Wilkes-Barre, Pennsylvania. His programming career started with a

simple GOTO statement and continued over 15 years of developing Windows and web

applications. During this time, Jason has had the opportunity to plan, build, test, and

deploy several enterprise applications including integrations with accounting and operating

systems and B2B web applications used by some of the top banks in the United States.

Outside of the normal day to day activities, Jason blogs, speaks, and organizes technology

events including TECHbash and NEPA GiveCamp. He’s the group leader for the .NET

Valley technology user group. Recently, Jason was recognized as a Microsoft MVP for 10 consecutive years.

He remains a member of the ASPInsiders, a group that provides product feedback directly to the ASP.NET

team. You can fi nd out more about Jason by visiting his website at jasongaylord.com. You can follow him

on Twitter at @jgaylord.

CHRISTIAN WENZ started working almost exclusively with web technologies in 1993 and

has not looked back since. As a developer and project manager he has been responsible

for websites from medium–sized companies up to large, international enterprises. As an

author, he has written or co-written over 100 books that have been translated into 10 lan￾guages. As a consultant, he helped companies and teams of developers to make their appli￾cations more reliable, better performing, and more secure. Christian frequently writes for

various IT magazines, is a sought-after speaker at developer conferences around the world,

and is always keen on sharing technologies he is excited about with others. He contributes

to various open source projects, is a Microsoft ASP.NET MVP and an ASPInsider, and co-author of several

developer certifi cations. You can follow him on Twitter at @chwenz.

PRANAV RASTOGI is a member of the Microsoft ASP.NET product team and is based in

Seattle. Over the past years, Pranav has worked on a variety of areas such as ASP.NET

Web Forms, Dynamic Data, and more recently ASP.NET SignalR. He is passionate about

understanding web developer woes with the Microsoft stack and helps champion tools,

packages, or libraries that will enhance the web development experience on the Microsoft

stack. Pranav is also a regular speaker on a variety of ASP.NET related topics at various

worldwide conferences. He blogs about his experiences at http://blogs.msdn.com/b/

pranav_rastogi/. Before joining Microsoft, Pranav graduated from the University Of

Florida with a masters in Computer Science.  

Pranav is also a food junkie who sometimes works as a Chef de Cuisine at home. He is an adventure seeker

and can be often found backpacking in the wilderness. In this spare time Pranav regularly practices his bar￾tending skills on his friends. If you know anyone who is looking to throw a party and needs a bartender,

then get in touch with him. You can follow Pranav on Twitter at @rustd.

ffirs.indd ix 4/10/2013 9:08:27 PM

www.it-ebooks.info

TODD MIRANDA is an active proponent of .NET technologies and software craftsman￾ship as a whole. He has been developing on various platforms for over 20 years and has

been involved with .NET since it was previewed in 2000. He has worked with many of

the .NET platforms but focuses primarily on ASP.NET. He is the owner of NxtDimension

Solutions and provides consulting and training on the Microsoft stack. As a Microsoft

MVP, Todd works closely with Microsoft. He is the co-founder of the Birmingham .NET

User Group and remains active in the development community. He has recorded hundreds

of online training videos on Microsoft development topics including security, JavaScript,

Silverlight, WPF, Expression, and ASP.NET. He is an INETA speaker and regularly

presents at user groups, community events, and technical conferences. You can follow

Todd on Twitter @tmiranda.

SCOTT HANSELMAN is a web developer who has been blogging at http://hanselman

.com for over a decade. He works on Azure and ASP.NET for Microsoft out of his home

offi ce in Portland, Oregon. Scott has three podcasts, http://hanselminutes.com for

tech talk, http://thisdeveloperslife.com on developers’ lives and loves, and http://

ratchetandthegeek.com for pop culture and tech media. He’s written a number of books

and spoken in person to almost a half million developers worldwide. You can follow Scott

on Twitter at @shanselman.

ABOUT THE TECHNICAL EDITORS

KEN COX has been creating web applications with Microsoft technologies since the earliest betas of ASP

Classic in the mid-1990s. He has worked on dozens of ASP.NET sites, large and small, and is the author

of ASP.NET 3.5 For Dummies published by John Wiley & Sons. Ken was honored as a Microsoft Most

Valuable Professional (MVP) for ASP.NET for 15 consecutive years prior to his retirement and remains an

ASPInsider. Ken does consulting work from his home in Nipissing Township, Ontario, Canada.

BIPIN JOSHI is an independent blogger and author who writes about apparently unrelated topics — yoga

and technology. A former software consultant and trainer by profession, Bipin has been programming

since 1995 and has worked with the .NET Framework since its inception. He is a published author and has

authored or co-authored more than a half dozen books and numerous articles on .NET technologies. Bipin

was a Microsoft Most Valuable Professional (MVP) and a Microsoft Certifi ed Trainer (MCT) during his

tenure as a software consultant and trainer. He has also penned a few books on yoga. Having embraced the

yoga way of life, he enjoys the intoxicating presence of God and writes about yoga, life, and technology.

He can be reached at www.bipinjoshi.com.

JOHN PETERSEN, an early adopter of the Microsoft .NET Platform, has over 20 years of experience archi￾tecting and developing software. Currently, John is a practice director in the Technology Platform Group at

Neudesic, LLC, a Microsoft National Systems Integrator and Gold ISV Partner and is a 10-time recipient

of Microsoft’s Most Valuable Professional Award. John is a current ASP.NET/IIS MVP. John has spoken at

numerous industry events, including VSLive and DevConnections, as well as at many regional events and

Code Camps. John is also a regular contributor to CODE Magazine.

ffirs.indd x 4/10/2013 9:08:27 PM

www.it-ebooks.info

JEFFERY TAY has been developing and designing .NET solutions since 2002, specializing in solutions

for the education and medical sectors. He was awarded Microsoft Most Valuable Professional for the last

3 years. He has experience in Java and most Microsoft technologies such as Silverlight, SQL Server, and

Windows Server. He is an associate director at the National University of Singapore where he leads a team

that manages the university’s Learning Management System and comes up with new solutions where the use

of IT can enhance teaching. You can reach Jeffery at [email protected].

DEEPAK VERMA has been developing and designing web solutions for the last 10 years. During these years,

Deepak has been involved in technologies such as Flash Scripting, Flex, ColdFusion, Silverlight, Java, and

PHP and now is mostly working on Microsoft stack. He is currently working as a Software Development

Engineer in Test for Microsoft. At Microsoft he has contributed to Visual Studio Dynamic data tooling,

multi-targeting, Razor editor and tooling, Azure SDK for Java, PHP & .NET, Visual Studio HTML and

CSS editors, Azure Mobile Services, and NuGet. He lives in Redmond, Washington, with his wife, Madhu,

and children, Adya and Kian. You can reach him at [email protected].

ffirs.indd xi 4/10/2013 9:08:27 PM

www.it-ebooks.info

ffirs.indd xii 4/10/2013 9:08:27 PM

www.it-ebooks.info

ACQUISITIONS EDITOR

Mary James

SENIOR PROJECT EDITOR

Kevin Kent

TECHNICAL EDITORS

Ken Cox

Bipin Joshi

John Petersen

Jeff ery Tay

Deepak Verma

SENIOR PRODUCTION EDITOR

Kathleen Wisor

COPY EDITORS

Kim Cofer

Kezia Endsley

EDITORIAL MANAGER

Mary Beth Wakefi eld

FREELANCER EDITORIAL MANAGER

Rosemarie Graham

ASSOCIATE DIRECTOR OF MARKETING

David Mayhew

MARKETING MANAGER

Ashley Zurcher

BUSINESS MANAGER

Amy Knies

PRODUCTION MANAGER

Tim Tate

VICE PRESIDENT AND EXECUTIVE GROUP

PUBLISHER

Richard Swadley

VICE PRESIDENT AND EXECUTIVE PUBLISHER

Neil Edde

ASSOCIATE PUBLISHER

Jim Minatel

PROJECT COORDINATOR, COVER

Katie Crocker

PROOFREADER

Nancy Carrasco

INDEXER

Robert Swanson

COVER DESIGNER

Elizabeth Brooks

COVER IMAGE

© Marilyn Nieves / iStockphoto

BACKGROUND

© PhotoAlto Images/Fotosearch

CREDITS

ffirs.indd xiii 4/10/2013 9:08:27 PM

www.it-ebooks.info

Tải ngay đi em, còn do dự, trời tối mất!