1. Trang chủ
  2. » Công Nghệ Thông Tin

Beginning ASP NET 4 5 1 in c and VB

868 364 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 868
Dung lượng 23,27 MB

Nội dung

www.it-ebooks.info www.it-ebooks.info Beginning ASP.NET 4.5.1 Foreword xxv Introduction xxvii Chapter 1 Getting started with ASP.NET 4.5.1 Chapter Building an ASP.NET Website 33 Chapter Designing Your Web Pages 63 Chapter Working with ASP.NET Server Controls 101 Chapter Programming Your ASP.NET Web Pages 135 Chapter Creating Consistent Looking Websites 195 Chapter 7 Navigation 239 Chapter User Controls 273 Chapter Validating User Input 299 Chapter 10 ASP.NET AJAX 337 Chapter 11 jQuery 369 Chapter 12 Introducing Databases 407 Chapter 13 Displaying and Updating Data 439 Chapter 14 LINQ and the ADO.NET Entity Framework 485 Chapter 15 Working with Data — ​Advanced Topics 539 Chapter 16 Security in Your ASP.NET Website 589 Chapter 17 Personalizing Websites 629 Chapter 18 Exception Handling, Debugging, and Tracing 663 Chapter 19 Deploying Your Website 715 Appendix A Exercise Answers 757 Appendix B Configuring SQL Server 2012 781 Index 795 www.it-ebooks.info ffirs.indd 25-02-2014 10:44:30 www.it-ebooks.info ffirs.indd 25-02-2014 10:44:30 Beginning ASP.NET 4.5.1 www.it-ebooks.info ffirs.indd 25-02-2014 10:44:30 www.it-ebooks.info ffirs.indd 25-02-2014 10:44:30 Beginning ASP.NET 4.5.1 in C# and VB Imar Spaanjaars www.it-ebooks.info ffirs.indd 25-02-2014 10:44:36 Beginning ASP.NET 4.5.1: in C# and VB Published by John Wiley & Sons, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2014 by John Wiley & Sons, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-1-118-84677-3 ISBN: 978-1-118-84690-2 (ebk) ISBN: 978-1-118-84696-4 (ebk) Manufactured in the United States of America 10 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 specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose No warranty may be created or extended by sales or promotional 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 publisher 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 standard 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://booksupport wiley.com For more information about Wiley products, visit www.wiley.com Library of Congress Control Number: 2013958296 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates, 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 www.it-ebooks.info ffirs.indd 25-02-2014 10:44:36 To Niek www.it-ebooks.info ffirs.indd 25-02-2014 10:44:36 www.it-ebooks.info ffirs.indd 25-02-2014 10:44:36 PostBack – providers PostBack, 550 postbacks ASP.NET Server Controls, 105 event handling, ASP.NET page life cycle, 208 HTML, 22 Page_Load, 294 Panel, 117 properties, 764–765 View State, 289 precompilation, 730 Predictable, 283, 439 Preference, 633 PreferredTheme, 229, 231 PreInit, 207, 224, 229, 762 PreLoad, 207 -PreRelease, 372 PreRender, 208, 211, 274 PreRenderComplete, 552 prev, 390 primary keys, 427–430 primitive types, 139 privacy, 225 Private, 181, 189 private, 189 Profile anonymous identification, 655–657 configuration, 631–637 data types, 633–634 IntelliSense, 635 looking at others’, 29–32 ManagePhotoAlbum, 650–655 personalization, 630–660 Reviews, 646–650 using, 636–654 web applications, 630–631 Profile, 778 IntelliSense, 635 Page, 635, 636, 657 properties, 630–631 , 631, 634 profile groups, 631, 632–633 profile provider, 636 ProfileCommon, 636, 657, 660 Profile.GetProfile(), 656 ProfileManager, 657 Profile_OnMigrateAnonymous, 656 ProfileParameter, 451 profiles anonymous, 777 application services, 591 development, 17 ProfileValueProvider, 510 programmatic caching, 578–585 p programmatic redirection, 263–268 client, 264–266 server-side redirects, 266–268 programmatically checking roles, 622–625 , 348, 349, 767 project files, 35 properties ASP.NET Server Controls, 106–109 automatic, 172 Code Behind, 765 controls, 758 CSS, 69, 73–74, 75 Properties Grid, 97 styles, 541 data types, user controls, 284–289 IntelliSense, 75 OO, 180–183 postbacks, 764–765 Profile, 630–631 read-only, 183 Style, 541–542 View State, user controls, 289–295 write-only, 183 , 631, 633, 634 Properties Grid, 104 ASP.NET Server Controls, 106 contact form, 313 controls, 758 CSS, 84, 91–92 properties, 97 DataPager, 530 DetailsView, 473 EF, 490 Events tab, 119 expression syntax, 717 HyperLinkField, 460 Login, 594 Panel, 115 Profile, 643 SiteMapPath, 258 state engine, 127 Table Designer, 428 UpdatePanel, 341 user controls, 277, 288, 295 Wizard, 119, 120 PropertyValueBinary, 636 PropertyValueStrings, 636 Protected, 189 protected, 189 ProviderName, 444–445 providers application services, 592–593 membership, 592 profile, 636 P p Q q Q Q Q Q Q R r R R R R r r R r r r _ R @ R r R r r r R R R r R R R R r R r R R 816 www.it-ebooks.info bindex.indd 816 25-02-2014 10:45:50 pseudo class selectors – Role Manager pseudo class selectors, 88 Public, 181, 189 public, 189 repeat, 349 Repeater, 439, 771 anonymous types, 503, 504 BulletedList, 649 Q Query Designer, 415, 418 query strings, 264–265 QueryExtender, 440 QueryString, 301, 515, 520, 535 QueryStringParameter, 451 QueryStringValueProvider, 510 Quick Launch, 26–27 R RadioButton, 109 range variables, 496 RangeValidator, 301, 310 Razor v2, 36 Razor v3, 36 ReadAllText, 328 readOnly, 631 read-only properties, 183 Redirect, 264, 774 redirectMode, 676 redirects, server-side, 266–268 references, 168, 373–374 _references.js, 393, 394, 769 Regions, 86 @ Register, 277–280 RegisterRoutes, 263 regular expressions, 310 RegularExpressionValidator, 310, 313 relational databases, 406, 407–408 relationships, tables, SQL, 430–433 relative URLs, 241–242 Release, 739, 740, 742, 744, 790 Remember Me Next Time, 598 RememberMeSet, 599 remote server database, 750–751 exporting data, 748–750 web deployment, 747–751 RemoteOnly, 675, 745, 752 Remove, 521, 579 Remove Inline Style, 96 RemoveAttributes, 734 removeClass, 387 RenderCurrentNodeAsLink, 259 rendering, 11, 47, 208 RenderingMode, 247, 248 RenderMode, 343 Cache API, 582 data-bound controls, 438 Page_Load, 650 Reviews, 647 styles, 543 Replace, 332 ReplyToList, 332 request validation, 320–321 requestLimit, 706 Request.QueryString, 274 request.QueryString, 265 RequiredFieldValidator, 301, 303–305, 313, 470, 639, 641 RequireEmail, 605 requireQuestionAndAnswer, 610 requiresUniqueEmail, 610 Reset Toolbox, 24 Reset Window Layout, 28 Resig, John, 368 Resources, 38 Response, 264 ResponseRedirect, 679 Response.Redirect, 266, 267, 763 Response.RedirectPermanent, 263–264, 266, 763 Response.TrySkipCustomErrors, 681 result, 356, 365 ResultLabel, 685 Review, 356, 441, 457, 465, 493, 494, 770 anonymous types, 500 Cache API, 583 hand-coding data access code, 567, 573 HyperLink, 649 JOIN, 418, 420 RowDataBound, 557 ReviewId, 583 Reviews, 560, 621 anonymous types, 503–504 Cache API, 580, 582 EF, 490 JavaScript, 357 Profile, 646–650 Reviews.aspx, 459, 467, 572 rgb, 74 rgba, 74 RightAligned, 67, 68, 69 Role Manager NuGet, 613 security, 612–625 WSAT, 613–618 817 www.it-ebooks.info bindex.indd 817 25-02-2014 10:45:50 RoleGroups – Server Controls RoleGroups, 601, 621 roles application services, 591, 793 programmatically checking, 622–625 web applications, 618–622 roles, 621, 776 root-based relative URLs, 241 RootNodeStyle, 258 RouteConfig, 261, 263 routing, 260–263 RowCreated, 552, 554 RowDataBound, 552, 554, 555–560 RowStyle, 542 RowType, 559 rule sets, CSS, 68, 96, 97, 251, 701 runat, 102–103 runtime application services, 793 controls, 760 errors, 666–667 files, ASPX, 695 HTML, 64 state engine, 128 Web.config, 780 Runtime Error Description, 747 S SaveButton_Click, 571 SaveChanges, 572 SByte, 760 script, 375 , 250, 321, 375, 394, 547, 724 ScriptManager, 340, 343 AJAX, 344–345, 360–365, 767 jQuery validation, 397, 400 master pages, 360, 374 unobtrusive JavaScript, 397, 399, 400 Web Forms, 360 ScriptManagerProxy, 340, 351, 361 ScriptReference, 399 ScriptResourceDefinition, 399, 400, 725 Scripts, 45, 345, 372, 393, 769 , 345, 374 search engine optimization (SEO), 585, 679 SearchEngineDescription, 585 section, 77 , 12, 72, 377 section#MainContent, 85–86 Secure Sockets Layer (SSL), 323 security, 589–627 See also authentication; authorization application services, 591–593 e-mail, 590 identity, 590 IIS, 741–742 login controls, 593–612 permissions, 591 practical tips, 625 Role Manager, 612–625 tracing, 710–711 web applications, 609–612 SELECT, 412–413, 415, 419, 424 Select, 486, 493, 495–496 , 13 SELECT *, 434, 455 Select Case/switch, 158–162, 294, 295 SelectCommand, 447, 457, 461, 578 Selected, 646 SelectedIndex, 110 SelectedIndexChanged, 226, 530, 554 SelectedItem, 109, 110 , 512 SelectedRowStyle, 542 SelectedValue, 110, 140, 685 Selecting, 551 SelectMethod, 505, 531, 573 DropDownList, 534, 567 ListView, 514, 515, 519 Profile, 643 selectors See also specific types CSS, 68–73, 222, 251 grouping and combining, 72–73 Page Inspector, 696 text editor, 88 elements, 68–69 embedded style sheets, 94 jQuery, 379–382 SelectParameters, 455, 466 SendButton_Click, 394, 721 SendMailOnError, 720, 722 SEO See search engine optimization Separator, 559 serialization, 357 Server Controls, ASP.NET, 101–133 Ajax Extensions, 124 ASPX, 102, 105 container, 114–117 data, 123 Dynamic Data, 124 HTML, 101–107, 122–123 list, 110–114 login, 123–124 navigation, 123 pages, 106 postback, 105 practical tips, 131 properties, 106–109 Standard, 109–122 S S s s s S S S s S S < < S S S s S S S S S S S S S S S S s S S S S s S S s S S S 818 www.it-ebooks.info bindex.indd 818 25-02-2014 10:45:51 Server Explorer – Split button types, 109–124 validation, 123 View State, 129–130 VS, 101 Web Forms, 101 WebParts controls, 124 Wizard, 117–121 Server Explorer, 18–19, 432 Server.GetLastError(), 682 server-side controls, 241–242 server-side redirects, 266–268 server-side validation, 302 Server.Transfer, 264, 267, 268, 763 Service Contract, WCF, 352, 353 ServiceContract, 353, 767 serviceMethodNameCallback, 354 ServiceReference, 361 Services, 345 , 360 , 363 SessionParameter, 451 SetFocusOnError, 309 Shared, 719 shorthand, 75–76, 90 ShowDeleteButton, 446 ShowEditButton, 446 ShowExpandCollapse, 255, 763 ShowInsertButton, 509 ShowLines, 255 ShowMessageBox, 317 ShowSelectButton, 446 ShowSummary, 317 ShowToolTips, 259 SignalR, 702 Signup.aspx, 595 Single, 498, 654, 773 single-item controls, 439 SingleLine, 306 SingleOrDefault, 498, 584 Site Map, 42, 44 sitemap, 42 SiteMapDataSource, 245, 258, 440, 578 siteMapNode, 245 SiteMapPath, 123, 245, 258–260 skin, 42 SkinID, 234 skins, 42, 232–235 CSS classes, 762 named, 234–235 styles, 545–549 themes, 216, 545–549 Skip, 497–498, 560 SkipWhile, 497–498 Sleep, 721 slideDown(), 392 slideToggle(), 392, 769 slideUp, 382, 392, 769 smallint, 426 Smart Tasks panel, 111, 118, 204, 381, 448, 555 DetailsView, 465, 467 DropDownList, 472, 473 GridView, 455, 550 Management, 618, 619 page life cycle, 550 Reviews.aspx, 459 SqlDataSource, 442, 459 state engine, 125 themes, 226 SMTP, 322, 325 , 322 SmtpClient, 322, 323, 671 SmtpException, 668–669 solid, 75 Solution Explorer, 18, 39, 41, 46, 60, 758 adding existing files, 44–45 CodeBehind.aspx, 51 CSS Box Model, 79 Default.aspx, 88, 201 Markup View, 304 MyProfile.aspx, 636 RequiredFieldValidator, 304 Start Page, 53 themes, 216 SortByCategory, 706 SortByTime, 706 Sorted, 554 SortedAscendingCellStyle, 543 SortedAscendingHeaderStyle, 543 SortedDescendingCellStyle, 543 SortedDescendingHeaderStyle, 543 Sorting, 554 SortOrder, 416–418, 424, 432, 547 anonymous types, 504 ORDER BY, 470 SqlDataSource, 443, 446 Table Designer, 428 Source, 38 source, 766 , 13 Source View, 20, 47, 758 Source.aspx, 265, 267 , 72, 94, 768 HTML tag, 13 HTML5, 399 UpdatePanel, 342 SpecifiedPickupDirectory, 326 speed, 769 Split button, 48 819 www.it-ebooks.info bindex.indd 819 25-02-2014 10:45:51 Split View – Structured Query Language (SQL) Split View, 20, 48, 67, 274, 717 SQL See Structured Query Language SQL Server application services, 592, 593, 793 attaching databases, 784–786 authentication, 782–783, 787–792 configuration, 781–793 connecting applications, 787–792 data types, 425–427 installation, 408 mdf, 44 NTFS settings, 744, 745 Number, 564 SQL Server Authentication, 782–783, 787–791 SQL Server Management Studio (SSMS), 407, 783–786 Advanced SQL Generation Options, 459 attaching databases, 784–786 installation, 408 ManagePhotoAlbum, 651 objects, 411 Query Designer, 415, 418 remote server, 748, 783–784 Table Designer, 427–430 SqlDataSource, 441–457 caching, 578 CreateDateTime, 476 CRUD, 441, 478 data source controls, 440 DataKeyNames, 449 DataSourceID, 445 Design View, 470 DetailsView, 469 DropDownList, 451–457, 775 event handling, 549 filters, 451–457 GridView, 441–447, 494 Id, 446 Name, 446 page life cycle, 550, 551, 554 Repeater, 771 Review, 457 RowDataBound, 559 SelectCommand, 447, 461 Selecting, 551 SelectParameters, 455 Smart Tasks panel, 459 SortOrder, 446 strongly typed data-bound controls, 523 UpdateCommand, 446, 476 , 446 SqlException, 561, 563 SqlExpress, 745 SqlRoleProvider, 593 Src, 278 src, 14 SSL See Secure Sockets Layer SSMS See SQL Server Management Studio StackTrace, 682 stale data, 575–576 Standard controls, 109–122, 308–309 Start Page, 20, 53 start phase, ASP.NET page life cycle, 207 state engine, 124–131 stateless, 124 statements, ASP.NET programming, 147–167 Static, 247, 283, 768 static, 719 static files, static text, 10 StaticEnableDefaultPopOutImage, 247 StepType, 118, 120 strict, 685 String, 212, 358, 765, 777 debugging, 686 postbacks, 764–765 Profile, 633 themes, 229 String.Format, 364, 365, 774 String.IsNullOrEmpty, 172 , 12, 758 strongly typed ArrayList, 145 LINQ queries, 494, 522–535 ObjectDataSource, 478 Structured Query Language (SQL), 405–436 See also SQL Server; SQL Server Authentication; SQL Server Management Studio creating data, 421–422 database data, 408–412 DELETE, 422 filters, 413–414 Id, 770 identity columns, 427–430 INSERT, 421–422 JOIN, 418–421 joining data, 418–421 LINQ, 486 ORDER BY, 414 ordering data, 414–418 primary keys, 427–430 reading data, 412–421 retrieving and manipulating data, 412–425 SELECT, 412–413 tables relationships, 430–433 T-SQL, 409 820 www.it-ebooks.info bindex.indd 820 25-02-2014 10:45:52 S s < s s S s S S S S s s s S S S S S s s S S S S S S < S S < Style – Text System.Web.Configuration, 719 System.Web.ModelBinding, 515 System.Web.Providers.dll, 594 System.Web.UI, 174, 211 System.Web.UI.Page, 206, 208, 210 System.Web.UI.WebControls, 541 UPDATE, 422 validation, 416 WHERE, 413–414 Style, 541–542 style, 66, 108, 234, 389 , 66, 82 style sheets CSS, 70–82 embedded, 82, 83–84 external, 82, 83–84 HTML, 83–84 inline, 82, 83–84 VS, 759 T style.background-color, 389 StyleBundle, 724 styles applying, 543–545 controls, 540–549 CSS properties, 541 VS, 93–96 GridView, 542–543 HTML attributes, 541 Menu, 251–254 skins, 545–549 themes, 545–549 Styles, 45, 85, 724–725 Styles.css, 77, 94, 96 StyleSheets, 726 StyleSheetTheme, 217, 218, 221, 762 styleSheetTheme, 752–753 submit, 396 subroutines, 167–169 Substitute, 121 Substring, 172 Sum, 497 Summary, 429, 469, 470, 583 Summary, 700 SummaryLabel, 580 svc, 43 switch, 685 syntax errors, 664 System.Caching.Cache.NoSlidingExpiration, 584 System.Data.SqlClient, 563 System.EventArgs, 190 System.Exception, 668 System.IO, 327, 529 System.Linq, 487 , 322, 670 System.Net.Mail, 321, 670, 725 System.String, 631, 636 , 595, 706, 777 T4 template, 489, 492 tab size, Document Window, 27 TabIndex, 107 , 13, 59, 439 Table Designer, 427–430 Table menu, 61 tables ASP.NET, 57–59 HTML, ListView, 522 JOIN, 420 relational database, 406 relationships, SQL, 430–433 Table Designer, 427–430 VS, 445 Tables node, Object Explorer, 432 Tag Selector, 94 TagName, 278 TagPrefix, 278 tags, ASP.NET, 15–16 HTML, 11–13, 59, 60, 97 master pages, 198 user controls, 277–278 Take, 497–498, 560, 772 TakeWhile, 497–498 target, 277 Target.aspx, 265 , 13, 59 Team Explorer, 19 Team Foundation Server (TFS), 19 TemplateField, 458, 555, 771 templates base page, 212–216 ListView, 525–529 temporary redirect, 264 _TestPage, 215 text, 54–56 Text Cache API, 581 CustomValidator, 315 debugging, 684 ErrorMessage, 309 exception handling, 667 821 www.it-ebooks.info bindex.indd 821 25-02-2014 10:45:52 text (continued) – TreeView Text (continued) expression syntax, 717 Label, 104, 129, 657 programmatically checking roles, 623 RequiredFieldValidator, 304 Standard validation controls, 308 TextBox, 109 text, SQL, 426 text editor, CSS, 85–89 text files, validation, 327–332 , 13 TextBox, 109 Body, 469 ControlToValidate, 470 debugging, 684 hand-coding data access code, 565–566 markup, 108 Markup View, 303 Profile, 637, 638, 641 RequiredFieldValidator, 305 Select Case/switch, 159, 160 state engine, 126, 127 strongly typed data-bound controls, 524 Summary, 469 Title, 470, 476 Toolbox, 21 Wizard, 118 TextMode, 109, 469, 470 hand-coding data access code, 566 HTML5, 305–306 Profile, 640 TFS See Team Foundation Server , 13 Theme, 217, 218, 221, 762 themes, 216–231 applying, 218–221 disabling, 235 extending, 222–224 images, 222–224 skins, 232, 545–549 styles, 545–549 switching, 224–231 types, 217 user selection, 226–231 this, 212, 389 $(this), 389 time, 426 timeout, 598 Timer, 340, 350–351 tinyint, 426 Title, 219, 375, 462, 678 anonymous types, 504 base page, 210, 211 Cache API, 580, 583, 585 exception handling, 669 HeaderText, 460 HyperLinkField, 461 InsertItemTemplate, 470 login controls, 594 Review, 356 SQL, 421 tables, 429 TextBox, 470, 476 title, 245 , 12, 66 title case search, 77–78, 80 TitleLabel, 580 To, 327 ToBoolean, 141 ToDateTime, 141 toggleClass, 387 ToList, 495, 504 toolbar area text, 54 Toolbox Button, 21, 112 CheckBoxList, 112 HTML, 26 TextBox, 21 VS, 109 ListView, 514 UpdatePanel, 341 user controls, 274 Wizard, 117 ToolTip, 107, 506, 518, 523, 524, 532 TOP, 412–413 ToString(), 140, 688 ToUpper(), 172 , 13, 59, 390, 548 Trace, 705, 709 TraceMode, 706 traceMode, 706 tracing, 704–711 Transact SQL (T-SQL), 409 Transfer, 267 Transform="Insert," 731 Transform="RemoveAttributes," 731 Transform="Replace," 731 Transform="SetAttributes," 731 transparency, 74 TreeView, 123, 654, 763 Login, 597 navigation controls, 254–258 Page Inspector, 700 Profile, 644 programmatically checking roles, 633 T T T T T T t t T < u u u U U u u u u U U U U U U U U 822 www.it-ebooks.info bindex.indd 822 25-02-2014 10:45:52 Triggers – validation Triggers, 343 Try, 667, 673, 779–780 TryCast, 142, 580, 584 TryUpdateModel, 510 , 446 UpdateProgress, 340, 346–350 , 348 Updating, 477 T-SQL See Transact SQL URL See uniform resource locator tt, 489, 490, 492 txt, 45 Type, 310, 311, 640 type, 82, 305, 631, 636 url(), 240 type inference, 494 Type selector, 71 U
    , 59, 439, 521, 532 HTML tag, 13 Menu, 250, 253 underline, 726 uniform resource locator (URL), 240 absolute, 242 aspx, 461 default documents, 243 extension-less, 261–263 friendly, 10 IIS, 739, 740 relative, 241–242 server-side redirects, 267 strongly typed data-bound controls, 524 uniqueidentifier, 426, 434 Universal Providers, 592, 609 Universal selector, 70–71, 380 unload phase, ASP.NET page life cycle, 208 unnamed instance, 782 unobtrusive JavaScript, 397–401 unordered lists, 59, 439, 771 Untitled Page, 206, 207 UPDATE, 424, 770 DropDownList, 478 GridView, 459 hand-coding data access code, 572 SQL, 422 WHERE, 425 Update, 477 UpdateCommand, 446, 476, 578 UpdateDateTime, 469, 474, 477, 501 default value, 430 hand-coding data access code, 571 tables, 429 UpdateMethod, 505 UpdateMode, 343 UpdatePanel, 349, 350–351, 767 AJAX, 340–344, 564 exception handling, 669 URL-rewrite scenarios, 267 user controls, 273–297 caveats, 282–284 ClientID, 282–283 ClientIDMode, 283–284 content pages, 277–280 creating, 274–277 logic, 284–295 master pages, 277–280 practical tips, 295 properties data types, 284–289 sitewide registration, 280–282 tags, 277–278 View State properties, 289–295 Web.config, 280–282 user input exception throwing, 301 GET, 300 POST, 300 validation, 299–335 e-mail, 321–327 Web Forms, 301–320 userContext, 355 userMessage, 667 userName, 325 Users, 597 users, 621 UsersInRoles, 617 V ValidateRequestMode, 321 validation client-side, 302, 766 DetailsView, 476 HTML5 data types, 305–308 jQuery, 397–401 practical tips, 333 processing data at server, 321–332 request, 320–321 server-side, 302 SQL, 416 Standard controls, 308–309 text files, 327–332 user input, 299–335 e-mail, 321–327 Web Forms, 301–320 823 www.it-ebooks.info bindex.indd 823 25-02-2014 10:45:53 validation controls – View State validation controls, 123, 207, 301–320 See also specific controls ValidationGroup, 309, 320 ValidationSummary, 308, 314–320 Value, 113, 114, 457 value, 172 Value Providers, 510 values CSS, 69, 74–75 declarations, 69 ValueToCompare, 311 var, 494 varbinary, 426 varchar, 426 variables ASP.NET programming, 137–147 backing, 180–181 C#, 139–140 camel case, 138 debugging, 687–688 NET Framework, 139–140 range, 496 reference, 168 VB.NET, 139–140 VaryByParam, 577 vb, 43 VB.NET, 139 access modifiers, 189 anonymous identification, 656 anonymous types, 499, 500, 502 arithmetic operators, 148–150 Array.Resize, 144 base page, 212 Cache API, 581, 583, 584–585 casting data types, 141–142 classes, 179 comments, 176–178 comparison operators, 151–152 concatenation operators, 152–153 constructors, 184–186 cookies, 224–225 custom error pages, 676–678 CustomValidator, 319 DataPager, 531, 532, 533 debugging, 685 DetailsView, 468, 474 EF, 488, 491 e-mail, 326–327 event handling, 551, 552 events, 190–191 exception handling, 668–674 fields, 180 generics, 146–147 hand-coding data access code, 567–568, 571, 572–574 inheritance, 186–188 Inherits, 461 LINQ, 486 LINQ queries, 494 Model Binding, 508 ListView, 514, 515–516, 517, 519, 520, 521, 528 logic errors, 666 logical operators, 154–155 ManagePhotoAlbum, 651, 652 Me, 212 methods, 183–184 functions, and subroutines, 167–169 namespaces, 173–175 NavigateUrl, 293 objects, 179 OnTick, 351 OperationMethod, 360 Optional, 553 Profile, 633, 634, 635, 636, 637–638, 642, 643, 644, 645, 657 programmatic caching, 579, 580 programmatically checking roles, 623, 633 properties, 180–183 read-only and write-only properties, 183 Reviews, 647 roles, 622 RowDataBound, 556, 557, 559, 560 syntax errors, 665 templates, 215 themes, 231 tracing, 704, 709 value, 172 variables, 139–140 WCF, 353, 355, 358 Web.config, 720, 721, 723 WebConfigurationManager, 719 vbproj, 35 VerticalAlign, 542 VerticalPanel, 768 , 13 Vieira, Robert, 420 View menu, Notification window, 17 View Page Source, 9, 116, 202, 397 View Source, 9, 116, 202, 397 View State ASP.NET page life cycle, 207 ASP.NET Server Controls, 129–130 controls, 760 performance, 130–131 properties, user controls, 289–295 state engine, 128 ViewState, 764 Wizard, 120 V V _ V v v v V V V V V 824 www.it-ebooks.info bindex.indd 824 25-02-2014 10:45:53 ViewDetails.aspx – Visual Studio Express 2013 for Web (VSEW) ViewDetails.aspx, 580, 582–583, 585, 647 ViewState, 764 VIEWSTATE, 128, 130, 342, 760 ViewStateMode, 130–131 virtual, 188 virtualFolder, 529 visibility, 74 Visible, 107, 115, 469, 477, 704 exception handling, 673 programmatically checking roles, 634 tracing, 704 VisibleWhenLoggedIn, 599 Visual Basic, 52, 113, 172, 211, 287 Visual Basic.NET, Visual Studio (VS) AJAX, 338 ASP.NET, Server Controls, 101, 106 ASP.NET 1.0, base page, 210 Browser Link, 702–704 class, 93 code snippets, 303 comments, 87 content pages, 203 CSS, 84–96 properties, 74 styles, 93–96 text editor, 85–89 data tips, 690 debugging, 684 Design View, 48 DetailsView, 473 DropDownList, 457 editors, 48 event handling, 491 expression syntax, 717 File Explorer, 215, 220 GridView, 457 HTML, 56 IDE, 31 IIS, 737 inline style sheets, 96 IntelliSense, 50, 363–364 jQuery, 393 keyboard shortcuts, 28 , 79 LINQ to ADO.NET, 487 Markup View, 92, 508 NuGet, 369–373 Panel, 116 practical tips, 30–31 result, 356 shorthand declarations, 90 style sheets, 759 , 59 tables, 445 , 59 templates, 215 text, 56 themes, 220 Toolbox, 109 ListView, 514 UpdatePanel, 341 user controls, 274 , 59 Untitled Page, 207 user controls, 280 WCF, 357 web deployment, 727–730 Web Forms, 48 Web.sitemap, 245 Windows Explorer, 45 WSAT, 614 Visual Studio 2005, Visual Studio 2008, Visual Studio 2013, creating websites, 34–41 opening existing websites, 40–41 Web Application Projects, 34–35 Web Site Projects, 34 website templates, 35–37 Visual Studio 2013 IDE, 16–29 customization, 23–29 development area, 16–22 development profiles, 17 Document Window, 19–20 customization, 26–27 Error List, 22 Find Results window, 23 informational windows, 22–23 keyboard shortcuts, customization, 28 Main menu, 17 Notification window, 17 Output window, 22 Properties Grid, 19 resetting changes, 28–29 Server Explorer, 18–19 Solution Explorer, 18 Start Page, 20 Team Explorer, 19 toolbar area, 17–18 customization, 27 Toolbox, 18 modifying, 24–26 resetting, 28 Visual Studio Express 2013, 2, 139 Visual Studio Express 2013 for Web (VSEW), 2–5, 17 825 www.it-ebooks.info bindex.indd 825 25-02-2014 10:45:53 Visual Studio.NET – Web.config Visual Studio.NET, Visual Web Developer (VWD), 63 VS See Visual Studio VSEW See Visual Studio Express 2013 for Web VWD See Visual Web Developer W W3C See World Wide Consortium Warn, 709 Watch window, 687–688, 693 WCF See Windows Communication Foundation WCF Services, 43 Web API, 35 Web Application Projects, 34–35 web applications caching, 576–585 configuration, 609–612 Profile, 630–631 roles, 618–622 security, 609–612 Web Deploy, 728 Web Deploy Package, 728 web deployment, 715–755 bundling, 723–727 checklist, 751–753 expression syntax, 717–718 IIS, 727, 734–747 minification, 723–727 preparing, 727–734 publishing, 727–730 remote server, 747–751 VS, 727–730 Web.config, 717, 719–723 Web.config Transformations, 730–734 WebConfigurationManager, 718–719 Web Essentials, 704 Web Forms, adding with code, 49–53 application services, 592 ASP.NET, 47–61 ASP.NET Server Controls, 101 aspx, 42 Code Behind, 49–53, 61, 509, 556 CSS, 66 DetailsView, 465 Document Window, 27, 47 Format menu, 61 Global.asax, 678 hand-coding data access code, 565 HTML, 48–49, 61 inline code, 49–53 jQuery, 369 LINQ queries, Model Binding, 505 Panel, 115 POST, 128 practical tips, 61 programmatic redirection, 265 RowDataBound, 556 ScriptManager, 360 Signup.aspx, 595 state engine, 128 Table menu, 61 user input validation, 301–320 VS, 48 Web Application Projects, 34 Web Site Projects, 34 Web Forms Site, 36 Web Pages, 36 Web Platform Installer (WPI), 3, 736 web server IIS, 735–747 troubleshooting, 745–747 web services AJAX, 351–365 creating, 357–365 Web Site Administration Tool (WSAT), 613–618 Web Site Projects, 169 opening websites, 40 Profile, 631, 635 Visual Studio 2013, 34 Web User Control, 42 Web.config, 42, 723 application services, 793 , 398, 717 authentication, 598 , 595, 598 bundling, 725, 727 caching, 576 connection strings, 449–451 , 449–451, 595, 771 , 745 debugging, 751 enabled, 710–711 exception handling, 670 expression syntax, 718 IIS, 739, 740 jQuery validation, 397, 400 Management, 618, 620, 621 ManagePhotoAlbum, 651 NTFS settings, 744 Page Inspector, 697 , 221, 762 Profile, 631, 633, 634, 635, 636 , 631, 634 Profile service, 630 ProviderName, 445 Release, 739, 740 W W W W W W W W W w W W W W W w W w W W w W W 826 www.it-ebooks.info bindex.indd 826 25-02-2014 10:45:54 Web.config Transformations – zero-based RequiredFieldValidator, 304–305 ResponseRedirect, 679 runtime, 780 ScriptManager, 363 SMTP, 325 Solution Explorer, 39 SQL Server Authentication, 791 styles, 546 , 322 , 777 themes, 218, 219 tracing, 707, 708 unobtrusive JavaScript, 397, 400 user controls, 280–282 WCF, 357, 362 web deployment, 717, 719–723, 752 WSAT, 617 XML, 44 Web.config Transformations, 730–734, 752 WebConfigurationManager, 718–719 Web.Debug.config, 39 WebException, 671 WebForms, 399 WebParts controls, 124 WebResource.axd, 250–251 WebServices, 358 WebServices.aspx, 362 website templates, 35–37 Web.sitemap, 244–246, 255, 533 Web.To local disk.config, 732 WHERE, 418, 425, 770 SelectParameters, 455 SQL, 413–414 Where, 486, 493, 496, 515, 650, 774 While loop, 165–166 whitespace, 76 Width, 107, 470, 542, 640 width, 73, 76, 84 Window menu, 28 Windows, 598 windows, debugging, 687–693 Windows Authentication, 782–783, 791–792 Windows Communication Foundation (WCF) AJAX, 339, 352–365, 767 JSON, 359 client-side code, 354–355 complex objects, 355–360 IntelliSense, 363–364 JSON, 357 metadata, 359 serialization, 357 VS, 357 Web.config, 357, 362 Windows Event Viewer, 745 Windows Explorer, 45, 758 Windows Regional Settings, Wizard, 117–121 Smart Tasks panel, 118 Toolbox, 117 WizardStep, 118 World Wide Consortium (W3C), 66 WPI See Web Platform Installer Wrap, 542 Write, 710 WriteAllText, 328 WriteMessage, 553 write-only properties, 183 WSAT See Web Site Administration Tool X XHTML, 14 XML, 44, 250, 255 See also Asynchronous JavaScript and XML; LINQ to XML caching, 578 comments, 177–178 e-mail, 322 LINQ to XML, 487 XML, 122 xml, 44 XmlDataSource, 440 XMLHttpRequest, 339 Y Yellow Screen of Death, 564, 667, 680, 780 Z zero-based, 143 827 www.it-ebooks.info bindex.indd 827 25-02-2014 10:45:54 Try Safari Books Online FREE for 15 days and take 15% off for up to Months* Gain unlimited subscription access to thousands of books and videos With Safari Books Online, learn without limits from thousands of technology, digital media and professional development books and videos from hundreds of leading publishers With a monthly or annual unlimited access subscription, you get: • Anytime, anywhere mobile access with Safari To Go apps for iPad, iPhone and Android • Hundreds of expert-led instructional videos on today’s hottest topics • Sample code to help accelerate a wide variety of software projects • Robust organizing features including favorites, highlights, tags, notes, mash-ups and more • Rough Cuts pre-published manuscripts START YOUR FREE TRIAL TODAY! Visit: www.safaribooksonline.com/wrox *Discount applies to new Safari Library subscribers only and is valid for the first consecutive monthly billing cycles Safari Library is not available in all countries www.it-ebooks.info badvert.indd 828 2/21/2014 10:50:20 AM Programmer to Programmer™ Connect with Wrox Participate User Group Program Take an active role online by participating in our P2P forums @ p2p.wrox.com Become a member and take advantage of all the benefits Wrox Blox Wrox on Download short informational pieces and code to keep you up to date and out of trouble Follow @wrox on Twitter and be in the know on the latest news in the world of Wrox Join the Community Wrox on Sign up for our free monthly newsletter at newsletter.wrox.com Join the Wrox Facebook page at facebook.com/wroxpress and get updates on new books and publications as well as upcoming programmer conferences and user group events Wrox.com Browse the vast selection of Wrox titles, e-books, and blogs and find exactly what you need Contact Us We love feedback! Have a book idea? Need community support? Let us know by e-mailing wrox-partnerwithus@wrox.com www.it-ebooks.info www.it-ebooks.info ... www.it-ebooks.info ffirs.indd 25- 02-20 14 10 :44 :30 Beginning ASP. NET 4. 5. 1 www.it-ebooks.info ffirs.indd 25- 02-20 14 10 :44 :30 www.it-ebooks.info ffirs.indd 25- 02-20 14 10 :44 :30 Beginning ASP. NET 4. 5. 1 in C# and. .. Updating and Inserting Data Using DetailsView to Insert and Update Data 44 3 44 3 44 9 45 1 45 3 45 9 46 0 46 6 46 6 Practical Tips for Displaying and Updating Data 48 0 Summary 48 1 Chapter 14 : LINQ and. .. Data Controls Handling Errors That Occur in the   Data Source Controls 54 9 55 5 56 0 Hand-Coding Data Access Code 5 64 Caching 5 74 Common Pitfalls with Caching Data Different Ways to Cache Data in ASP. NET

Ngày đăng: 27/03/2019, 13:42