Synopses & Reviews
An ASP.NET 2.0 book that just helps you get things done!
This book contains a collection of 101 best practice, object oriented solutions that you can easily adapt to your own projects.
Coverage includes:
Working with text, numbers, dates & timesAccessing data with ADO.NETForm validation under multiple sceneriosPage, Session and application state tipsAccess control in web applicationsProducing standards compliant outputEnhancing applications with AJAXWorking with EmailHandling errors and debuggingPerformance tips and pitfallsAnd much more!As a bonus, all book buyers get download access to the code archive which has all the examples in the book in both C# and VB.Back Cover
"A comprehensive collection of ready-to-use ASP.NET solutions!"
The ASP.NET 2.0 Anthology: 101 Essential Tips, Tricks & Hacks is a collection of solutions to the most common ASP.NET problems. Let five world-class ASP.NET professionals guide you through countless practical solutions using C# or VB.Learn to:
- Add interactivity with Ajax and JavaScript.
- Build a database access layer for improved portability.
- Sidestep the ASP.NET framework when required.
- Build data-driven applications quickly with SubSonic.
- Gracefull handle errors effectively.
- Work with email: send, parse, & manage attachments.
- Use component-based development for flexibility.
- Make your applications search engine friendly.
- Validate data input on forms.
- Create a user registration system.
- Use Master Pages to simplify development.
- Work with binary content.
- Improve the speed of your site, decrease bandwidth usage and speed up database queries
- And lots more...
Synopsis
An ASP.NET 2.0 book that just helps you get things done!
This book contains a collection of 101 best practice, object oriented solutions that you can easily adapt to your own projects.
Coverage includes:
Working with text, numbers, dates & times Accessing data with ADO.NET Form validation under multiple scenerios Page, Session and application state tips Access control in web applications Producing standards compliant output Enhancing applications with AJAX Working with Email Handling errors and debugging Performance tips and pitfalls And much more!
As a bonus, all book buyers get download access to the code archive which has all the examples in the book in both C# and VB.
Synopsis
This book contains a collection of 101 best practiced, object oriented solutions that readers can easily adapt to their own projects, including working with text, numbers, dates, and times; accessing data with ADO.NET Form; working with email handling errors; and more.
About the Author
Allen has a master's degree in computer science from Shippensburg University. He's a Microsoft Certified Solution Developer. He regularly serves as an adjunct faculty member at various colleges in Maryland and Pennsylvania.
Table of Contents
Preface; Who Should Read this Book?; What's Covered in this Book?; The Book's Web Site; The Code Archive; Updates and Errata; The SitePoint Forums; The SitePoint Newsletters; Your Feedback; Conventions Used in this Book; Code Samples; Tips, Notes, and Warnings; Chapter 1: Introductory Topics; Which web projectWeb Site Project model should I choose?; Solution; Web Site Projects Versus Web ApplicationWeb Application Projectcompared to Web Site projectWeb Site Projectcompared to Web Application Project Projects; Creating Web Projects; Creating a Web Site ProjectcreatingWeb Site projectsWeb Site projectcreating; Creating a Web Application ProjectcreatingWeb Application projectsWeb Application projectcreating; Web Site projectpublishingpublishingWeb Site projectHow do I deploy my web site?; Solution; How do I choose a third-party web hostthird-party web hostingexplained?; Solution; Narrowing the Field; Backupsbackupsthird-party web hosting; Reliabilityreliabilitythird-party web hosting; Deployment and Management; Statisticsstatisticsreports from third-party web hosting services; Securitysecuritythird-party web hosting; Special Needs; Free Stufffree stuffthird-party web hosting; How do I use source controlsource control?; Solution; The Elements of Source Control; The Repositoryrepositoriessource control; Labelinglabelingsource control; Branchingbranchingsource control; Who Should Use Source Control?; Source Control Toolstoolssource control; How do I go about using open source codeopen source code?; Solution; Open Source Licensing; Finding Open Source .NET Resourcesresourcesopen source .NET; Recommended Open Source Projectsresourcesopen source projects; Where can I find more information aboutresourcesASP.NET ASP.NETfinding information aboutASP.NET?; Solution; Searching for Information; Google GroupsUSENET newsgroupsGoogle Groups; The ASP.NETASP.NETweb site Web Site; ASP.NET-focusedASP.NETblogs BlogsblogsASP.NET; Reference BooksbooksASP.NETresourcesreference books; Summary; Chapter 2: .NET 2.0 core libraries.NET 2.0 Core Libraries; How do I use strings.NET 2.0 core librariesstringsstringsabout?; Solution; How do I displaydisplayingobjects as strings an objectobjectsas strings as a stringstringsconversion from objects?; Solution; Discussion; How do I displaydisplayingformatted strings formatted strings?; Solution; How Powerful is String.FormatString.Format commanduses of?; Discussion; How do I use genericsgenerics.NET 2.0 core libraries?.NET 2.0 core librariesgenerics; Solution; How do I filterfilteringgeneric collections items in a generic collectiongeneric collectionsfiltering?; Solution; How can I get more use out of my custom logic?; Solutions; Using Generic Methodsgeneric methodsreusing with collections; Using Reusable Delegatesdelegatesreusing; How do I convert generic listsgeneric listsconverting to classes to specific classesclassesconverting from generic lists?; Solution; How do I concatenateconcatenatingdelimited strings from object properties delimited stringsdelimited stringsconcatenating from object properties from object propertiesobject propertiesconcatenating as delimited strings?; Solution; Discussion; .NET 2.0 core librariescollectionsHow do I batch operationsbatch operationslarge collections with large collectionscollectionsbatch operations?; Solutions; The Naïve Solution; The Naïve Solution's Pitfalls; The BatchIterator ClassBatchIterator classexplained Solution; How do I choose the right collectioncollectionschoosing?; Solutions; The Array; The ArrayListArrayList collection typeabout and the ListList collection typeabout
; The HashtableHashtable collection typeabout and the DictionaryDictionary collection typeabout; SortedList collection typeaboutSortedList and SortedDictionarySortedDictionary collection typeabout; QueueQueue collection typeabout; StackStack collection typeabout; Summary; Chapter 3: Data Accessdata access; How can I get started using ADO.NET?ADO.NETdata accessdata accessADO.NET; Solution; Discussion; How do I configureconfiguringdatabase connections my databasedatabasesconfiguring connections connection?data accessconfiguring database connections; Solution; How do I readreadingdata from databases data from my databasedatabasesreading data from?data accessreading data from databases; Solution; How do I sortsortingdata and filterfilteringdata data?data accesssorting and filtering data; Solution; Discussion; How do I fill a DropDownListDropDownListfilling from database tables from a database tabledatabase tablesfilling DropDownLists?data accessfilling DropDownList from database tables; Solution; How can I perform data bindingdata bindingusing DataSource control without having to write all that repetitive code?DataSource controldata bindingdata accessdata binding; Solution; How do I displaydisplayingdatabase tables the contents of a database tabledatabase tablesdisplaying contents?data accessdisplaying database tables; Solution; Discussion; How do I allow the modification of a single recordrecordsmodifying single?data accessmodifying single records; Solution; How can I data bindingwithout SqlDataSourcedata bind without using the SqlDataSource?data accessdata binding; Solution; Summary; Chapter 4: Pushing the Boundaries of the GridViewGridView control; How do I add a data-bound drop-downdata-bound drop-downsadding to a GridViewdrop-downsadding to a GridView to a GridView?GridView controldata-bound drop-down; Solution; Discussion; How do I sort on multiple columnscolumnssorting multiple?GridView controlsorting on multiple columns; Solution; Discussion; How do I display the sort statesort stateGridView control?GridView controlsort state; Solution; Discussion; How do I implement custom pagingpagingGridView control?GridView controlcustom paging; Solution; Discussion; How can I allow users to downloaddownloadingtabular data into Excel tabular tabular datadownloading into Excel data as a Microsoft ExcelExceldownloading tabular data file?GridView controldownloading tabular data into Excel; Solution; Discussion; Numeric Formattingnumeric formattingExcel and FormulæformulæExcel; Summary; Chapter 5: form validationForm Validation; How do I validate form inputinputforms validating?form validationform input; Solution; Discussion; How do I validate multiple forms?form validationmultiple forms; Solution; How do I set up custom validation?form validationcustom validation; Solution; Discussion; How do I perform custom client-side validationclient-side validationforms?form validationclient-side validation; Solution; Discussion; How do I build my own validator controlvalidator controlsbuilding?form validationbuilding validator controls; Solution; How do I perform client-side validationclient-side validationcustom validator controls with my custom validator control?form validationclient-side validation; Solution; Understanding the Client Validation Functionfunctionsclient validation; Embeddingembeddingclient validation functions the Client Validation Function; Registering the Client Validation Function; Summary; Chapter 6: Maintaining Statestates; How do I maintain per-request stateper-request stateweb applications in a web application?web applicationsper-request statesstatesper-request states in web applications; Solution; How can I maintainenablingsession states for web farms session statesession statesenabling for web farms in a web farm using a state serverweb farmsenabling session states?statesenabling session states for web farms; Solution; How can I maintain session statesession statesreboots in a web farm using a databaserebootsmaintaining session states?statessession states across reboots; Solution; ConfiguringconfiguringSQL servers SQL ServerSQL Serverconfiguring; ConfiguringconfiguringASP.NET ASP.NETASP.NETconfiguring; Discussion; Where should I store application stateapplication statesstoring?statesstoring application states; Solutions; Storing Data in Static Variablesstatic variablesstoring application state information; Storing Data in the Cachecachestoring application state information; Storing Data in Application Variablesglobal datastoringapplication variablesstoring global data; What's the cleanest way to accessaccessingview state a pagepagesaccessing view state's view state?view stateaccessingstatesaccessing view state; Solution; Discussion; How can I make sure my custom controlcustom controlwith view state off works when view state is turned off?statescustom controls with view state off; Solution; Discussion; Summary; Chapter 7: Membership and Access Controlaccess control; What's the easiest way to addaddingmembership membershipmembershipadding to my site?access controlmembership; Solution; Discussion; How do I allow users to registerregisteringusers for my site?access controlregistering users; Solution; Discussion; How do I managemanagingusers users on my site?access controlmanaging users; Solution; How do I require users to log inloginabout?access controllogin; Solution; Discussion; recoveringforgotten passwordsHow do I grant access to users who have forgottenforgotten passwordsrecovering their passwordspasswordsforgotten?access controlforgotten passwords; Solution; How do I displaydisplayingcontent based on roles contentcontentdisplaying based on roles based on rolesrolesdisplaying content?access controldisplaying content based on roles; Solution; Summary; Chapter 8: Component-based Developmentweb form development; How can I use master pagesmaster pagesabout?web form developmentmaster pages; Solution; Discussion; How can my content pagecontent pagesoverriding data on master pages overrideoverridingdata on master pages datadataoverriding on master pages on my master pagemaster pagescontent pages overriding data on?web form developmentcontent pages overriding data on master pages; Solution; Discussion; Using a Strongly Typed Propertystrongly typed propertiesusing; Handling Multiple Master Pages; How can I have my master pagemaster pagesinteractions with content pages interact with my content pagecontent pagesinteraction with master pages?web form developmentmaster page interactions with content pages; Solution; Discussion; How do I use URLsURLsin master pages in a master pagemaster pagesURLs in?web form developmentURLs in master pages; Solutions; Using Absolute URLsabsolute URLsmaster pages; Using the ResolveClientUrl MethodResolveClientUrl methodmaster pages; Using URL RebasingURL rebasingmaster pages; The Ideal Approach; How do I modify header elementsheader elementsmodifying in master pages in a master pagemaster pagesmodifying header elements?web form developmentmodifying header elements in master pages; Solution; Discussion; How do I use themesthemesusing in conjunction with CSS effectively in conjunction with CSSCSSusing themes in conjunction with?web form developmentusing themes in conjunction with CSS; Solution; Discussion; How do I treat user controlsuser controlsas components as componentscomponentsuser controls as?web form developmentuser controls as components; Solution; How do I embedembeddingresources in components resourcesresourcesembedding in components into my components?web form developmentembedding resources in components; Solution; Summary; Chapter 9: ASP.NET and web standardsWeb Standards; What are all these span tagsspan tagsHTML output doing in my HTML outputHTML outputspan tags?web standardsspan tags; Solution; Discussion; How do I obtain DataListDataList classobtaining functionality of without tables-style functionality without using a table?web standardsDataList-style functionality; Solution; Discussion; How do I use ASP.NET's fancy menusmenususing without the fancy HTML?web standardsmenus; Solution; Discussion; How do I make sense of the CSSCSSweb standards maze produced by the CSS Friendly menumenusCSS?web standardsCSS; Solution; Discussion; Simple CSS InheritanceinheritanceCSS; CSS Inheritance and TablestablesCSS inheritance; CSS Development Toolsdevelopment toolsCSS; Getting Back to that Menu ...; Summary; Chapter 10: AjaxAjaxhistory of and JavaScriptJavaScriptJavaScripthistory of; How can I writewritingJavaScript better JavaScriptJavaScriptwriting?; Solution; Discussion; How can librarieslibrariesJavaScript make writingwritingJavaScript robust, cross-platform JavaScriptJavaScriptlibraries easier?; Solution; Discussion; How do I use Microsoft's ASP.NET AJAXAjaxusingAjax?; Solution; How do I perform partial pagepagesrendering renderingrenderingpagespage renderingpartial?Ajaxpartial page rendering; Solution; Discussion; How do I show progress during a partial page render?; Solution; Discussion; How do I periodically refreshrefreshingUpdatePanels an UpdatePanelUpdatePanelsrefreshing?Ajaxrefreshing UpdatePanels; Solution; Discussion; How do I work with generated IDsgeneratedIDsgenerated IDsAjax?Ajaxgenerated IDs; Solution; Discussion; Where can I get some fancy ASP.NET controlscontrolsin ASP.NET?AjaxASP.NET controls; Solution; How can I debugdebuggingJavaScript JavaScriptJavaScriptdebugging?; Solutions; Using Visual StudioVisual StudioJavaScript debugging; Using FirebugFirebugJavaScript debugging; Using Framework Toolsframework toolsJavaScript debugging; Using FiddlerFiddlerJavaScript debugging; Summary; Chapter 11: Working with Emailemail; How do I send a plain-text emailplain-text emailssending?emailsending plain-text emails; Solution; How do I send an HTML emailHTML emailsending?emailsending HTML email; Solution; Discussion; How do I attachattachmentsemail a file to my email?emailattaching files to email; Solution; Discussion; How do I send personalized form lettersform letterssending via email?emailsending personalized form letters; Solution; Discussion; How do I allow users to submitsubmittingcontent via email contentcontentsubmitting via email via email?emailsubmitting content via email; Solution; Discussion; How do I send an email without waiting for it to complete?emailsending without waiting for completion; Solution; Summary; Chapter 12: Rendering Binary Contentbinary content; How do I writewritingbinary content binary content?binary contentwriting simple; Solution; Discussion; How do I writewritingraw data to response raw data to the response?binary contentwriting raw data to response; Solution; Discussion; How do I request an HttpHandlerHttpHandler classrequestingbinary contentrequesting HttpHandler?; Solutions; Using a Custom HttpHandler; Using a Generic Handlergeneric handlersusing; How do I writewritingnon-text binary data non-text binary data?binary contentwriting non-text binary data; Solution; Understanding Content Typescontent typesabout; Writing Binary Content; How do I renderrenderingsimple bars simple barsbar graphsrendering?binary contentrendering simple bars; Solution; How do I create a real bar graphbar graphscreating handlerhandlersreal bar graphs?binary contentreal bar graph handlers; Solution; How can I improve the qualityqualitydynamic images of my dynamic imagesdynamic imagesquality?binary contentdynamic image quality; Solution; Discussion; How can I use a handlerhandlersimages to control accessaccessingimages with a handler to the imagesimagesaccess to with a handler on my site?binary contentcontrolling access to images with a handler; Solution; Summary; Chapter 13: Handling Errorserror handling; How can I handlehandlingexceptions exceptionsexceptionshandling in my code?error handlingexceptions; Solution; How can I handle errors in my web siteweb siteserror handling?error handlingweb sites; Solutions; Handling Exceptions Via Health Monitoringhealth monitoringexception handling; Specifying Exception Handling in the global.asaxglobal.asax fileexception handling and Web.configWeb.config fileexception handling Files; Handling Errors Via HttpModuleHttpModule classerror handling; How can I use a pre-built exception handlingexception handlingpre-built strategy?error handlingpre-built exception handling; Solution; What's the best way to writewritinglog files a log filelog fileswriting?error handlingwriting log files; Solution; How do I debugdebugginglog4net log4netlog4netdebugging?error handlingdebugging log4net; Solution; How do I perform tracingtracingerror handling?error handlingtracing; Solution; Summary; Chapter 14: Configurationconfiguration; How do I storestoringbasic configuration settings and retrieveretrievingbasic configuration settings basic settings?configurationbasic settings; Solution; How do I storestoringconnection strings connection stringsconnection stringsstoring?configurationstoring connection strings; Solution; How do I retrieve settings declaratively?configurationretrieving settings declaratively; Solution; How do I create a custom configuration section?Web.config filecustom configuration sectionconfigurationcustom configuration section in Web.config; Solution; How can I simplify my Web.configWeb.config filesimplifying file?configurationsimplifying Web.config; Solution; Discussion; How can I manage Web.configWeb.config filemanaging values values between deployment environments?configurationmanaging Web.config values; Solution; How can I encryptencryptionWeb.config sections a section of my Web.configWeb.config fileencrypting sections file?configurationencrypting Web.config; Solution; Summary; Chapter 15: Performance and Scalingoptimization; How do I determine what to optimize?optimizationabout; Solution; How can I decrease the size of the view state?view statesize ofoptimizationview state; Solutions; Compressingcompressingview state the View State; StoringstoringViewState on server View State on the Serverserversstoring view state on; How can I decrease the bandwidthbandwidthoptimization that my site uses?optimizationbandwidth; Solutions; Enabling HTTP Compression SupportHTTP compression supportIIS 6.0 in IIS 6; Enabling HTTP Compression SupportHTTP compression supportASP.NET in an ASP.NET Application; How can I improve the speedspeedoptimization of my site?optimizationspeed of site; Solution; How do I refresh my cachecacherefreshing when the data changes?optimizationrefreshing the cache; Solution; How can I gain more control over the ASP.NET cacheASP.NET cacheoptimization?optimizationASP.NET cache; Solution; Discussion; How do Idatabasesoptimizing queries speedqueriesoptimization up my database queries?optimizationdatabase queries; Solution; Discussion; Lack of Indexesindexesabout; Incorrect Indexes; Poorly WrittenwritingQueries Queriesquerieswriting; Deadlocksdeadlocksabout; Hardware Issues; How can I troubleshoottroubleshootingquery speed a slow queryspeedqueriesqueriesspeed?optimizationquery speed; Solution; Verifying the Problem; Checking for Large Result Sets; Checking the Query Planquery planchecking; Eliminating Cursorscursorseliminating; The Problem with SELECT *SELECT *problem with; Accessing More Information; Summary; Chapter 16: Search Engine OptimizationSearch Engine Optimization; How does GoogleGooglepage ranking rank pagespage rankingGoogle?Search Engine Optimizationpage ranking in Google; Solution; How do I ensure search engines review only search-relevant content?Search Engine Optimizationsearch-relevant content; Solutions; Removing View State; Movingmovingview state View State; Creating an HttpModuleHttpModule classmoving ViewState; How do I rewriterewritingURLs my URLsURLsrewriting for human readability for human readability?Search Engine Optimizationrewriting URLs; Solutions; URL Rewriting Via IIS; URLURLsrewriting via .NET code RewritingrewritingURLs Via .NET Code; URL Rewritingrewritingcustom 404 pages with a Custom 404 Page404 pagesrewriting; How do I ensure my web pagesweb pagesvisibility do search engines are visible to search engines?Search Engine Optimizationweb page visibility; Solution; How do I ensure my web pages produce descriptive search results?Search Engine Optimizationdescriptive search results; Solution; Summary; Chapter 17: Advanced Topics; How can I tell what's going on behind the scenes?Reflectortroubleshooting usingtroubleshootingusing Reflector; Solution; How do I build a screen scraperscreen scrapersbuilding?; Solution; Scraping the Contentcontentscraping; Displayingdisplayingscraped content the Scraped Content; Discussion; How do I build a data access layerdata access layerbuilding?; Solution; Discussion; How do I automatically generategeneratingdata access layer a data access layerdata access layergenerating?; Solution; The AutoScaffold PageAutoScaffold pageabout; The Scaffold Control; The Utility Controls; The SubSonic Data Access Layerdata access layerSubSonic; AddingaddingSubSonic to projects SubSonic to your Project; Installing SubSonic; Configuring Web.config; Generatinggeneratingdata access layer your DALdata access layergenerating; Discussion; Summary;