You are on page 1of 789
Tecnologias de > informacion Educacién ae ® Gracias por proferir nuestras publicaciones. Si desea estar actualizado sobre los tomas més actuales sobre Tecnologiae de informacién, por favor llene este cupon y envislo por correo o fax. Estimado lector: Nombre: Apolides: = Empresa: Sector: Direccion (Qi Particular © Empresa): Colonia: ae _ oP: ~ Pais: Toe — Fax emai: Protesién: Cargo: Sefiale cudles son sus dreas de interés: tardware Procesadores de Texto Inteet:creacion/aseno /programacion Lenguajes Hojas de Caculo Redes as0/cap Bases de datos Paquetes integrades A Comercio Electénico Temas de interés general A DiseAo: grfico /presentaciones Sistemas Operatives ‘Tema(s) especitico(s) Titulo de la obra donde encontré esta tarjeta y lugar de compra: Al onviar esta tarjeta reciba, totalmente gratie, nuestra revista bimestral Top Link que le ofrece informacién sobre ‘temas de actualidad y las Uiltimas novedades en las areas de Tecnologias de Informacién, Negocios e Interés General.” Visitenos en: www.pearsonedlatino.com “Disponible en Mexco, Amérca Central y e\ Carve. Resumen de contenido Introducei6n Parte 1 De un vistazo 5 Leccién 1 Primeros pasos con ASPNET 7 2__Creacién de paginas ASPNET 31 Vis ic. NET 57 4 Uso de objetos ASP.NET con C# y VB.NET 95 5 Introduccién a los formularios Web 131 6 Un poco ms de los formularios Web 163 7 Validacién de las paginas ASP 197 Parte 1 Repaso 233 Parte 2 De un vistazo 245 Leccién 8 Introduccién a la generacién de bases de datos 247 9 Uso de bases de datos con ASP.NET am 10 Comunicacién con ADO.NET 319 11 Uso de XML en ASPNET 359 12 Uso de técnicas avanzadas de datos 393 13 Lectura y escritura de archivos en el servidor Web 427 14 Caracteristicas mejoradas de almacenamiento en caché de ASPNET 461 Parte 2 Repaso 491 Parte 3 De un vistazo 507 Leccién 15 Uso de objetos de negocios 509 16 Creacién de servicios Web XML. 537 17 Uso y aseguramiento de los servicios Web XML 563 18 Configuracién y distribucion de aplicaciones ASP.NET 591 19 Separacién del cédigo y el contenido 623 20 Depuracién de péginas ASPNET 657 21 La seguridad en sus aplicaciones ASP.NET 689 Parte 3 Repaso n7 Lecciones adicionales Leccién 22 _Creacién de una aplicacién completa 733 23 Creacién de paginas Web méviles 789 Apéndices Apéndice A Respuestas a los cuestionarios 817 B__Errores comunes en ASPNET 879 C Controles de ASP.NET: propiedades y métodos 887 D__ Controles de ADO.NET: propiedades y métodos 917 fndige J _____939 Introduccion Parte 1 De un vistazo 5 Leccion 1 Primeros pasos con ASP.NET 7 (Cémo funciona Web Procesamiento dinémico Prcesamientoenel cliente 0g (Cémo enlaza ASP.NET los elementos -NET Framework Elementos de una pagina ASP.NET ‘Comparacién entre ASP y ASPNET ‘Modificaciones fundamentales de ASP isiisissiitnniniinsninnnin2® Leccion 2_Creacién de paginas ASP.NET Una aplicacién sencilla de ASPNET ..... Formularios Web... ~ Bloques de dectaracién de c6digo .. Bloques lores de cédigo (Cémo escribir cédigo de ASP.NET y HTML .. Comentarios en el <6di Cédigo que se divide en varias lineas El impacto de la aplicaci6n...oreeonne Detalles de la compilacion en ASP.NET Como ir acios de nombres... vi Aprendiendo ASP.NET en 21 Lecciones avanzadas El Common Language Runtime y ASP.NET Lenguaje Intermedio Ejecucién Procesamiento Ensamblajes Ejecucién Indo iQué significa el CLR Declaracién de variables... Denominacién de variables Contenido Leccion 4_Uso de objetos ASP.NET con C# y VB.NET 95 (Piepetasitn tle GS ccc a ont eee eee Miembros estéticos Objetos de ASP.NET El objeto Response snannen El objeto Page El objeto Session El objeto HitpApplication Modelo de programacién de los formularios Web Controles de servidor ‘Cémo guardar el estado Orden de procesamiento de los formularios Web... Controles HTML de Se0Vid00 itiitittananianiinniinnainnnal dt Controles Web de servidor ... Uso de los controles Web .. (Como enviar datos inmediatamente vii viii Aprendiendo ASP.NET en 21 Lecciones avanzadas Leccion 6 Parte 1 Repaso Un poco més de los formularios Web 163 (Capacidad de los formularios Web Controles de usuario (Cémo utilizar controles de usuario Como mejorar el control de usuario Cémo generar controles. Uso de los controles personalizados_. Uso de las propiedades y el estado Como agregar eventos (Cémo generar controles en tiempo de ejecucién iESo noes ASP! Preguntas y respuestas Taller in de las paginas ASP 197 Esquemas de validacién Validacién en ASP.NET ‘Cémo funcionan los controles Validation Uso de controles de validacién (Cémo hacer validaciones en el servi (C6mo inhabilitar la validaci6n Expresiones regulares ‘Cémo mostrar restimenes de validacién Controles de validacién personalizados Preguntas y respuestas .... Taller Primer proyecto adicional .. Una aplicacién bancaria Controles de usuario La pagina para inicio de sesi6n a0 La péigina de cuenta 238 Pago de facturas Resumen Contenido Parte 2 De un vistazo 245 Leccion 8 Introducci6n a la generacién de bases de datos 247 Lecaon 9 Leccisn 10 {.Qué son las bases de datos? Claves y restricciones "Normas para la comunicacién con bases de datos Cudndo deberfa usar una base de datos? Cémo generar bases de datos El Lenguaje de Consultas Estructurado (SQL) ..ueesnensn caO5T La instruccién SELECT .. La instruccién INSERT... La instruccién UPDATE .. La instruccién DELETE... Cémo acceder a datos con ASP.NET jAccedamos a los datos! iEsono es ASP! Resumen Preguntas y respuestas Taller. Cuestionario Fjercicios Uso de bases de datos con ASPNET 271 Introduccién del acceso a datos con ASPNET 2m El objeto DataSet Uso del DataSet Relaciones zi Cémo Henar un DataSet .. Enlace de datos ‘Uso del enlace de datos... Controles enlazados a datos El control de servidor Repeater... Control de servidor DataList EI control de servidor DataGrid ... Resumen de los controles enlazados a datos iEso no es ASP! RESUME snnnnnenn Preguntas y respuestas Taller CestioMario aon BjerciCi08 eon ‘Comunicacién con ADO.NET Introduccién a ADO.NET son ADONET comparado con ADO ADONET y XML. EI modelo de objetos ADO.NET ix x Aprendiendo ASP.NET en 21 Lecciones avanzadas Leccion 11 Leccion 12 Una revisidn al DataSet .. Moificacién de datos en un DataRow ‘Cémo ver los datos en un DataTable Concurrencia .. EI objeto OleDbCommand El objeto OleDbDataReader UPDATE, INSERT y DELETE El objeto OleDbDataAdapter Uso de ADO.NET con ASP.NET iEso noes ASP! Resumen . Preguntas y respuestas Taller Cuestionario .. Ejercicios Uso de XML en ASP.NET Introduccién a XML... El modelo de datos de XML... Esquemas XML Acceso a XML mediante ASP.NET ‘Como leer XML Escritura de XML... Validacién del XML ssosne EI DOM de XML. Carga de datos XML Modificacién de datos XML XML yl DataSet Taller .. Cucstionario Bjercicios Uso de técnicas avanzadas de datos Técnicas avanzadas de bases de datos .. Consultas con pardmetros Procedimientos almacenados Transacciones . ‘Técnicas avanzadas de XML XPathDocument ... XPath XsITransforms Leccion 13 Leccion 14 Contenido Preguntas y respuestas .. Taller Cuestionario Ejerci i Lectura y escritura de archivos en el servidor Web a7 Uso de archivos con ASPNET 428 Inclusién de archivos externos Inclusiones desde el servidor .. Otras inclusiones snnimnesn ‘Acceso a archivos Los archivos, flujos,lectores y escritores Exploracin de archivos y carpetas Apertura de archivos ncn Lectura de archives . Escritura de archivos tras operaciones de archivos y carpetas . Resumen de objetos de arc Almacenamiento aislado ‘Creaci6n de ubicaciones para el almacenamiento aislavo .. Acceso al almacenamiento aislado «uu. iEso no es ASP! Resumen . . Preguntas y respuestas sn. Taller ‘Cuestionario Ejercicios Caracteristicas mejoradas de almacenamiento en caché de ASPNET 1.Qué es el almacenamiento en caché? . De qué forma usa ASP.NET el almacenamiento en caché ...... Almacenamiento de péginas en caché Almacenamiento de la configuracién en caché om 464 El almacenamiento de salida y de datos en caché 464 ‘Como usar el almacenamiento en cache .. Cémo aimacenar Ia salida de paginas en CACHE onnorriennnnnnenrennen AOS Almacenamiento de objetos en caché 47 Dependencias del cache .. Uso de Ia clase HttpCachePolicy Uso efectivo del almacenamiento en caché iEs0 no es ASP! Resumen .. — Pregunias y respuestas Taller Cuestionario Ejercicios xi xii Aprendiendo ASP.NET en 21 Lecciones avanzadas Parte 2 Repaso Segundo proyecto adicional (Cémo agregar funcionalidad de datos La hase de datos ... Las paginas ASPNET Resumen . Parte 3 De un vistazo LecciOn 15. Uso de objetos de negocios Introduccién a los componentes 2. Qué son los objetos de negocios {Por que utilizar componentes? ‘Cémo usa ASP.NET los components ... Generacién de objetos de negocios {Por qué debe compilarse el objeto BaseDeDatos vse S16) Desarrollo de objetos de negocios “ 317 Uneejemplo funcional Algunas consideraciones Uso de componentes que no son de NET. iEs0 no es ASP! Resumen Pregunias y respuestas Taller Cuestionario Ejercicios Leccion 16 Creacién de servicios Web XML Una retrospectiva al funcionamiento de Web Tntroducei a los servicios Web XML Escenarios de servicios Web XML EI modelo de programacién de los servicios Web XML Protocolos para acceder a servicios Web XML Razones para utilizar los servicios Web XML... Creacién de un servicio Web XML Generacion de Ia funcionalidad Cémo habilitar el proceso de descubrimiento El atributo WebMethod Distribucién de tos servicios Web XML. Creacién de un servicio Web XML a partir de un objeto de negocios existente Céimo devoiver datos de los servicios jEs0 n0 es ASP! Resumen Preguntas y respuestas . Taller Cucstionario Ejewicios Contenido xiii Leccion 17 Leccion 18 Leccion 19 Uso y aseguramiento de los servicios Web XML 563 Consumo de los servicios Web XML = . ‘Cémo usar un servicio Web XML mediante una paging ASPNET ccoonenneS66 La herramienta Web Services Discovery eesonm $67 Creacién de la clase Proxy Implementacion de la clase proxy oat tro ejemplo de consumo de servicios Web XML. si SIS Recomendaciones para el consumo de servicios Aseguramiento de los servicios Web XML. iBs0 no es AS Resumen . Preguntas y respuestas Taller Cuestionario Ejercicios Configuracién y distribucién de aplicaciones ASPNET 591 Presentacién de las aplicaciones ASP.NET sense ‘ wnsnon 592 La carpeta ‘bin ... a . ne I sglobal.asax La clase HupApplication Programacién de global.asax Configuracién de ASP.NET ‘web.config Secciones de configuracién Configuracin personatizada : Creacién y recuperacién de secciones webicontig personalizadas Distribucién de su aplicacién Caché de ensamblajes Ensamblajes sombreados .. iFso no es ASP! Resumen : Preguntas y respuestas ... Taller Cuestionario Ejercicios Separacion dei codigo y el contenido 623 El camino a la separacién Formnularios con cédigo de apoyo .. : Uso del eddigo de apoyo en paginas ASPNET 0... Uso del eédigo de apoyo en jos controles de usuario Archivos de recursos y Jocalizacién Localizacién de su aplicacién Empaquetado de recursos en archivos . iBs0 no es ASP! xiv Aprendiendo ASP.NET en 21 Lecciones avanzadas Leccion 20 Leccion 24 Parte 3 Repaso Resumen... Preguntas y respuestas Taller Cuestionatio nm Ejercicios Depuraci6n de paginas ASPNET 657 Introduccién a ta depuracién .. Try y Catch Emisién de excepciones Cuéndo usar una instrucciGn Try...» Rastreo Rastreo en funcién de la pi Rastreo en funcién de la aplicacion nx El Depurador Microsoft CLR... Uso del Depurador Microsoft CLR Recomendaciones para la depuracién .. jEso noes ASP! Preguntas y respuestas Taller. Cuestionario .. Ejercicios La seguridad en sus aplicaciones ASRNET Nociones de seguridad La seguridad en Windows AbleticAci6n .o.rnsnmnan Autenticaciéa Windows Autenticacién de formutarios ... Autenticacién con Microsoft Passport wsnnsnon ‘Autorizacién Personificacién jEso noes ASP! . Resumen . Preguntas y respuestas Taller Cuestionario Bjercicios Tercer proyecto adicional_ AdiciGn de los objetos de negocios El servicio Web XML, Resumen Contenido LECCIONES ADICIONALES Leccion 22 Creacién de una aplicacién completa 733 Elescenario: platanoméviles Disefio de la aplicacién Los datos plataneros . La interfaz platanera de usuario Los objetos de negocios plataneros Creacién del sitio PlatanoMovil Creacién de la base de dat0$.srunmosmnnnn Los objetos de negocios Las pAginas ASPNET .. El servicio Web XML... Qué sigue iEs0 no es ASP! Resumen Preguntas y respuestas Taller Cuestionario ... Leccion 23 Creacién de paginas Web méviles 789 Qué son los formularios Web méviles? ... GEn qué se diferencian los formularios Web méviles de los formularios Web de ASPNET? {Qué necesito para usar los formularios. Instalaci6n del SDK de Web Mévil ... rimeros pasos con los formularios Web méviles Cémo trabajan los formularios méviles Construccién de una interfaz mas apropiada .. soul 97 Desarrollo de paginas méviles ... ReSUMEN sevsensnennninn Preguntas y respuestas Taller Cuestionario Ejercicios Apéndices ‘Avénoice A Respuestas alos cuestionarios 817 ‘Arénpice B Errores comunes en ASP.NET Acertios de ASPNET Problemas con formularios Web Otros problemas .. xv xvi Aprendiendo ASP.NET en 21 Lecciones avanzadas Avtupice C Apénpice D Cambios respecto del ASP clésico Problemas con VBScript Problemas con el ASP clisico Controles de ASPNET: propii Controles HTML de servidor = 7 Propiedades comunes a los controles HTML de servidor Los controles HTML de servidor Controles Web de servidor ... Propiedades comunes a los controles Web de servidor Los controles Web de servidor ASP.NET Controls de servidor para validacién Propiedades comunes para los controles de servidor de validacién Los controles de servidor de validacicn .. Controles de ADO.NET: propiedades y métodos EI DataSet y los objetos relacionados con 1 mme Constraint y ConstraintCollection DateColumn y DataColumnCollection DataRelation y DataRelationCollection .. DataRow y DataRowCollection ... DataSet .. : DataTable y DataTableCollection DataView 3 Los proveedores supervisades .. OleDeCommand OleDbCommandBuilder OleDbConnection .. OleDbDataAdapter OleDbDataReader .. i OleDbError y OleDbErrorCollection .. OleDbParameter y OleDbParameterCollection . OleDbTransaction lades y métodos aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Acerca del autor ‘A Charis Payne le apasionaron los equipos de cémputo y la escritura desde temprana edad, Cuenta con una maestrfa en Ingenieria Biomédica por la Universidad de Boston. Chris apoy6 sus estudios con labores como con- sultor independiente y con la redaccién de articulos técnicos enfocados en el desarrollo para Web. Fn Ia actualidad radica con su prometida en Orlando, Florida, ademés de que trabaja como desarrollador Web y conti- mia su carrera como autor de materiales técnicos y de ciencia ficciGn. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Pearson Educacién de México El personal de Pearson Educacién de México est comprometido en presentarle 1o mejor en material de consulta sobre computacién. Cada libro de Pearson Educacién de México es el resultado de meses de trabajo de nuestro personal, que investiga y refina la informacién que se offece. ‘Como parte de este compromiso con usted, el lector, Pearson Educacién de México lo invita a dar su opinidn, Por favor héganos saber si disfruta este libro, si tiene alguna dificultad con la informacién y los ejemplos que se presentan, o si tiene alguna sugerencia para Ia préxima edicién, Sin embargo, recuerde que el personal de Pearson Educacién de México no puede actuar como soporte técnica ni responder preguntas acerca de problemas relacionados con el software o el hardware. Si usted tiene alguna pregunts 0 comentario acerca de cualquier libro de Pearson Educacién de México, existen muchas formas de entrar en contacto con nosotros. Responderemos a todos los lectores que podamos. Su nombre, direccién y némero telefénico jamas formardn parte de ninguna lista de correos ni serén usados para otro fin, més que el de ayudamos a seguirle Hevando los mejores libros posibles. Puede escribimos a la siguiente direcciGa: Pearson Educacion de México Attn: Editorial Division Computacién Calle Cuatro No. 25, 2do. Piso Col. Frace. Industrial Alce Blanco Naucalpan de Judrez, Fdo. de México CP. 53370, Si lo prefiere, puede mandar un fax a Pearson Educacién de México al (525) 5387-0811. ‘También puede ponerse en contacto con Pearson Educacién de México a través de nuestra pigina Web: http: //www.pearsonedlatino. con. Introduccién jReciba nuestra bienvenida a Aprendiendo ASP.NET en 21 Lecciones avanzadas! Es muy probable que haya elegido este libro porque le provoca curiosidad crear aplicaciones con- fiables para Internet, jHa Iegado al lugar correcto! A 10 largo de tas siguientes 21 lecciones (més dos adicionales) explorard cada uno de los aspectes principales de las Péginas Activas de Servidor NET (ASP.NET), e! marco de trabajo de desarrollo basado en Web de Microsoft: desde la apariencia de las piginas hasta la forma en que se vinculan con el sistema operativo. ASPNET es una tecnologia que le permite generar y controlar paginas Web dinimicas con facilidad. Es la nueva generacién de Paginas Activas de Servidor de Microsoft (al cual me referiré como ASP cldsico), y ofrece muchas mejoras para aprovechar ta nueva tecnologia, Con ella podré comunicarse con bases de datos, personalizar paginas Web para sus visitantes, mostrar paginas en dispositivos portétiles (como teléfonas celulares), e incluso generar desde cero todo un sitio de compras para el comercio electrénico. Al avanzar por las lecciones de este libro descubrira con qué facilidad pueden realizarse estas tareas. No slo verd ejemplos y aprenderi a crear éstas y otras aplicaciones, sino que también comprenderd lo necesario para adquirir confianza en todas las tareas que emprenda con ASP.NET. éA quién esta dirigido este libro? Este libro pretende evar a los principiantes de ASP.NET a grados avanzados. Tal descrip- ci6n incluye a una gran cantidad de personas, Para aprovechar por completo las lecciones de ‘este libro, necesitari estar familiarizado con la tecnologia y términoy de! cémputo (es decir, cémo desplazarse por su disco duro o explorar paginas en Internet). No se requiere una expe- riencia previa en programacién, pero seré muy wtil si cuenta con ella. También debe tener conocimientos basicos de HTML. Los desarrolladores del ASP clésico también se beneficiarén en gran medida con este libro. No s6lo le mostraré eémo realizar tareas avanzadas en ASP.NET, sino que cada leccién tam- bign tiene una seccién especial —“jEso no es ASP!"— dedicada a quienes ya tienen experien- cia con el ASP clisico. Estas seociones menciouan los avances de ASP.NET en comparaci con el ASP clésico, y presentan ejemplos que le ayudarén a facilitar su traslado a ASP.NET. Lo més importante: este libro se orienta a personas que desean generar una fuerte presencia en Web (0 incluso una sencilla pégina personal) con el potencial de ASP.NET. Si nunca ha creado algo més que una sencilla pégina HTML, ASP.NET es el lugar perfecto para arrancar. Le da un gran poder, y es muy facil empezar a usarlo. Le sorprenderé lo que puede hacer con ASP.NET. Aprendiendo ASP.NET en 21 Lecciones avanzadas éQué necesita saber antes de leer este libro? Los tnicos requisitos necesarios son un conocimiento basico de HTML y cierta familiaridad con su sistema operativo, Cada leccién le presentard, definird y explicard nuevos temas, de tal forma que pueda analizarlos rpidamente y avanzar al siguiente paso. Por tal motivo, un conocimiento previo de los conceptos de programacién facilitard su avance através del libro. Si tiene experiencia en el desarrollo de aplicaciones tradicionales, 0 incluso aplicaciones para Web, muchos de los conceptos de este libro le resultarén conocidos, lo cual Je permitiré avanzar con mayor facilidad. Asimismo, no es necesario tener experiencia con el ASP clisico. Los conceptos de éste y del ‘marco de trahajo anterior se explican cuando son totalmente nuevos, por lo que cualquier per- sona podré comprenderlos mejor. £Qué software necesita para completar los ejemplos de este libro? Necesitard tener instalado Windows XP Professional, Windows 2000 0 Windows NT con el Service Pack 6a para aprovechar la mayor parte de los ejemplos de este libro. Algunos componentes de ASPNET funcionarin en Windows Me, 98, o versiones anteriores, pero no espere que todo trabaje, y no se recomiienda su uso para hacer desarrolios con ASP.NET. ‘Se necesita un servidor Web. Puede ser IIS 5 o el Personal Web Server. En la primera leccién aprender a configurar adecuadamente el servidor. También necesita obtener el SDK del .NET Framework de Microsoft (o del CD adjanto) para probar los ejemplos. Nuevamente, su configuracién se analiza en ta leccién 1. Finalmente, para los ejemplos de las bases de datos, es necesario contar con un sistema de base de datos que se apeguc a los lincamicntes de OLE DB, como Microsoft Access 0 SQL Server. Sin ella no podré realizar los ejemplos relacionados. Cémo esta organizado este libro Este libro estd dividido en cinco partes. La primera parte explica los fundamentos de ASP.NET: cémo empezar, cémo generar paginas ASP.NET, y cémo usar Visual Basie NET para mejorar el aspecto de sus paginas. También profundiza en el marco de trabajo de los formularios Web, una parte integral de ASP.NET que facilita mucho 1a labor de los desarrolladores, En suma, aqui se le presentan las bases para comprender el entorno de ASP.NET. EI segundo grupo de 7 lecciones se centra en las téenicas para el manejo de datos (después de todo, las personas se dirigen a la programacién en Web porque les interesa mucho la comuni- Introduccion 3 | cacién con las bases de datos). Aprenderé a configurar sus bases de datos, a obtener informa- cin y mostrarta en sus péginas ASP.NET, y a modificar los datos. También conocer las bases de datos tradicionales, cémo comunicarse con archivos esténdar, XML y sobre el almacena- miento en caché. La tercera parte redondea su viaje por ASP.NET al enfocarse en temas més amplios rela- cionados con Ia aplicacién, como la depuracién, la divisin en componentes y la configu- icin, Estos temas son necesarios para generar aplicaciones completas basadas en Web. La cuarta parte esta formada por un par de lecciones dedicadas a explorar temas que no se centran en el aprendizaje de ASPNET, pero que le ayudar a sacar el mayor provecho a ASP.NET para crear paginas poderosas. Una esté dedicada por completo al andlisis de una i6n basada en Web, y otra le explica cémo utilizar ASPNET para dispositivos por- titiles como teléfonos celulares y Asistentes digitales personales (PDAs). Finalmente, los apéndices offecen una referencia completa hecia los temas cubiertos en el libro, y ofrecen sugerencias para evitar las zonas probleméticas. Este libro esté organizado de tal manera que cada lecci6n trata un tema completo, tomando como base a la anterior, por lo que puede seguirlo de forma lineal, leccién por lecci6n, e ir directamente al tema que le interese en cualquier momento. En general, primero se explican los temas y luego se establecen ejemplos, acompafiados de un andlisis concienzudo. Cada leccién concluye con una comparacién entre el ASP.NET y el ASP cldsico, un pequefio. resumen, una seccién de preguntas y respuestas, un pequetio cuestionario para poner a prueba sus conocimientos, y algunos ejercicios para que ponga a prueba sus conocimientos recién adquirides. Convenciones usadas en este libro Se aplican las siguientes convenciones tipogrificas a lo largo de este libro. + Las lineas de eédigo, comandos, instrucciones, variables y cualquier texto que tenga que introducir o ver en la pantalla aparecerdn en una fuente monoespaciada. La fuente monsespaciads on negritae también se utiliza para representar lo capturado por el usuario. + Cuando algtin texto tenga que ser sustituido por datos reales o que usted deba definir, aparecerd en una fuente monoespaciada cursiva. Reemplace ese texto con un nombre de archivo, pardmetro o elemento real al que haga referencia. + Una fuente especial destaca los términos técnicos que se estan definiendo, + Cuando vea un icono de (=) al inicio de una linea de cédigo, lo que indica es que esa linea, en realidad, es continuacién de le anterior. En ocasiones una linea de cddigo es demasiado larga para representarla en una sola linea en una pégina impresa. Si ve una (=) al inicio de una linea de eédigo, recuerde que usted debe escribir ese texto en la linea inmediata anterior (sin la flecha). \4 Aprendiendo ASP.NET en 21 Lecciones avanzadas + Ellibro también contiene notas, sugerencias y precauciones para ayudarle a com- prender informacién importante o para evitarle caer en problemas. Algunas de ellas son ttiles atajos que le ayudardn a trabajar con mayor eficiencia, Por ultimo... Espero que disfrute enormemente la lectura de este libro y el aprendizaje que le oftece esta emocionante tecnologia. Con ella podré realizar miles de cosas sorprendentes en Internet; muchas de ellas de gran demands en el mercado tecnolégico actual, Sin més predmbulos, jempecemos con las lecciones! aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. {6 Parte 1 La leccién 5, “Iniroduccién a los formularios Wed", le presenta el marco de trabajo de los formularios Web, que le permite generar y controlar con facilidad tas interfaces de usuario en ASPNET, Este marco de trabajo consta de controles de servidor, que son elementos funda- mentales para sus interfaces de usuario. Este marco de trabajo también es extensible, como Io verd en la leccién 6, “Un poco mas de los formularios Web”, donde aprenderd a generar sus propios controles de servidor, Por dltimo, en la leccién 7, “Validacién de paginas ASP.NET”, exploraré otro tipo de controles de servidor, los controles de validacién, que le permiten vali- dar con facilidad lo introducido por los usuarios en sus piginas ASP.NET. Al terminar esta parte, tendr una buena cimentacién de los conceptos de ASP.NET, y estard listo para profundizar en los asuntos més avanzados que se analizardn en las partes siguientes. Ha legado aqui para tomar un divertido viaje, jasf que empecemos! aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [10 Leccién 1 ‘Aun en este caso, el proceso se termina cuando el cliente recibe la pagina. El servidor no tie- ne idea de lo que el cliente hace, a menos que éste realice otra peticién, La diferencia con ASPNET Ci Hay otro modelo para que el cliente y el servidor se comuniquen, conocido como. modelo controlado por eventos. El servidor espera a que algo ccurra en el -nte, Cuando algo sucede, el servidor entra en accidn y ejecuta alguna tarea. Imagine que va ala biblioteca. Si siguiera el modelo peticiGn-respuesta, le pediria al bibliote- cario alguna informacién, y él le darfa la respuesta o las indicaciones adecuadas. Con el mo- delo controlado por eventos, el bibliotecario ya sabrfa lo que usted hace. Si esté elaborando un informe acerea de Simén Bolivar y necesita informacién, el bibliotecsrio le Hevaria avtomsti- camente los elementos adecuados, Si tuviera sed, el bibliotecario le Hevarfa un vaso con agua. Si tropieza y cae, el bibliotecario le Hevaria una venda. Naturalmente, el servidor Web no sabe lo que usted piensa, pero si puede responder a sus actos. Si usted captura algo en la pagina Web, el servidor responderd a ello. De gual forma, si hace clic en una imagen, el servidor responderd, Este modelo es mucho mds sencillo para generar aplicaciones que utilizar el de peticiGn-respuesta. ASPNET funciona asi, detecta las aceiones y responde a ellas. {Pero aguarde! {Como puede saber ASP.NET lo que sucede en su equipo? ;C6mo puede reaccionar el servidor a Jo que pasa en el cliente? ASP.NET se basa en el ingenioso procesa- ‘miento en el cliente para simular un modelo controlado por eventos. Procesamiento en el cliente Esto ocurre cuando usted escribe cierto cédigo de programacién en una pigina HTML que el cliente pueda comprender. Este cédigo es simplemente HTML que el explorador Web ejecuta. Por ejemplo, analice ef listado 1.1. Listapo 1.1. El cédigo en el cliente se ejecuta con JavaScript aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Creacién de paginas ASP.NET 47\ Como importar espacios de nombres ‘Cada espacio de nombre en el .NET Framework es esencialmente una coleccién de antepro- yectos. ASP.NET incluye sus propios espacios de nombres, pero en ocasiones este conjunto no es suficiente. Por lo tanto, deberd hacer referencia a otros conjuntos desde sus paginas ASP.NET para generar distintos tipos de objets. Podré acceder a estos objetos adicionales y sus métodos mediante la palabra clave Import Esta linea importa todas las clases del espacio de nombre System.Orawing, como font & image. Ahora podré utilizar estos anteproyectos para generar sus propios objetos. También podré importar sus propios espacios de nombres. De forma predeterminada, se importan auto- ‘maticamente los siguientes espacios de nombres a todas las paginas ASP.NET: * System + System.Collections + System. 10 * System.Web + System.Web.UI + System.Web.UI.HtmlControls * System.Web.UI.WebControls Estos espacios de nombres pertenecen a ASP.NET. Usted no tendra que importarlos explicita- mente, ni verd los comandos utilizados para importarlos. ASP.NET sabe que estos espacios de nombres son necesarios, asi que allf estardn para que usted los use. La figura 2.8 le muestra un pequefio ejemplo de los espacios de nombres disponibles en el NET Framework. No obsiante, al importar un espacio de nombre no se imporan los espacios de nombres que ‘estén abajo de 41, tal como puede inferir de la figura 2.8. Sélo se importan las clases que per- tenecen a tal interfaz, Nota No necesita importar un espacio de nombre para utilizar sus objetos; es solo una forma més sencilla de utilizarlos. Por ejemplo, podria utilizar lo siguien- te en su pagina ASPNET: Dim objArchivo As File (Que no le preocupe atin la sintaxis, Lo que importa por ahora es la porcién del espacio de nombre.) EI File es parte del espacio de nombre System. 10. Sin embargo, podré utili- zarlo aun si no lo importa. Podria emplear lo siguiente en vez de la importacién: Dim objArchivo As Systen.I0.File aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Creacién de paginas ASP.NET 51) C Nota ‘Antes que lo pregunte, le ejecucion lado a lado no es la causa por la cual las, paginas ASPy ASPNET pueden ejecutarse al mismo tiempo. En realidad, la ra- z6n es que cada tipo de pagina es manejada por un filtro ISAPI distinto del Ils. Los programas ISAPI (Interfaz de Programacién de Aplicaciones para Servi- dores de Internet) responden cuando el servidor Web recibe una peticion http. Los filtros pueden ser utilizades por cualquier evento del servidor Web, como el de Leer o Escribir. Estos filtros son muy utiles para las aplicaciones Web, Qué significa el CLR para ASP.NET? En términos del desarrollo en ASP.NET, el CLR da a los desarrolladores algo menos por lo cual preocuparse. Administra la memoria mucho mejor que el método tradicional, y ofrece a las aplicaciones de ASPNET mucho mejor rendimiento y estabilidad. Al contar con un mejor aislamiento de fallas, no necesitard reiniciar el ISS 0 el propio servidor cuando una aplicacién Web falle. ASPNET es mucho mas estable y eficiente que los métodos anteriores para el de- sarrollo en Web. Lenguajes de programacion de ASP.NET Tal vez le confunda esta seccién y se pregunte “;Qué no estoy aprendiendo un nuevo lengua- je de programacién?” ASP.NET no es un lenguaje de programacién. Es tan slo un marco de trabajo que le permite generar aplicaciones en Web. Dicho lo anterior, puede escribir sus paginas ASP.NET en el lenguaje que desee, como Visual Basic.NET o las extensiones manejadas por .NET para C++, C#, J#, etcétera, A fin de ci tas, todo el cédigo se compila a MSIL, y los compiladores deberan emitir metadatos que des- criban a cada aplicaci6n. En consecuencia, el compilador JIT s6lo necesitaré comprender al MSIL. En las lecciones 3 y 4 se examinardn el VB.NET y C#, los lenguajes comunes para la programacién en ASP.NET. Debido a que el CLR necesita asegurarse de que todas sus partes puedan funcionar en con- junto, define un subconjunto basico de caracteristicas que debe seguir todo lenguaje de pro- {gramacién, De otra forma, los objetos desarrollados en distintos lenguajes no funcionarfan bien en conjunto, Este subconjunto se conoce como Especificacién Comin de Lenguaje (CLS). Si sus aplicaciones se apegan a las caracteristicas disponibles en el CLS, podrén funcionar en todas las plataformas y podrén ser manejadas completamente por los objetos compilados en otros lenguajes. (52 Leccién 2 Otra mirada al codigo Ahora que ya tiene una mejor noci6n del funcionamiento de ASPNET, demos otra mirada al cédigo del inicio de ta presente leccién, que se muestra en el listado 2.7. Listapo 2.7 _ Revision de su primera pagina ASPNET 1 <¥@ Page Language="VB" %> 2 3 4 Sub tblensaje Change|sender As Object, e As EventArgs) 5 AblWensaje.Text = "Hola, * + tbitensaje.Text 6 End Sub 7 8 9 cbody> 10 Aprendiendo ASP.NET en 21 Lecciones avanzadas " Leceion 2

12 <& Response Write(*Nuestra primera piginacp>") &> 13 4

2 23 24 Es fic identificar las distintas secciones del e6digo ASPNET aqui, las cuales se encuentran en los bloques de declaracién de cédigo de las Iineas 3 a 7, yen el bloque | proveedor de cédigo de ta Linea 12. Ahora, tambign sabe qué hace cada seccién, La primera | define un método que utiliza el cuadro de texto para su evento TextChanged, y la segunda tan s6lo escribe “Nuestra primera pagina” en el explorador Web. | Hasta la primera peticién, el bloque de declanacién de c6digo se compila a MSIL. que luego { se traduce a c6digo de miquina mediante el compilador JIT. Sin embargo, el resto de la pagi- na, incluso los bloques proveedores de cédigo, se evalian al momento de la ejecucién, cuando 1a pagina se carga en el explorador Web. ‘También puede ver los tres controles del servidor en el formulario. Estos funcionan de forma similar a los controles HTML estindar, con la diferencia de que les primeros ofrecen una fun- ccionalidad adicional para su aplicacién. En las lecciones 5 y 6 se examinardn éstos y otros ccontroles det servidor. Creacién de paginas ASP.NET 53) Asimismo, se enteré de la importancia del atributo runat="server’. Sin él, las paginas ASP. NET no funcionarfan adecuadamente. Este atributo es la clave para mantener el estaco visual, y para vincular lo que sucede en el explorador Web y la respuesta del servidor. Después de esta leccién podra dar mayores detalles de los mecanismos de esta pagina, tanto dentro del .NET Framework como desde la perspectiva del usuario. {Ha avanzado mucho en dos lecciones! jEso no es ASP! Si ya conoce el ASP tradicional, vera muchas diferencias entre éste y ASP.NET a partir de la presente leccién. Un gran cambio es el de ir de los bloques proveedores de cédigo a los bloques de declaraci6n de cédigo. Los primeros eran el método estandar de procesamiento. Ahora los bloques de declaracién de cédigo son preferibles debido a que son compilados y aprovechan las caracteristicas del CLR. También, facilitan la separacién del c6digo de ASP. NET del de HTML. De hecho, son absolutamente necesarios si quiere procesar eventos y envios de formularios. Los bloques proveedores de c6digo ahora emiten errores en muchas situaciones debido a que el modelo de procesamiento ha cambiado. Otro gran cambio es el de haber pasado de lenguajes de secuencias de comandos a lenguajes compilados. Antes, todos los desarrolladores escribfan piginas ASP en VBScript, y ocasional- mente en JScript. ASP.NET ya no permite el uso de estos lenguajes interpretados, pero puede utilizar cualquier lenguaje compilado que desee y que pueda producir MSIL, como VB.NET y C#t, Esto le permite utilizar caracteristicas como enlace temprano y variables ajustadas a tipos. El cambio a lenguajes compilados definitivamente vale la pena, y si ya conoce a VBScript, podrd adentrarse fiicilmente en VB debido a que ambos lenguajes son parecidos, Para obtener mayor informacién, vea http: //www.gotdotnet .com/languages .aspx. Ahora, ASPNET también esté totalmente orientado a objetos. Todo objeto encaja bastante bien en el NET Framework y permite por completo la aplicacién de los principios de la OOP, ‘como herencia, sobrecarga ¢ interfaces. Una similitud entre ambos es que Response.Write atin funciona como antes, pues puede ser utilizado en una pagina ASP.NET para producir resultados, o incluso dar facultades de depura- cién (como muchos desarrolladores de ASP lo pueden confirmar). ASP.NET ahora cuenta con mejores mecanismos para la depuraciGn, como verd en la parte 3. Leccién 2 Aunque Response Wr.te adn funciona, tenga en cuenta que deberd utlizar- Precaucién | 1c entre paréntesis Por ejemplo, lo siguiente ya no funcionaré: Response.Write “iHola, mundo! * Daberd colocar la cadena entre paréntesis. El apéndice & destaca algunos cam- bios mas de este tivo, los cuales pueden provocar algunas equivocaciones. EI mayor cambio, aunque quizéi no el més facil de ver, es el modelo de procesos de ASPNET. El cédigo ahora se compila 2 MSIL y luego a c6digo de méquina con un compilador JIT. Las epli- caciones ahora se dividen en dominios de aplicacién en lugar de procesos, y los archivos aho- ra estin organizados en ensamblajes y espacios de nombres. Estos cambios no significardn mucho para un desarrollador novato de ASP.NET, pero serdn muy evidentes cuando empicce a profundizar en el NET Framework. Resumen En esta leccién conoci6 gran parte del .NET Framework. Aunque podria ser un poco extensa 1a informacién, ta valorari cuando desarrolle aplicaciones ASP.NET mas complejas. ASPNET procesa eventos y codigo en el servidor. El explorador Web sélo reconoce HTML, Jo que significa que los clientes no necesitan aplicaciones o descargas adicionales. Este es. un aspecto importante de ASP.NET: convierte todo el e6ddigo a HTML antes de enviarlo al cliente. El atributo runat="server* offece una gran cantidad de funcionalidad a las paginas ASP.NET, y pemnite a los componentes vincularse con el servidor y mantener un estado visual. Este atributo es fundamental en las paginas ASP.NET. El c6digo de ASPNET se separa del de HTML mediante las etiquetas y %...2%. La mayor parte del eédigo deberd colocarse en estas ctiquetas, debido a que estas seeciones son compiladas y eliminan el problema del cédigo espagueti Los comentarios estén delimitados por uno de tres conjuntos de etiquetas: <1 --...--> en HTML, ' en VB, y <%--...--% en los orientados al servidor. Estos comentarios se utilizan por lo general para explicar aspectos relacionados con el cédigo, y no afectan la ejecucién en absoluto. Utilice el carécter de continuacién de linea (_) para dividir instrucciones largas en varias Iineas, Cuando Io utilice en una cadena, no olvide cerrar ésta y agregar un dimpersand, EL NET Framework y el CLR presentan muchos conceptos nuevos para las aplic ASP.NET, como dominios de aplicacién (la nueva forma de ofrecer limites para tas ciones), ensamblajes y espacios de nombres. ASP.NET es una parte integral del NET Framework, y cada pigina que usted genere extender a este marco de trabajo. nes. Greacién de paginas ASPNET 55) Por ditimo, ASP.NET le permite utilizar lenguajes compilados como VB.NET, C++, C#y J#. ‘Ya no pueden usarse lenguajes interpretados como VBScript. En el siguiente par de lecciones, explorard la programacién de las paginas ASP.NET. En esta leccion vio cémo lucen dichas paginas y cémo funcionan sus diferentes partes, pero ya es tiempo de que aprenda a generar cédigo que controle estas péginas. La leccién 3 se enfocard en las técnicas de programacién con VB.NET y la lecci6n 4 analizard los aspectos de C#. Estos son dos de los lenguajes de programacién de uso comin en ASP.NET. iNos vemos en la siguiente leccién! Preguntas y respuestas P. La importaci6n de espacios de nombres provoca un costo operativo adicional? R_ No, porque es similar a utilizar los archivos incluidos 0 acceder a las referencias en otros lenguajes de programacién. De hecho, a diferencia de otros lenguajes, los tama- fios de los archivos no aumentardn necesariamente. A su vez, el compilador JIT s6lo compilaré una pequefia porcién de cédigo que esté en uso en el momento, por lo que la imponacién de espacios de nombres no significa necesariamente un mayor tiempo de compilacién y procesamiento. ~ En realidad las paginas ASP.NET podrian generarse en cualquier lenguaje? R En teorfa, si, aunque el lenguaje debe ser reconocido por el CLR y deberd ser capaz de producir MSIL. En la actualidad, s6lo se reconoce C#, VB.NET, J# y las extensiones administradas de C++, pero los desarrolladores pueden agregar soporte para cualquier lenguaje al CLR con relativa facilidad, Taller Este taller le permitird reforzar los conceptos tratados en la presente lecci6n. En el apéndice A encontrar las respuestas. Cuestionario 1. 4Cémo mantiene ASP.NET el estado de los controles del servidor? 2. 4A qué espacio de nombre pertenecen las clases Page y Literalcontrol? 3. {Cudles son siete de los espacios de nombres importados automiticamente en cada pagina ASP.NET? 4. {Qué significa “tipos seguros”? 5. {Qué es la Especificacién Comiin de Lenguaje (CLS)? (56 Leccion 2 Ejercicios Genere una pagina ASPNET sencilla que acepte dos nimeros y devuelva su producto cuando se oprima el bot6n Enviar. Utilice dos cuadros de texto, una etiqueta y un bot6n Enviar como controles. Utilice también el controlador de evento estdndar definido en la seccién “Bloques de declaracién de cédigo”, de la leecién actual. Intente usar la funcién Cint() para convertir el contenido de los cuadros de texto a enteros para su multiplica- cidn, como Cint (tbNumerot .Text). Gufese con el listado 2.1 Basado en ef ejercicio anterior, use diversos botones de tipo Enviar que realicen fas operaciones aritméticas basicas, como en una calculadora, PARTE 1 LEcCION 3 Uso de Visual Basic.NET En las dos lecciones anteriores, vio la apariencia de una pagina ASP.NET y qué hace cada una de sus partes. También adquiri6 una solida base del .NET Framework; ‘ahora aprenderé a generar sus propias paginas ASPNET mediante Visual Basic.NET. VB.NET le permitira generar paginas dinémicas que aprovechen todo el poder de ASP.NET. La presente leccién tratard la sintaxis, estructuras de programacién en general y metodologias de programacién de VB.NET, con ejemplos de cada una de ellas. Esto no intenta ser una gufa completa de VB.NET, sino una buena presenta- cién de los conceptos que necesitard saber en las siguientes lecciones. Incluso si ya conoce VB.NET, necesitard leer esta lecci6n. No es s6lo una presenta- cién elemental del lenguaje, sino que contiene informacién para trabajar con las paginas ASP.NET con la ayuda de VB.NET. En esta leccin veremos lo siguiente: + Una introduccién a VB.NET. + Qué son las variables y las matrices. [58 Leccién 3 + Qué son las condicionales, bucles y la légica de bifurcacién. + Qué son las funciones y los procedimientos. + Cémo escribir un controlador de eventos. + Qué son las clases. + Algunas funciones titiles de VB.NET. Introduccion a Visual Basic.NET Visual Basic (VB) es un lenguaje de programacién que se ha utilizado durante afios. Al prin- cipio se emple6 para generar rapidamente prototipos de aplicaciones, pero con el tiempo se ha mejorado considerablemente, Ahora es un poderoso entomo para generar todo tipo de aplica- ciones independientes y totalmente funcionales. VB.NET es la reciente encarnacién de este lenguaje, y esié totalmente reconocido por el .NET Framework y el CLR. Es uno de los lenguajes més populares para el desarrollo en ASPNET y Jo mejor de todo es que su curva de aprendizaje no es pronunciada, Por tal motivo, usted utili- zaré a VB.NET en este libro para crear sus piginas ASP.NET. Variables Variable es un término genérico para cualquier dato en la memoria de la computadora que tenga un nombre. Por ejemplo, si asigna la cadena “Hola, mundo!" a una variable y la llama x, ésta sera colocada en la memoria y ocupard unos 12 bytes (més o menos). A partir de aqui, esta informacién seré reconocida con ese nombre. Dado que una variable es s6lo una ubicacién en la memoria, usted puede modificarla, eliminar- la, moverla, etc, Sin embargo, el aspecto importante de una variable es que esté en un lugar de la memoria, Tipos de datos Usted puede almacenar diversos tipos de informacién en una variable, como cadenas, nimeros y fechas. Cada uno tiene un conjunto de reglas que gobiernan su uso, mismo que descubriré conforme desarrolle sus paginas ASP.NET. En Visual Basic.NET hay 10 tipos de datos ba- sicos, conocides como tipos primitives. Estos son Ia base para el uso de las variables, de ahi €1 témino primitivos, y se dividen en cinco categorias distintas: enteros, mimeros de punto flotante, cadenas, fechas y booleanos. La tabla 3.1 resume estos tipos. Uso de Visual Basic.NET 59) TaBLa 3.1 Tipos primitivos de VB.NET Tipo Categoria Descripcion ayte Enteros ‘Un nimero entero de I byte (también conocido como systen.int) Short Enteros Un aiimero entero de 2 bytes (también conocido como system.Int16) Integer Enteros Un niimero entero de 4 bytes (también conocido como system.Ints2) Long Enteros Un nimero entero de 8 bytes (también conocido como ‘Systom.Inté4) single Punto flosante Niimero de 4 bytes con punto decimal (también conocido como System.Single) double Punto florante Niimero de 8 bytes con punto decimal (también conocido como systen.Doutie) decimar Punto flosante Niimero de 12 bytes con punto decimal (también conocido co- mo Systen.Decinal) char Cadenas Un cardcter Unicode (también conocido como Systen.Char) pate Fechas Un valor de fecha y, en su caso, de hora (también conocido co- ‘mo System. DateTime) Boolean Booleanos, Un valor verdadero o falso (también conocido como System.oolean) Enteros Un entero es un numero completo, sin parte decimal o fracci6n, Por ejemplo, 3, 6767 y —1 son enteros, mientras que 3.4 y 3 1/2 no lo son. ‘Aunque los enteros son un tipo genérico de variable, hay subtipos que usted puede utilizar de acuerdo con la cantidad de memoria que necesite. Un entero técnicamente utiliza 32 bits de me- moria (4 bytes). Esto significa que puede almacenar cualquier nimero desde ~2,147,483,648 hasta 2,147,483,647, Por lo general esto serd més que suficiente para sus necesidades. Tam- bién hay bytes (8 bits), chars (16 bits), shorts (16 bits) y Longs (64 bits). No tendra que preocuparse mucho por ellos, pero allf estarin cuando les necesite. Numeros de punto flotante ‘Son aquellos con una parte fraccional, como 4.5, -1.956445 0, incluso, 3.0, ‘También hay subtipos para éstos, de acuerdo con la cantidad de espacios decimales que ne- cesite: single, double y decimal. Nuevamente, no tendrd que preocuparse mucho de ellos debido a que el tamafio de memoria predeterminado por lo general seré suficiente. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Uso de Visual Basic.NET 63 | + Utilice nombres que tengan sentido, Los nombres como I 0 temp tal vez lo tengan de forma temporal, pero al regresar a ver su c6digo en una semana, no recordard para qué us6 estas variables. ‘Tampoco exagere con un nombre como intUsadaParaLlevarUnControlDeMiBucle. Esto es demasiado y s6lo hard més lento su e6digo. En vez de ello, utilice intBucle 0 intIterador. + Inente declarar todas las variables en un solo lugar, generalmente al principio de la pagina. Esto le ahorrard después mucho tiempo tratando de encontrar sus variables. Estas cambian los tipos de las variables. A esto también se le conoce como conversién explicita (casting). VB.NET puede convertir automiticamente algunos tipos (conversién im- plicita), pero otros tienen que convertirse de forma explicita. VB.NET le da varias funciones para cambiar tipos, como se muestra en la tabla 3.2. TaBLA 3.2 Funciones de conversi6n bool cayte cenar coate coec coon cmnt cing 0} short sng ester ctype Ase Por ejemplo, CByte transforma un tipo de dato 4 Byte, y CStr a String. Estas funciones son muy ttiles en las péginas ASP.NET, y las verd con frecuencia. El listado 3.2 muestra un ejemplo de conversisn de tipos de datos, Listapo 3.2 Conversion automatica de datos 'VB" Debug="true" %> ‘continia aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Uso de Visual Basic.NET 65) Esta es una situacién muy comin en ASP.NET. Aqu‘ deberd convertir explicitamente el valor String a Integer con Asc, que convertira un cardcter a su valor numérico ASCII correspon- diente. Modifiquemos la linea 15: Response.Write(intNunero * Asc(strNombre) &

") ‘Ahora su pagina funcionard como se espera. Tome en cuenta que algunas conversiones provocaran la pérdida de datos. Precaucin | po: ejemplo, siconvierte un namero de punto fiotante a entero, perders ‘todos los valores decimales. Hay otra forma de convertir tipos de datos en VB.NET. Muchos de ellos cuentan con un mé- todo que le permite convertir de un tipo a otro. Estos métodos siempre empiezan con To y terminan con el tipo de dato al que se convertir4, (Veremos estos métodos posteriormente en “Légica de bifurcacién™.) Por ejemplo, para convertir un Integer a String, podemos utilizar Tost ring: Dim MiEntA As Integer = 4 Dim MiCadena As String Micadena = MiEntA.ToString No obstante, tenga cuidado con estas funciones debido a que algunas no se permiten, Por ejemplo, no puede convertir de String a Integer con el método ToInt32. Verd estos métodos en los ejemplos de cédigo. Matrices Las matrices son frecuentemente los tipos més tiles de cualquier lenguaje de programacién, aunque de los més dificiles de comprender. Cada lenguaje tiene sus propias reglas para las ‘matrices, por lo que es fic confundirse. El NET Framework simplifica este proceso y genera un conjunto de reglas para todas las matrices. Las matrices son grupos de variables almacenadas en conjunto a las que puede hacer referen- cia de manera individual mediante sus indices. Imagine un cartén de huevo. El propio cartén es el contenedor y cada huevo es una variable. Puede hacer referencia a cada huevo por su fndice: huevol, huevo2, etc. (La figura 3.3 demuestra este concepto.) Esto le permite almacenar en conjunto elementos similares. Las matrices en VB.NET estén basadas en cero, lo que significa que el primer elemento en una matriz se encuentra en el indice 0. De esta forma, el tiltimo indice de una matriz siempre seré uno menor a la cantidad de elementos en la matriz. Todas las variables de una matriz debern tener el mismo tipo de dato, no podré tener tipos mezclados. Veamos una sencilla de- claracién de una matriz: 66 Leccion 3 Dim WiMlatriz(6) As Integer Dim MiNatriz2() As String = {"perro", ‘gato, “caballo, _ "elefante", *Llana‘} Ficura 3.3 Una matriz es como un carién de huevo. En la primera Ifnea s6lo declaré una matriz para seis elementos (ahora vacfos) de tipo Integer. Esto significa que el tihimo elemento en la matriz estaré en el indice 5. La cantidad entre paréntesis de la I{nea 1 le indica cudntos elementos habré en la matriz, Dicha canti- dad también se conoce como longitud de la matriz. Si jiera declarar explicitamente la matriz, como en la linea 2, deberd omitir el ndimero y utilizar Haves ({ }) para asignar los va- lores. La longitud de esta segunda matriz es de 5. “Perro” esté en el indice 0, y podré hacer referencia a él como MiMatriz2(@); a “llama”, como MiMatriz2(4). El listado 3.3 le muestra un ejemplo. Listapo 3.3 _Declaracion de una matriz y uso de sus elementos 1 : aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Erase arrColores La instruccién Erase establece cada valor de la matriz.a Nothing, que es la forma que VB.NET tiene para indicar que no hay ningtin valor almacenado en la variable: Nota La clase Array de VB.NET ofrece mas funciones para e! manejo de matrices. ‘Vea la documentacién en el SDK del .NET Framework para encontrar mayor informacion. Operadores Estos son simbolos que se utilizan para realizar alguna tarea. Por ejemplo, el operador = se puede utilizar para asignar valores: strNombre = "Hola" ‘Ya deberia estar familiarizado con muchos de los operadores puesto que los utiliza en su vida diaria. La tabla 3.3 muestra todos los operadores de VB.NET en orden de precedencia, Tasia 3.3 Operadores de VB.NET Funcién Operador Exponenciacién a Negacién unaria be Multipticacién, divisi6n entera (6\4= 1) 4 isign (6 /4= 15) 1 Médulo o residuo (6 mod 4= 2) Mod ‘Suma, resta + Negacién, ¥, O y O exclusivo de bits Coneatenscién Igual, distinto, menor que, mayor que Menor o igual que, mayor o igual que Relacional Asignacién Negacién, ¥, O y O exclusivo légicos BivNor, BitAnd, BitOr, BitXor &,+ (para eadenas) o> ea ‘TypeOf...Is, Is, Like NOT, AND, OR, XOR ‘También puede valerse de los paréntesis para modificar el orden de precedencia. Por ejemplo, 445*3 = 19, mientras que (4+5)*3 = 27. Uso de Visual Basic.NET 69) Légica condicional Esta le permite especificar qué eédigo deberd ejecutarse de acuerdo con las condiciones en- contradas. Es un poderoso mecanismo bisico para todas las aplicaciones. Esta seccién tratard distintos métodos para manejar la Iégica condicional: las instrucciones 1f y Ca: Instrucciones If Estas son La forma més simple de légica condicional, El flujo del procesamiento de esta ins- trucci6n es sencillo: si algo ocurre o se cumple cierta condicién, entonces se realiza una ac- cién espectfica. He aqui un ejemplo real de una instruccién If: Imagine que labora en una linea de ensam- blaje de una fébrica de relojes, y que su trabajo es armar los relojes. Su jefe le indica: “Si se rompe la manecilla de la hora, tire el reloj” Veamos la sintaxis: If (condicién) Then codigo End If Si se cumple la condicién, ejecutard el cédigo entre las Ifneas If y End If. Si no se cumple, tan s6lo continuard sin ejecutar el cédigo. El listado 3.4 muestra algunos ejemplos, Listapo 3.4 _Instrucciones If sencillas 1: 68 Page Language="VB" %> La tercera instruccién Tf (de las lineas 9 a 15) utiliza las palabras clave Elser y Else para evaluar otras condiciones. La linea 9 pregunta si NiMensaje tiene "Saludos* y si MiGoo1 es cierta mediante el operador AND. Si se cumplen ambas condiciones, mostraré MiMensaje en el explorador Web. O, si MiMensaje vale "Hola", escribe "Cierto" en el ex- plorador, como se muestra en las lineas 11 y 12, Por tiltimo, si hay cualquier otra condici6n, tan s6lo escribe *Falso*. Esto le ofrece una I6gica condicional més compleja. La cuarta instruccién If (Ifnea 18) es otra forma sencilla de escribir una instrucci6n 1. Podré combiner toda Ia instruccién If en una linea y omitir por completo el End If. Podré realizar muchas cosas con insirucciones Tf, pero hay ocasiones en que no es tan fii su aplicacién o cuando no se logra exactamente lo que se necesita. Para ello estén las instruc ciones case. Instrucciones Case También Ilamadas Select, son basicamente iguales a las If con cldusulas ElseIf. Una ins- trucci6n Case examina una variable y realiza alguna accién, programada por usted, de acuerdo con su contenido, Exploremos la sintaxis: Select Case variable se opcion 1 cédigo Case Else cédigo End Select Puede establecer tantas instrucciones Case como desee y usar un Case Ese para manejar la posibilidad que algo no cumpla con sus criterios. Por ejemplo: Select Case Nonbre Case "Ringo" Respon: Case "Paul* Response.Write("Baj ista") case Else Response.Write("Es otro de Los Beatles") End Select rite("Baterista" ) aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. (74 Leccion 3 En Ia segunda linea, el programa verifica si intContador es mayor que 10. No deberfa, por- que usted le ha dado un valor de 1. El programa ejecuta el c6digo dentro del bucle While, que despliega el numero en el explorador Web y suma 1 a intGontador. Luego, regresa a la segunda linea y verifica nuevamente si intGontador es mayor que 10. Ahora vale 2, por lo gue el bucle continéa. Cuando termine, verd los ntimeros del 1 al 9 en su explorador Web. La figura 3.5 ilustra este proceso. Figura 3.5 El proceso ciclico {Por qué utilizamos 9 en lugar de 10? Una vez que intContador Hega a 10, la instruccién en la linea 2 ya no se cumple (seré falsa), por lo que termina el bucle y continia después de Ja linea 5. El bucle Do es el mismo que While, pero la sintaxis cambia un poco. El bucle Do tiene varios formatos, como el siguiente: D0 eédigo Loop While condicién He aqui otro: Do While condicién codigo Loop Cada formato produce un resultado distinto, dependiendo de la cantidad de veces que quiera que se ejecute. Veamos un ejemplo de cada uno: Dim intcontador As Integer = 10 Response.Write(intContador & “
") antGontador = intcontador + 1 Loop While intcontador < 10 Uso de Visual Basic.NET Do While intContador < 10 Response.Write intContador & "") intContador = intContador + 1 Loop El primer bucle despliega el ntimero 10, mientras que el segundo no hace nada. {Por qué? El primero evalia la condicién en la wiima linea. Por consiguiente, el cédigo dentro de él se eje~ cutard una vez sin importar nada. El segundo evaltia la condicién desde el inicio, y por ello no se ejecutard el c6digo al no cumplirse, Deberé usar un bucle Do cuando quiera que el cédigo que contiene se ejecute al menos una vez. De lo contrario, utilice un Do While si el cédigo se ejecutard s6lo si se cumple con alguna condicién, También puede utilizar Unt1 en vez de While: Dim intGontader As Integer = 1 Do Response.Write(intContador & *") intContador = intContador + 1 Loop Until intContador >= 10 Este bucle hace exactamente lo mismo que el del listado anterior. La diferencia es que el uso de Until hard que el bucle continée hasta que se cumpla la condicién, mientras que While se detendré cuando ya no se cumpla, En este caso, el bucle finalizaré cuando intContador sea igual o mayor que 10. Bucles For Utilice este bucle cuando sepa cudntas veces se ejecutari su cédigo. Dicho bucle incrementaré un contador hasta un cierto limite, que es cuando terminard su ejecucién. La sintaxis del bucle For es como sigue: For variable c6digo Noxt [variable] valorinicial To valorFinal [Step incremento} Este bucle se vale del 1ncremento para cambiar el valor de la variable hasta que alcance el valorFinal, donde finalizard su ejecucién. (Puede omitir el pardmetro Step si lo desea, con lo que el increnento serd de 1 de forma predeterminada.) Por ejemplo: For intcontador = 1 to Response.Write(intContador & *
*) Next 0: For intContador = 10 to 1 step -1 Response.Writo(intContador & "
*) Next * S {76 Leccion 3 El primer bucle muestra los ntimeros del 1 al 10, mientras que el segundo lo hace en orden inverso. tra variedad de este bucle es For. ..Zach, Este bucle itera por todos los elementos de una coleccién, como una matriz. Por ejemplo: Dim arrDiassemanas() As String = {"Lune “Wiéreoles*, "Jueves", *Viernes*} Dim strDia As String For Each strDia In arrDiasSenanas Response.Write(strDia & "
") Next “martes”, _ La primera Ifnea genera una matriz de cadenas con cinco de los dfas de la semana. La cuarta linea itera en cada elemento de la matriz. La variable strDia es tan s6lo un contador para el bucle, podrfa establecer cualquier otra que desee. E! bucle asigna cada valor de la matriz a Ia variable strO4a, y usted lo desplegard en la Ifnea cinco. El resultado serd que los dfas de semana aparecerin en el explorador Web, como se muestra en la figura 3.6. Ficura 3.6 Uso de un bucle For. . .Each para iterar por los elementos de . Mae: Naees ive Views Bucles infinitos Observe que ha establecido manualmente los incrementos o condiciones en sus bucles While y Do, mientras que en los For se hace auiométicamente, Esto es muy importante, de otro modo acabaria sumergido en un buele infinito, aquel que nunca finaliza, No s6lo sera terrible para quienes visiten su sitio, sino que también acabara rapidamente con los recursos de su sistema y provocaré fallas, aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Uso de Visual Basic.NET 79| En la linea 13 escribird el producto de esios pardmetros al explorador Web mediante Response. Write, y ena linea 14 finalizard el método. Ahora que ha creado el método, podré utilizarlo en cualquier parte de la pagina. Cabe indicar que este método no se ejecutara a menos que usted lo ordene explicitamente, no lo haré s6lo porque usted lo coloeé ahi. Frenuno wo En a linea 5 usted lama (o ejecuta) al método, Esto te indica al programa que fae - i ejecute el cédigo del método y que regrese a la Iinea 5 al terminar (podré ver la légica de bifurcacién aqui). Cuando lame a MultipLicarNumeros, especificard los pa- metros que definié el método: dos enteros, Mult ip1icarNuneros los tomaré y realizard sus tareas. Las Iineas 7 y 9 hacen algo similar, pero pasan parémetros distintos al método. Esto es parte de los controles de la légica de bifurcacién: podré ejecutarlos desde cualquier parte y darles distintos pardmetros para su ejecuci6n. Esto producira lo que se aprecia en la figura 3.7. Ficura 3.7 Uso de los métodos ara ejecuar cédigo encapsulado, a nal, tal vez recuerde como ejecutar ;nte forma: Si ya conoce a VBScript y al ASP tradi Precauclin | ics métodos y las funciones de la MultiplicarNuneros 8, 9 Lo anterior se hace sin paréntesis. Sin embargo, con VB.NET y ASPNET, siem- pre debera incluirlos al ejecutar una funcién, o de lo contrario se produciré un error, aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Uso de Visual Basic.NET se puede usar dentro de la clase. Esto es itil para evitar que otro c6digo modifique las va- riables que sean importantes para usted. No obstante, estos detalles no serdn tratados en esta leccién; por tal motivo, le recomiendo que vea una guia de programacién orientada a obje- tos para encontrar mayores detalles. El método EstablecerHora define las propiedades segundo, minuto y hora de la clase de acuerdo con los parémetros indicados. En su pagina ASP.NET puede hacer lo siguiente: Dim objReloj As New Reloj objReloj .EstablecerHora (60,4, 12) ‘objReoj .Segundo = 59 La primera linea declara un objeto objRe10j cuyo tipo de dato se basa en la clase Reo}. Podré establecer las propiedades 0 ejecutar los métodos de esta clase mediante el objeto obje1oj, como se aprecia en la segunda y tercera Ifneas. Al encapsular cédigo en comin como lo ha hecho, puede imaginar la programacién como el simple manejo de objetos. Nota Ha colocado su clase dentro del bloque de declaracion de codigo en este caso, pero normalmente estarfa en otro archivo para facilitar la lectura del cédigo. En las clases de VB.NET normalmente este archivo tencria la extensi6n vb. Aprenderé mas de ello en la leccion 15, "Uso de objetos de negocios”. zY qué hay con New? La palabra clave New es muy importante, se utiliza para generar un objeto. Por ejemplo, lo siguiente establece una variable con el tipo de dato Re1oj, pero no genera el objeto (esto es, aunque la variable sabré que sera de tipo Reloj, atin no ha generado el objeto): Dim objReloj As Roloj La palabra clave New genera el objeto. Sin New s6lo indicarfa que la variable obj Re10j conten- dr una encarnacién o instancia de la clase Reo}. Para generar el objeto después de declarar la variable que lo contendré, podria escribir lo siguiente: objReloj = New Reloj ‘También puede generar el objeto de la siguiente forma: Dim objReloj As Reloj = New Reloj Esto es similar a utilizar 1a palabra clave New después del nombre del objeto. Herencia sta es una parte importante de las clases y la programacién orientada a objetos. No sera tratada profundamente aqui, pero conocerd sus fundamentos para aplicar en sus paginas ASP.NET. 87) aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Uso de Visual Basic.NET 91) Tapia 3.6 Continuacion Funcién Descripci6n replace(expresién, buscar, Reemplaza buscar en la expresi6n con reenplazo(, iniciol, cantided reemp1azo, a partir de inicio; cantidad es el numero de , comparacién)}1) reemplazos por hacer; cuyo valor predeterminado es —1 | (todos los reemplazos posibles); conparacién ¢s similar a instr. right (cadena, longitud) Devuelve una cadena que contiene una cantidad indicada de caracteres a la derecha de una cadena. Para futuros expertos de VB.NET: hacia donde ir | | Visual Basic.NET es un poderoso lenguaje de programacin amigable para los desarrolladores | que le permitird generar aplicaciones ASP.NET complejas y de nivel empresarial. Aunque no hemos profundizado en é1, va podrd dar sus primeros pasos en las paginas ASP.NET. Para ob- tener mayor informacién de VB.NET, vea la siguiente informacién: | | + Referencia para el desarrollador en MSDN (nsdn.microsoft .com) + Referencia en Internet de NET Framework (www.microsoft.com/net) + Laespecificaci6n y referencia del lenguaje de VB.NET en la documentacién del SDK de NET. jEso no es ASP! La gran diferencia entre ASP y ASPNET tratada en la leccién actual es el cambio de VBScript a VB.NET. Aunque gran parte de su sintaxis es similar, hay algunas modificaciones que pueden tomar por sorpresa a un nuevo desarrollador de ASP.NET. VB.NET tiene muchas modificaciones. Ahora es totalmente orientado a objetos, lo que podria, no serle tan extrafio si usted ya es un desarrollador en VBScript. Las clases se utilizan mucho en el .NET Framework, mientras que en el ASP tradicional rara vez se emplean. Es necesario (que aprenda a utilizarlas 1o antes posible. Otro gran cambio de ASP a ASP.NET es el uso del modelo controlado por eventos. Aunque el mecanismo subyacente de este modelo se basa en una mecénica de peticiGn y respuesta, hay una nueva capa de abstraccién que permite a los desarrolladores utilizar mAs tiempo en generar aplicaciones que en preocuparse por los detalles del envio de datos. Aprenderd mas de esto en. las lecciones 5 y 6. El apéndice B, “Errores comunes en ASP.NET”, lista algunos problemas que pueden tener los desarrolladores de ASP conforme cambien hacia ASP.NET. Leccién 3 Resumen En esta leccién aprendié a generar sus propias pagiras ASPNET con VB.NET. A partir de aqui deberd tener un buen dominio de los fundamentos de tz programacién que le permitiran generar paginas més complejas. Esta leccién empez6 con un vistazo a las variables en VB.NET. Las variables son lugares en Ja memoria que puede manejar a través de sus nombres. Hay 10 tipos de datos basicos para las variables en VB.NET, divididos en cinco categorias: enteros, ntimeros de punto flotante, booleanos, cadenas y fechas y horas. Las matrices son grupos de variables que se pueden utilizar a través de sus indices. Son tiles para almacenar informacién similar en un solo lugar. En VB.NET todas las matrices inician con un indice de 0, No puede generar alguna que inicie con un valor distinto de cero. Conocié tres tipos de Iégica: condicional, bucles y bifureacién. La logica condicional se vale de las instrucciones If y Case para evaluar condiciones. La de bucles utiliza a While, Do y For para ejecutar bloques de cédigo en varias ocasiones. La bifurcaci6n utiliza métodos y funcio- nes para realizar alguna accién, aunque las funciones pueden devolver resultados. También conocié los eventos, que son cosas que pueden suceder en su aplicacién, y los con- troludores de eventos, que son Ios métodos que realizan alguna accién cuando se presenta un evento, Son muy similares a los métodos pero se distinguen por sus listas de parimetros. Por tiltimo, se le presentaron las clases y la herencis. Examiné las clases, que son definicio- nes de objetos. Agrupan un eddigo comin para representar una entidad con propiedades y métodos, Las clases son una parte importante del NET Framework y ASP.NET. La herencia \e permite extender la funcionalidad de clases existentes para cumplir con sus necesidades, y sustituir métodos que no las cumplan, En esta lecci6n conocié muchas de las tareas més complejas en la programacién con ASP.NET. Una vez que pueda generar ficilmente métodos, controladores de eventos y clases, jpodra elaborar cualquier pagina ASP.NET! En la siguiente leceién aprenderd a utilizar CH, un lenguaje que se ha disefiado para facilitar el desarrollo de aplicaciones empresariales orientadas a Web. C# se deriva de C y C++, yen muchos aspectos se parece a Java, por lo que deberd estar familiarizado con gran parte de sui sintaxis si ha desarrollado en esos lenguajes. También exploraré parte de los objetos que se utilizan con mayor frecuencia en ASP.NET. Uso de Visual Basic.NET 93) Preguntas y respuestas P {VB.NET distingue entre maydsculas y mindsculas? R_ No. Por ejemplo, los nombres Mi¢lase y miclase son idénticos. P {Qué sucedié con el tipo Variant? R Si yaesté familiarizado con versiones anteriores de VB, recordard que el tipo variant era genérico y se utilizaba para representar cualquier variable que no hubiese sido declarada con algtin tipo especffico. En VB.NET, el Variant se ha reemplazado con el tipo Object. Taller Este taller le permitird reforzar los conceptos tratados en la presente lecci6n, Enel apéndice A encontrard las respuestas. Cuestionario 1. Cudndo deberfa utilizar un bucle For? {Cuando uno Whils 2. gCudl es el resultado del siguiente cédigo? Dim I As Integer = 5 Do Response.Write(I & * *) I=1+2 Loop Until 1 > 10 3. Cudl es el resultado del siguiente codigo? Dim 1 As Integer = 5 Do Ter+2 Response.Write(I & * *) Loop until I> 10 4, 2Cudles son los pardmetros estndar de un controlador de eventos de las paginas ASP.NET? Ejercicio 1. Cree una pagina ASPNET con una clase que lo represente a usted, con propiedades que describan el color de su cabello, de sus ojos y su fecha de nacimiento. Utilice la propie- dad dayotweek del tipo de dato datetime para determinar el dia de la semana en que nacié, La propiedad dayofweek devuelve un entero, conviértalo al dia de la semana. Ejecute este método siempre que el usuario haga clic en el botén Enviar, y despliegue el resultado en el explorador Web. PARTE 1 LECCION 4 Uso de objetos ASP.NET con C# y VB.NET En la leccién anterior aprendié a crear sus propias paginas ASP.NET con VB.NET. Conocié varias estructuras para controlar sus pSginas, entre ellas los bucles, las ins- trucciones condicionales, las funciones y los eventos. Estas estructuras le permiten crear poderosas paginas ASP.NET. No obstante, si todo eso fuera lo tinico que pudiera hacer ASP.NET, no seria fantds- tico para el desarrollo en Web, Como parte del .NET Framework, ASP.NET puede aprovechar cientos de clases y objetos integrados que mejoran y extienden la fun- cionalidad de sus péginas. En la presente leccién estudiard algunos de los objetos comunes que serdn utilizados en este libro, ‘También conocer a C# (Ci Sharp 0 Ce Sharp). Este lenguaje, creado por Microsoft, es similar a VB.NET y se centra en el desarrollo de aplicaciones como servicios ‘Web. C# es popular para el desarrollo en ASP.NET, por lo tanto es importante que lo entienda. La mayoria de los ejemplos de esta leecién estén en C#, asi como en VB.NET. Muchos de los conceptos de programacién son similares en ambos lenguajes, por To que después de la leccién anterior, sélo necesitard conocer Ia sintaxis de C#. No obstante, después de esta leccién s6lo se concentrard en VB.NET para la creacién de sus paginas (96 Leccion 4 En esta lecciGn veremos lo siguiente: + Cémo utilizar a C# en sus paginas ASP.NET. + Qué son los objetos y conocer algunas de sus propiedades. + Cémo aprovechar los objetos comunes de ASPNET. + Cémo trabajar con las sesiones y las cookies. Presentacién de C# C# es un nuevo lenguaje de programacién de Microsoft que puede utilizarse en el NET Framework. Debido a que C# se deriva de C++ y C, los desarrolladores que ya conozcan estos lenguajes no tendrén que aprender VB.NET para programar sus paginas ASP.NET. C# también tiene cierta semejanza con el Lenguaje de programacién Java, por lo que incluso los programadores de éste no deberdn tener problemas con él. ‘Muchos de los conceptos que trataremos en esta leccién son muy similares a los de VB.NET que vimos en la leccién anterior. Tanto VB.NET como C# son poderosos lenguajes para el Sesurrollo en ASP.NET, por lo tanto, usted podré desarrollar sus péginas con el lenguaje que prefiera Ejemplos de la sintaxis de C# Esta secci6n es un curso relémpago de la sintaxis bésica de C#. Muchos de los conceptos subyacentes son similares a los de VB.NET, por lo que slo necesitard conocer las diferencias entre ambos. Variables e instrucciones Generalmente, los tipos de variables son los mismos en C# que en VB.NET. No obstante, st. eclaraciOn es un poco distinta, Para declarar un entero en VB.NET, debe hacerlo de la manera siguiente: Dim Witnt As Integer En C# lo hard ast: int Witet; ‘Aqui hay tres diferencias, La primera es que en C#, el tipo de dato va antes del nombre de la variable. int significa integer. La segunda diferencia es la ausencia de las palabras clave Dim y As. Por tiltimo, todas las instrucciones de C# deberdn terminar con punto y coma. Ahora veamos algunos ejemplos mas de declaraciones: public int Hora; //crea una variable entera llamada Hora bool blnIR = true; //crea una variable booleana llamada blnir /Joon el valor true aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. {100 Leccion 4 Una recapitulacién de los objetos Como ya se indicé en la leccién anterior, los objetos son secciones reutilizables de cédigo y las clases son las definiciones de dichas objetos. En la leccién previa incursion6 en esta area al crear un sencillo objeto Reloj El .NET Framework consta de muchas clases que definen objetos, y ASPNET puede utilizarlos todos. Desde luego, hay algunos objetos que aunca deber‘an utilizarse en una pégina ASPNET real, debido a que no se aplican a ASP.NET, pero aun asf podré utilizarios. Recordemos al- yunos conceptos de la leccidn pasada. Propiedades Estas son variables que describen un objeto. £1 listado 4.1 muestra el ejemplo de! reloj de la leccién anterior, pero esta vez en C#. Listapo 4.1 _Laclase Reloj en C# shtml> El método Write necesita una cadena como parimetro, por lo que deberd ponerla a entre comillas. En el recuadro de precaucién, al final de esta pagina, encontraré mas detalles, Examinemos la linea 8 con mayor detenimiento: 4 Response. Write("


") ie i Especificamente, vea la barra diagonal inverss aparentemente fuera de lugar al fi- nal de la \inea. Sin este cardcter, la linea contendria la cadena %>, que indicaria a ASPNET que habria Hegado al final del bloque script. Esto detendria la ejecucién a mitad de la cadena, lo que provocaria un error, Esta es una secuencia especial de caracteres que de- berd distinguir de alguna manera para que ASP.NET no se confunda. Es por ello que se utiliza el cardcter de escape (\) La barra diagonal inversa no aparece en el resultado HTML. Si quiere mostrar comillas dobles, tiene que usar otro par de comill Response.Write)"
") Este listado deberd producir el resultado de la figura 4.2. VB.NET realiza cierta conversion de tipos de datos automaticamente. La conversién de un integer a string podria servir como ejemplo. Es por ello que puede utilizar Response.Wriite(6) en una pagina ASPNET con VB.NET. No obstante, C# no realiza la misma conversién automaticamente. Por io tanto, usar Response. Virite(6) produciria un error en una pagina ASP.NET con C#. En vez de ello, utitice lo siguiente: Response.Write (int. Tostring(6)) {Siempre recuerde convertir el tipo de su variable adecuadamente! aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. 108 Leccién 4 Figura 4.4 Cémo controlar el bifer Response, Asses race ‘ang de par, ts aka El objeto Request En contraste con el objeto Response, el objeto Request permite la interaccién del explorador Web con el servidor. El explorador envia mucha informacién al servidor cuando solicita una ‘pégina. Cuando esto ocurre, se genera un objeto Ht tpRequest para tratar con toda la informa- cién enviada, Este objeto se llama Request. De este modo, el objeto Request representa la peticin de un cliente, y el servidor Web envia una respuesta utilizando los objetos Request y Response. No es necesario que conozca a fondo la funcionalidad de este objeto, pues ASP.NET maneja la mayor parte de ésta. No obstante, hay algunas cosas que debe saber. Cémo averiguar la informacién del cliente Una de las principales funciones del objeto Request es obtener informacién per- sonal a través del explorador Web, por ejemplo, lo que haya capturado un usuario en los formularios 0 los valores de cadena de consulta. Esta tiltima se refiere a cualquier informacién enlazada al final del URL de la peticién, por ejemplo: https //mww.Wicrosoft. com?id-Tania&sexo-femenino La cadena de consulta, ?id=Tania&sexo=fenenino, presenta los datos en forma de pares de clave y valor. id es la primera clave y Tania es el primer valor, sexo es la segunda clave y ‘femenino es el segundo valor, etoétera. Fl primer par de clave y valor siempre estard precedido por un signo de interrogaci6n, y los siguientes estarén separados por un ampersand, tal como se muestra. Uso de objetos ASP.NET con C# y VB.NET 109) La cadena de consulta es util para pasar informacién de una pdgina a otra. Por ejemplo: Response .Redirect(*mipagina. aspx7I0=Tania") Mipagina. aspx ahora puede utilizar la informacién de esta cadena de consulta cuando la necesite. Prec Tenga cuidado de no almacenar demasiada informacién en la cadena de AUCHON | consulte, ya que los exploradores Web antiguos s6lo pueden reconocer hasta 255 coracteres en esta cadena, y usted nunca sabré cuando uno de sus visitantes utilice un explorador Web viejo. A su vez, colocar grandes cantida- des de texto aqui podria traer algunos errores en antiguas versiones de Ils. ASPNNET ofrece una capa de abstraccién con el propésito de que usted no tenga que utilizar al objeto Request para recopilar informacién de los formularios (como lo vera en la leccién 5, “Introduccién a los formularios Web”), pero el objeto estaré alli para que lo use. Con el URL anterior, puede teclear lo siguiente para obtener los valores de la cadena de consulta: Request.Querystring J/devuelve ‘id=Tania&sexo=fenenino" Request.Querystring("id") //devuelve ‘Tania® Si el usuario envié un formulario, puede utilizar esto: Request.Form //devuelve todos 10s valores del formulario Request.Form(nombre) //devuelve un valor indicado por nombre ‘Tanto las propiedades Querystring como Form representan colecciones de informacién, Por Jo general, ésta proviene de la informaciGn capturada por el usuario y ASP.NET la obtiene me- diante el objeto Request. No tendré que utilizar mucho este objeto en el libro debido a que el marco de trabajo de los formularios Web maneja autométicamente muchas de las peticiones. Otro par de colecciones comunes utilizadas con Request son ServerVariables y Cookit La primera devuelve informacién del servidor, como la direccién IP o el protocolo HTTP. La segunda devuelve informacién de las cookies, que son pequefios archivos en el equipo del cliente (vea “El objeto HttpCookie” mis adelante). La tabla 4,3 le muestra algunas variables de entomo comunes en la colecci6n ServerVariables. TaBia 4.3 _ Variables de entorno usadas comunmente Variable Descripcién URL EIURL de la pigina ASP.NET, empezando después del servidor y nombre de dominio (es decir, luego del nttp: (/wm. Servidor com). PATH_INFO ‘Lo mismo que Unt. continia [10 Leccién 4 Tasia 4.3 _Continuacion Variable Descripcién PATH TRANSLATED ‘Toda la ruta fisica de ASPNET en el servider. ‘SERVER_NAME El nombre del servider Web. SERVER_SOFTHARE El nombre del software del servidor Web, como Microsot El objeto HttpCookie Una cookie es un pequefio archivo en Ja computadora del usuario que contiene in- formacién especffica para un sitio Web. Este archivo puede contener datos como. nombres de usuario y contrasefias que se utilizarin para ajustar el sitio al gusto del usuario cuando éste lo visite. Las cookies pueden contener cualquier tipo de dato sencillo como String, Integer, Float, Boolean, eicétera. Por ejemplo, muchos sitios contienen encabezados que permiten elegir el tipo de noticias que se desean ver. Esta informacion puede almacenarse en las cookies de modo que la préxima vez que el usuario haga una visita, el sitio podré leerla y hacer el ajuste necesario. Peet El objeto HttpCookie ofrece métodos para acceder y generar esas cookies. Puede utilizar este objeto para analizar las propiedades de una cookie. No obstante. a forma comin de manejar las cookies es mediante los objetos Request y Response, los cuales cuentan con una pro- piedad Cookies que devuelve una referencia a un objeto HttpCookie. Cémo generar cookies El objeto Response le permite generar cookies con facilidad. Hay dos formas de hacerlo: puede generar varias cookies, cada una con un valor en particular, o puede generar una cookie con diversos pares de clave y valor. La siguiente seccién de cédigo demuestra ambos métados Establece algunas variables de cookie Response .Cookies("MiCookie”).Value = “Una cookie’ Response. Cookies( *CookieDe211a" j(*Usuario") = “Tania” Response. Cookies( *CookieDe211a"}(“Preferencia") = "800x600" La segunda linea genera la cookie “MiCookie", con el valor “Una cookie*en el equipo del cliente. Puede generar tantas cookies y parejas de clave y valor como desee con este método, jpero acabarfa con muchas cookies! El segundo grupo de cédigo genera una cookie Hamada ‘CookieDe211a* que tiene dos parejas de clave y valor. Para especificar nombres de claves, tan sélo agregue otro nombre entre paréntesis (o entre corchetes en C#), como sigue: EY Response. Cookies |NombreCookie] [NombreClave] ; Uso de objetos ASP.NET con C# y VB.NET 111) Observe que, en la segunda linea del primer cédigo debe utilizar la propiedad Value para asignar una cadena a la cookie. El s6lo usar Response .Cookies (‘WiCookie" ) devuelve un HttpGookie, en el que no puede escribir cadenas. La propiedad Value devuelve un objeto de tipo string que usted puede modificar. No obstante, en el segundo grupo de cédigo no nece- sita especificar a Value porque ASP.NET sabe que usted necesita una cadena para establecer un rombre de clave. Si genera una cookie con un valor y le agrega claves, el valor inicial seré Precauciin | porado. No puede generar une cookie con ambos valores y claves. ‘Suponga que llega un visitante a su sitio Web y usted le genera una cookie. Si nunca regresard, ‘no hay razén para que la cookie permanezca en su equipo. El usuario puede borrarla manual- mente, pero hay otra forma mds sencilla. Usted puede utilizar la propiedad Expires para que la cookie quede inhabilitada cuando usted 10 especiique. Por ejemplo: Response. Cookies ("CookieDe2t 1a") .Expires = _ DateTime. FromString('1/1/2002") oO Response . Cookies (“CookieDe2i1a").Expires = DateTime .Now. Addionths (1) EI primer ejemplo indica que la cookie expira el 1 de enero del 2002. El segundo indica que debe expirar un mes después de que el c6digo se ejecute. El valor predeterminado de Expires hhace que la informacién quede sin validez después de 1,000 minutos. Esto es adecuado si tan slo quiere mantener la informacién para esta sesién. (Vea “El objeto Session” mas adelante.) No obstante, las cookies se utilizan usualmente para almacenar informacién por periodos prolongados: semanas, meses o, incluso, affos. Para suprimir una cookie del cliente, necesita establecer el valor Expires de la cookie @ alguna fecha pasada 0 a 0. La cookie serd suprimida en cuanto el usuario cierre su explora dor Web. Hay otras cuatro propiedades del objeto Ht tpCookie que debe conocer. Domain restringe el uso de 1a cookie al dominio que usted indique, como win, miservidor .com. Esto offece tun buen control de acceso para la cookie, pero tipicamente deberd dejarlo con el valor pre- determinado, Path es similar a Domain, pero s6lo permite el acceso a la cookie a las paginas ASP.NET que se encuentren en una ruta especifica del servidor. Haskeys le indica si esta cookie tiene claves 0 es una cookie de un solo valor. Por dltimo, Secure indica a ASPNET si debe o no transmitir la cookie de forma segura: es decir, s6lo bajo el protocolo HTTPS. El valor predeterminado es false. [112 Leccion 4 Como acceder a las cookies El expiorador Web envia toda la informacién de las cookies al servidor en cada peticién que le hace, Por Jo tanto, es posible utilizar el objeto Request para recopilar dicha informacién. El acceso a una cookie sigue exactamente la misma sintaxis que al generarla. En el siguiente listado usaré a Response.Write para escribir los valores de la cookie en el explorador Web: ‘ establece algunas variables de cookie Response.Write) _ Request .Cookies( *MiCockie") .Value) Response.Write) Roquest .Cookies( *CookieDe211a") (*NonbreUsuario” )} Response.Wirite| _ Request .Cookies( "CookieDe2t 1a") (*Preferencia’}); Nuevamente, vea la diferencia entre acceder un valor y las parejas de clave y valor: especifi- ‘camente, el uso de la propiedad Value. Debido a que las parejas de clave y valor son simples colecciones de datos, puede iterar por ellas con facilidad, como se aprecia ene! listado 4.4. Listapo 4.4 _Cémo iterar por las claves de cookie 1: <8 Page Language="VB" > aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [116 Leccion 4 El evento Load es may importante para los desarrolladores de ASP.NET. Puede hacer muchas cosas con este evento, como verificar la identidad del usuario, cargar datos de una base de da- tos y redirigir al usuario, De hecho, la mayoria de las paginas ASP.NET que vers a partir de este momento tendrén un controlador para este evento. Yeamos otro ejemplo. Suponga que desea mostrar al usuario distintos mensajes de acuerdo ta la pagina. Podria hacerlo como se muestra en el listado 4.6. con la hora en la que éste Listapo 4.6 Como mostrar distintos mensajes con el evento Load <8@ Page Language="VB" >
En la Iinea 23 ha generado otro contol Label. En su evento Load estableve la varia- WAN ble Ahora en la hora en curso, y utiliza la propiedad Hour del objeto DateTime para éevolver la hora, | La lfnea 8 muestra Is hora en curso en el control Label. El método ToString devuelve una cadena con la fecha y hora ya formateadas, y toma un argumento: una cadena que indica cémo dar formato a la fecha. La tabla 4.4 lista las cadenas de formato correctas. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [120 Lecci6n 4 Listapo 4.8 Como recuperar variables en Session FiGurA 4.8 Almacenamiento y recuperacién de variables Session, suas && Suponiendo que no ha cerrado el explorador Web, deberd ver un mensaje de bienvenida con el nombre que almacené en el listado 4.7. También podria almacenar objetos y almacenes de datos en Session, como con cualquier otra variable. 4Cémo logra ASP.NET llevar un control de las sesiones? Normaimente, cuando un usuario vi- sita el sitio y se inicia una sesién, el equipo genera un identificador tinico para él, mismo que se almacena en el equipo cliente como cookie. Al ir el usuario de pagina en pagina, ASPNET lee este valor de cookie para determinar a qué sesién pertenece dicho usuario. Puede leer fi- cilmente el valor con la siguiente sintaxis: Response.Write |Session.. sessionID) aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [124 Figura 4.10 Las seudocookies agre- gan identificadores de sesi6n cifrados en los hire en jorma de cade- nas de consulta. Pagina ASP.NET ES Leccion 4 1. El usuario solcita la pagina “ 3. El usuariohace ig en un vinculo En la lecciGn 18 aprenderé formas mds avanzadas de configurar a Session. El objeto HttpApplication Este objeto representa una aplicaci6n de ASP.NET. (ASP.NET define una aplicacién como el conjunto de archivos que hay en un directorio virtual y sus subdirectorios.) Este objeto se analizari con mayor detalle en Ia lecci6n 18, aunque en esta seccidn se verdn algunos temas preliminares. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. (132 Lecci6n 5 Presentacién de los formularios ‘Veamos una vez més cémo fimciona Web. Recuerde que en la leccién 1, “Primeros pasos con ASP.NET”, un cliente envia una peticién a un servidor para obtener cierta informacién, y que éte responde con su envio. Lo anterior es el fundamento del modelo peticién-respuesta. El cliente también puede enviar datos al servidor. Los formularios HTML permiten la interac~ ci6n del usuario con paginas Web: una comunicacién entre el cliente y el servidor. Por ejemplo, el listado 5.1 muestra un formulario HTML tipico que permite al usuario teclear su nombre y hacer clic en el boton Enviar. Listapo 5.1 Un formuiario HTML tipico
Por favor, tecles su nonbre: Ambas lineas reflejan pocas similitudes, La primera es utilizada por el servidor: el cliente nunca la ve. (Y de hacerlo, el explorador no sabria qué hacer debido a que s6lo comprende HTML.) La segunda linea es lo que recibe el cliente. Al generar coniroles de esta forma em- plearé menos tiempo preocupindose por el HTML que contenga el disefio de la interfaz de usuario, y mas en Io que ésta deberd hacer, A su vez, ASPET conoce las facultades de cada explorador Web, por lo que en- 23 viard el HTML adecuado a cada uno. Por ejemplo, si el explorador Web no soponia el HTML Dingmico (DHTML), ASPNET no le enviard eédigo de este tipo. Esto se conoce como soporte de bajo nivel debido a que ASPNET puede adaptar el oSdigo HTML para los exploradores Web que no soporten una funcionalidad de alto nivel. Precauciin | \2'tt2!se!que el soporte de bajo nivel tradujera todo adecuacamente caucl para cada control. En la realidad no hay tanta suerte. Algunos elementos tendrén problemas al er interpretados por distntos exploradores Web, ya cue no todos tratan igual al HTML. Por ello, cuando desarrole para los pri pales exploradores Web, | soporte de bajo nivel funclonaré adecuedamente. (Casi siempret) Eventos de los controles de servidor Los controles de servidor generan diversos eventos. Es decir, hay muchas cosas que puede hacer un usuario con un control de servidor: hacer clic en un botén, en un vinculo, llenar un cuadro de texto, seleccionar un elemento de un cuadro de lista, etc. Todos estos eventos debe- rin ser controlados por el servidor, por lo que cada vez que ocurra alguno, el cliente enviar datos al servidor. Nota Es importante distinguir entre los eventos pasivos de los activos. Un evento activo necesita una accién explicita del usuario, lo que significa que éste de- bera realizar la accién de forma intencional. Esto incluye oprimir un botén, seleccionar un vinculo, llenar un cuadro de texto, ete. Un evento pasivo se puede ejecutar sin intencién directa del usuario, como mover el cursor por una imagen. Solo os eventos activos se manejan en el servidor; hay muchos eventos pasi- vos para enviar de forma fidedigna todos los datos al servidor. No obstante, ain podra controlarlos con secuencias de comandos en el cliente. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. {140 Leccién 5 Cémo enviar formularios Web Imaginemos una situacién tipica de ASPNET. Cuando la pagina se cargue en el explorador Web, usted desplegard un mensaje de bienvenida en un control de servidor. Dicho mensaje se hard parte det estado visual del control, y ASP.NET lo recordard autométicamente. Cuando el usuario envie el formulario, o suceda un evento que provoque un envio al servidor, éste procesard los datos 0 eventos que necesite, y luego regresaré la pagina al cliente para su despliegue. Debido 4 que ASP.NET recuerda el estado visual del control, jautomdticamente llenard el mensaje de bienvenida sin que usted intervenga! Esto tambien se aplica para la informacion capturada por el usuario, Si éste captura su nombre en un cuadro de texto, verd que el nombre permanece ahi, aun cuando se haya enviado el formulario. Esto es un cambio bienvenido res- pecto de los formularios HTML, donde los valores se perdian al hacer los envios. Por lo tanto, no necesita volver a Henar los valores de los controles de servidor después de enviar e! formulario, ASP.NET Io hace por usted. Como ya se mencioné en Ia leccién 4, “Uso de cbjetos ASP.NET con C# y VB.NET”, el ob- jeto Page tiene una propiedad Hamada IsPostBack que le informa si el formulario ya ha sido ‘© noenviado, Puede verificar esta propiedad y decidir si Hlena 0 no los controles de servidor. El listado 5.4 muestra un ejemplo. Listapo 5.4 _Verificacion de la propiedad IsPostBack 1; <8@ Page Language~'vB" =>

contrasena:

Reemplace el archivo anterior InicioSesién.ascx por el cddigo de este listado. La tinica adicién es el bloque de declaracién de cédigo de las lineas 1 « 10. Es muy simi- lar al del listado 6.2, con algunas modificaciones. En la linea 2, la propiedad colorFondo se establece inicialmente a "White", y se definen las propiedades nombreUsuario y contrasenia para que el usuario pueda manejarlas. Observe la palabra clave public; otra pagina ASPNET podra utilizar ahora estas propiedades de forma programatica para establecer u obtener los valores en la interfaz de usuario. EI método Enviar es exactamente el mismo que el del listado 6.2. Debido a que los controles de usuario son muy similares a las paginas ASP.NET, sélo tiene que copiar y pegar este cédi- go. Una vez que guarde este archivo con la extensién .asex, ya podré usarlo en sus paginas ASP.NET. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [174 Leccién 6 En estos elementos puede agregar cédigo para realizar cualquier accién que desee cuando se acceda a la propiedad. En Ia linea 5, que sucede cuando el usuario recupera el valor, usted de- vuelve el valor contenido en el cuadro de texto Usuario con s6lo asignar el valor de la propie- dad en si, En la linea 8, que ocurre cuando se establece el valor de la propiedad, asigna el valor obtenido al cuadro de texto Usuario. La palabra clave value se refiere al valor que el usuario ha asignado a esta propiedad. Por ejemplo, en la siguiente linea, value se referiria a "David inicioSesiont .nombreUsuario = "David" Tip Si desea generar una propiedad s6lo de lectura o de escritura, simplemente omita el elemento Set o Get y agregue le palabra clave ReadOnly o Write Only. Por ejemplo, la siguiente seccién de codigo genera una propiedad nombreUsuar io que solo puede leerse: Public ReadOnly Property nonbrelsuario As String Got nonbreUsuario = Usuario. Text End Get End Property Las lineas 12 a 19 oftecen exactamente la misma funcionalidad para la propiedad contrasenia y el control de cuadro de texto Contr. Ahora, vuelva a cargar el listado 6.4 en el explorador Web. Deberd ver la pagina que aparece en la figura 6.5. Ahora el campo nombreUsuario aparece con un nombre debido a que usted estableci la propiedad correspondiente en la linea 19 del listado 6.4. Observe que el campo contrasenia afin estd vacio. Esto es porque este cuadro de texto en particular tiene establecida su propiedad Textlode en password, y ASP.NET no lo llenard, por cuestiones de seguridad. No obstante, observe que la propiedad contrasenia atin tiene su valor asignado, tal como se aprecia en Ia etiqueta que estd sobre el control de usuario. Si quita el cédigo TextNode=" Password” de este cuadro de texto, el valor aparecers. Ahora su control de asuario sera totalmente funcional, con propiedades que pueden ser contro- ladas desde una pdgina ASP.NET y métodos para manejar sus propios eventos. Este control puede colocarse en cualquier pagina ASP.NET y funcionard tal como lo hace aqui. Un poco més de los formularios Web 175) Figura 6.5 Uso de propiedades para Wenar previamente Jos elementos de un ‘control de usuario, Controles personalizados El marco de trabajo de ASP.NET también le permite generar controles personalizados. Este es un tema avanzado, pero no deberd tener mayor problema para comprenderlo pues ya esta familiarizado con el marco de trabajo de los formularios Web. Los controles personalizados no son controles de usuario. En lugar de encapsular cierta funcio- nalidad de la interfaz de usuario, los controles personalizados pueden definir su comportamien- to totalmente original, Por ejemplo, ASP.NET no ofrece un control integrado para interpretar Jos dibujos monocromaticos. Un desarrollador podria generar un control personalizado para ofrecer esta funcionalidad, mismo que podria utilizarse varias veces y colocarse en cualquier aplicacién de ASP.NET. En tanto que los controles de usuario se utilizan cuando desea combinar la funcionalidad de controles existentes, los controles personalizados se utilizan cuando ninguno de los controles existentes cumple con sus necesidades. El marco de trabajo de los formularios Web le permi- te extender la biblioteca de controles con sus propios controles. Estos pueden ser totalmente originales 0 extender el comportamiento de un control existente. En este punto, serd stil explo- rar con mayor detalle el marco de trabajo de los formularios Web. La figura 6.6 ilustra las relaciones entre los distintos conceptos en el marco de trabajo de los formularios Web. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Un poco més de los formularios Web 177) Guarde este archivo como ControlPersonalizadot . vb. Observe que éste es un archi- vo fuente de VB.NET y no una pégina ASPNET. Por ello, tendré que realizar algunos ‘pasos mds, como importar los espacios de nombres que seri importados automsticamente @ los archivos . aspx. En las lineas 1 a 3 lo hace con ayuda de la palabra clave Imports, que es similar a la directiva @ Import de las péginas ASP.NET. | Luego, en a tinea 5 declara el espasio de nombres al que pertenece este contro. Este podria | ser cualquier espacio de nombres que desee. Sélo recuerde incluir End Namespace. como se aprecia en la Linea 11. En la linea 6 generé una clase que se deriva de Control. (Vea la lec- cién 3, “Uso de Visual Basic.NET”, para mayor informacién sobre cémo generar clases.) Las lineas 7 a 9 contienen una de las partes més importantes de los controles de usuario. Render es el método que permite a los controles existentes mostrar HTML en el explorador Web, Este método es heredado por todos los controles de servidor a partir de la clase Control. Para que su control personalizado muestre HTML en el explorador Web, deberd ofrecer una implementacién de este método. No obstante, debido a que este método ya existe en la clase Control, debers sustituirlo con la palabra clave Overrides. (Los controles de servidor integra- dos también lo hacen.) |No olvide la palabra clave Protected! El método Render toma un parimetro, un objeto HtmlTextWriter Hamado Output. Este objeto ofrece todos los métodos necesarios para ayudar al método Render @ producir salida HTML. Lo usard para producir un resultado en su control personalizado, En la Ifnea 8 usa el método Write de la variable Output para enviar HTML al explorador Web. En este caso serdn la fecha en curso y un mensaje de bienvenida. Finalmente, para usar su control personalizado en otra pégina ASPNET debera compilar el c6digo; ASP.NET no puede usar directamente los archivos fuente de VB.NET. Abra una ventana de consola (0 linea de comands), vaya al directorio donde se encuentre Control Personalizadot . vb, y teclee lo siguiente: vbc /t:library /out:..\bin\ControlesPersonalizados.dll /r:System.d11 s=/r:Systen.Web.dl1 ControlPersonalizadot.vb Esto compilara el archivo fuente ControlPersonalizado1.vb a un archivo MSIL llamado ControlesPersonalizados .d11 (tal como se indicé en el pardmetro /out) para que ASP.NET lo use, Deberd ver el siguiente resultado: Versién 7.00.9254 del compilador de Microsoft (R) Visual Basic.NET para Microsoft (R) .NET CLR version 1.00.2914.16 (G) Microsoft Corp. 2001. Reservados todos 1s derechos. Para obtener mayor informacién de los espacios de nombres, clases, comandos de compilacién, el directorio \in, y la generacidn de objetos en general, vea la lecciGn 15, “Uso de objetos de negocios”. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Un poco més de los formularios Web 181 Listapo 6.9 Continuacién We Set 12: ViewState(*ensaje") = value 13: End Set 14: End Property 15: 16: Public Property Tamanio As Integer 17: Get 18: Tamanio = CType(ViewState('Tamanio"), Integer] 19: End Get 20: Set ViewState(*Tamanio") = value End Set End Property Protected Overrides Sub Render (Output as HtmlTextWriter) Output.Write("" & _ Me.Mensaje & "") End Sub End Class End Nanespace Guarde este archivo como ControlPersonalizade2. vb. Este control muestra un sencillo mensaje al usuario, indicado en la propiedad Mensaje. Como tal, es muy si- milar a ControlPersonalizadot . vb. No obstante, la propiedad Mensaje ahora se conserva en estado. En el elemento Set de la linea 12, almacena el valor asignado en una variable del saco de estado Tlamada Mensaje, en lugar de hacerlo a una variable privada como en el listado 6.8. La instruccién Get de la Ifnea 9 recupera, entonces, este valor del saco de estado. Recuerde utilizar el método ToSt ring para convertir en cadena el valor devuelto del esta- do, pues ASP.NET lo devuelve, de forma predeterminada, como objeto. También agregé una propiedad llamada Tananio, que establece el tamafio de la fuente con la que se mostrard e! mensaje. Este elemento de propiedad funciona muy similar a Mensaje, excepto porque es un entero. Nuevamente, los elementos Get y Set recuperan y asignan el valor al saco de estado. El método CType de la linea 18 convierte a entero el dato devuelto por el saco de estado. Compile este archivo con el siguiente comando: vbc /t:library /out:..\bin\ControlesPersonalizados.d11 /r:System.d11 = /r:Systen.Wed.d11 ControlPersonalizado2. vb El listado 6.10 le muestra una pagina ASP.NET que utiliza este nuevo control. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Un poco mas de los formularios Web 185) Listapo 6.11 Continuacién 23: Public Sub RaisePostDataChangedevent() Inplenents te IPostBackDataHandler.RaisePostDataChangede vent OnTextChanged( EventArgs. Empty) End Sub Public Property Mensaje As String Get Mensaje = ViewState(*Nensaje").ToString End Get sot Viewstate("Nensaje") = value End Set End Property Protected Overrides Sub Render (Output As HtmlTextiiriter) Gutput.Write(" ‘Sub Page_Load(obj As Object, e As EventArgs) Dim objCT As New TextBox objcT.1D = "tbuno" objCT.Text = "iHola!* Page.Controls.Add(objcT) End Sub El cuadro de texto obj CT aparecers en su pégina cuando la cargue. De esta forma, puede gene- rar tantos controles de servidor como desee. Una vez que el control se genera, deberd ser agregado a un contenedor; ya sea otro control (como un Pane) o la propia Pago. Todo con- trol que pueda contener a otros tiene una propiedad Controls, que, a su vez, tiene un método ‘Add que toma el control que se ha de agregar. El cédigo anterior produce el resultado que aparece en la figura 6.12 cuando se ve en un explorador Web. No obstante, observe que no puede asignar controladores de eventos de esta forma. Lo si- guiente producird un error: objCT.OnTextChanged = *Wanejalo* En su lugar, deberd agregar un controlador de evento a este control de forma dindmica, con el método AddHandler: AddHandler objCT.TextChanged, addressOf Nanejalo El método AddHandler toma dos pardmetros: el evento por controlar (en este caso, el evento TextChanged, y mo OnTextChanged) y el método que deberd controlar al evento. Aqui deberd utilizar el operador addressOf. Ofrece un puntero al método adecuado. Ahora pod generar un método Manejalo que se ejecutaré cuando se desencadene el evento Text Changed para este control. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Un poco mas de los formularios Web 193) La forma en que ASP.NET se comunica con los objetos COM es totalmente distinta. Para obtener mayor informacién del modo en que funcionan los objetos COM en ASP.NET, vea la leccion 15. Resumen {Uf, fue una leccién extenuante! Ha aprendido mucho del marco de trabajo de los formularios Web y cémo exienderlos con la generacién de sus propios controles de servidor. También co- nocié la diferencia entre generar controles en tiempo de ejecucion y en tiempo de diseio, y ahora deberd estar familiarizado con ambos métodos. Los controles de usuario son simples secciones de c6digo de Ia interfaz de usuario que estén contenidas en archivos con la extensi6n .asex. Cualquier piigina ASP.NET puede transfor- marse en control de usuario con s6lo quitar las etiquetas , y , modificar las directivas @ Page por @ Control, y la extensién del archivo de .aspx a .ascx. Los con- troles de usuario pueden y deben contener la légica que controla a los elementos de la interfaz de usuario, Esto le permite encapsular totalmente una secci6n de funcionalidad de la interfaz de usuario ¢ implementarla facilmente en cualquier pégina ASPNET. Los controles personalizados le permiten generar controles de servidor que realicen cualquier tipo de tarea que desee. Estos controles se usan cuando ningtin control de servidor satisface sus necesidades. Se generan en archivos fuente de VB.NET y deben compilarse con el compilador de éste (vea la leccién 15 para obtener mayor informacién). Con los controles personalizados puede agregar capacidades de estado y eventos. Lo primero es ficil de implementar. Tan s6lo utilice el saco de estado para almacenar las propiedades de su control, en lugar de variables privadas. Lo segundo es més complejo, pero sigue un estén- dar, Puede escribirlo una vez y, simplemente, copiarlo y pegarlo en otros controles. Deberd registrar los controles de usuario y los personalizados con la directiva @ Register antes de usarlos en sus péginas. La sintaxis es un poco distinta en ambos casos: * Control de usuario <4@ Register TagPrefix="Prefijo" TagName="Nonbre* src='rutaDelArchivo" %> * Control personalizado <%@ Register TagPrefix="Prefijo" Namespace="espacidDeNombres* wAssembly="Ensamblaje"%> Puede generar controles de servidor en tiempo de ejecuci6n ademas de en tiempo de disefio. Esto le permite controlar la interfaz de usuario incluso en circunstancias imprevistas, como al leer muchos datos e intentar colocarlos en su interfaz de usuario existente. Los controles regula tes de servidor y los controles personalizados pueden generarse como cualquier otro objeto en ASP.NET, con ayuda de la instruccién Dim. Por otro lado, los controles de usuario deben usar el método Page. LoadControl para generar instancias. Este método devuelve un tipo de dato basado en el nombre del archivo fuente de su control de usuario. Utilice una variable de este tipo de dato para asignar propiedades a su control. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Validacién de las paginas ASP 203) Los controles Validation son similares a los controles Web (vea Ta leccién 5, “Introduccién los formularios Web”). Se generan en el servidor, devuelven cédigo HTML al explorador Web y se declaran con la misma sintaxis: La diferencia es que estos controles no despliegan nada a menos que lo capturado no sea vali- do. De otra forma, serén invisibles y el usuario no se enterard de su existencia. Asi pues, el trabajo de un control de validacién es vigilar otro control de servidor y validar su contenido. La propiedad Contro1tovalidate especifica cual control de servidor serd vigilado. Cuando el usuario teclee datos en el control vigilado, el control de validscién verificard los datos para asegurarse que cumplan con las normas que usted haya especificado (vea més adelante la sec- cién “Cémo funcionan los controles Validation”). La tabla 7.1 resume los tipos de validacién predefinida ofrecidos por ASP.NET. Utilizard to- dos estos controles conforme avance en la presente leccién. Todos pertenecen al espacio de nombres Systen.Web.UI.WebControls. Tasia 7.1 _Tipos de controles Validation en ASP.NET Contro! Descripcion RequiredFieldvalidator Garantiza que el usuario no ha omitido un campo necesario, Conparevalidator Compara Ia captura de un usuario con un valor de constante, con un valor de propiedad de otro control, o con un valor de base de datos mediante un operador de comparacicn (menor que, igual, mayor que, eteétera) RangeValidator Verifica que la captura del usuario se encuentre dentro de cier- torrango. Puede verificar los rangos comprendidos entre pares de valores numéricas, caracieres alfabéticos y fecias. Los imites del rango pueden expresarse como constantes 0 valeres, derivados de otro control (de la documentacién NET SDK), RegularExpressionvalidator Verifiea que lo captarado por un usuario coincida con un pa- trén definido por una expresién regular. Este tipo de validacién permite verificar secuencias predecibles de caracteres, como rimeros de seguridad social, direcciones de correo electréni- co, ntimeros telefénicos, c6digos postales, etcétera (de la do- ‘cumentacién .NET SDK). Custonvalicator ‘Verifica 1o capturado por el usuario con ayuda de una logica de validacién que usted mismo debe codificar. Este tipo de valida- cin permite verificar valores derivados en tiempo de ejecucion. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Validacién de las paginas ASP 207 Ahora veamos el HTML producido por su pagina ASP.NET. Haga clic con el bot6n derecho en Ia pagina y seleccione Ver c6digo fuente. El listado 7.4 le muestra una porcién de este cédigo. Listao 7.4 _El cédigo fuente condensado de su pagina de validacion {8 wan Esta pagina tiene mucho contenido, asf que solo analizaremos las partes importantes. En la linea 2 verd su etiqueta fora estindar. No obstante, observe que cuando se | envia este formulario (es decir, cuando se ejecuta el método Submit), el mismo ejecuta la | funcién validatoronsubmit en lugar de enviarse directamente al servidor, Esta funcién, ubicada en la Ifnea 25, determina si la validacién esté habilitada en la pagina (y lo esté, de forma predeterminada) y ejecuta otra funciGn que realiza el procesamiento de Ia validacion (para mayor informacién, vea mas adelante la seccién “Cémo inhabilitar Ia validacién”). aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. i Validacion de las paginas ASP 211) Listapo 7.5 _Continuacion , anbsp;

Teléfono (xxxx-xxxx)
7 right "> server® aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [220 Leccion 7 Cuando interprete expresiones regulares, le ayudard buscar los caracteres especiales. Debido aa que pueden agruparse, también explore los caracteres que estén enire caracteres especiales, Por ejemplo, ia expresion href \\s*=\\s*(\" ({7\" 1") \" | (\\84) ) significa nret seguido por ninguno 0 varios espacios (\s*), luego por =, luego, nuevamente, ninguno © varios espacios. A esio le siguen comillas dobles (\"), luego ninguna o varias ocurrencias de cualquier cosa que no sean comillas ({*\"]*), Seguido de comillas dobles « uno 0 varios espacios que no estén en blanco (\S#). Esta cadena puede ulilizarse para encontrar anclas en una pégina HTML, como nref = “ancla: y hret="oye*. Observe que el caricter de escape se usa en varios lugares (\) donde no es necesario, Por ejemplo, * no tiene un significado en especial. Coincide con el cardcter *. No obstante, ante a duda, usualmente es mis seguro utilizar el caricter de escape. La expresién regular 0-9] {5} [0-9] {4}! [0-9] {5} se traduce en cualquier quinteto de ca- racteres del 0 al 9, seguido de un guién, y luego un cuarteto de caracteres del 0 a 9, 0 cualquier auinteto de caracteres entre 0 y 9. Los valores como 90219 u 83847-1422 serdn correctos, mientras que valores como 98214 0 902 no lo seri. Las expresiones regulares se utilizan comiinmente en el cémputo para hacer coincidir patrones de texto, Para obtener mayor informacién, verifique la documentacién del SDK del .NET Framework, 0 Jos siguientes recursos en Intemet: + http://www. 4guysfromrolla.com/webtech/regularexpressions. shtml + http://www. asplists.com/asplists/aspregexp2.asp?tab=links + http:/ /wiw. amazon .com/ exsc /obidos /ASIN/ 1565922573) Cémo personalizar la validacion Los controles de vatidacién son muy flexibles. Puede controlar la manera de desplegar los mensajes de error, decidir como se alerta de los errores a los usuarios, ¢ incluso generar sus propios controles de validacién, ASP.NET da a los desarrolladores un enorme conjunto de facultades. Mensajes de error Los ejemplos que ha desarrollado en la lecci6n actual colocan a los controles de validacién inmediatamente después de los controles por validar. Esto no es necesario, pueden colocarse en cualquier parte de la pagina. Por ejemplo, puede colocarlos al principio de la pagina si quiere agrupar fos mensajes de error. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [224 Leccién 7 Los mensajes mostrados en el control Val.idationSunmary son los que haya indicado en las propiedades ErrorMessage de los controles de validacién. Para modificar el mensaje de error indicado, use la propiedad Text: 1: El validador del nombre ahora mostraré “|Olvidé escribir el nombre!” en el control Valida~ tionSummary. Si no quiere mostrar los mensajes que indic6, puede establecer la propiedad Display de cada control en none. Con la adicién de la propiedad ShowMessageBox, puede generar un mensaje de aparicién siibita con el control ValidationSunmary. Por ejemplo, modifique la porcién del cédigo anterior para que se lea como sigue: 1: Lucgo de teclear informacié: Ia figura 7.9. forrecta y oprimir Enviar, deberd ver el cuadro de diélogo de Figura 7.9 Un mensaje de alertaa los usuarios con un cua- dro de aparicién sibita La tabla 7.5 resume los pardmetros necesarios para mostrar los mensajes de error del control ‘Validation en diversas formas y posiciones. Tasia 7.5 _Pardmetros de disefio para mensajes de error Tipo ValidationSunmary Pardmetros del control Validation Directo Noes necesario Display = Static o Dynamic Erroriessage =Texto que incluins Resumen Necesario Display = None Errortiessage = Texto de error del resumen ‘Ambos Necesario Display = Static o Dynamic ErrorMessage = Texto de error del resumen uid Text = Texto de error que aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. indice encabezados de, HTTP, 488 eventos, 137 evitar, 483 HutpCachePolicy, clase, 481 lado det cliente en compa racién con el lado del servidor, 463 tipos de, 482-483 utileria de, global, 618 variacion por los encabezados, 486 por pardmetros, 484-486 Alt, propiedad HtmiForm, control, 890 Htmllnputimage, control, 893 AlternateText, propiedad (Image), 908 AlternatingltemStyle, pro- piedad DataGrid, control, 903 DataL ist, control, 905 AlternatingltemTemplate, plantilia, 287 AlternatingltemTemplate, propiedad DataL ist, control, 905 Repeater, control, 911 anclas, 890 aplicaci6n(es), 592-593 ‘bancaria, 233-234, 491-492, 717-118 base de datos, 492-495 Cuenta, objeto, 718-725 encabezado, 235 meni, 234-235 pagina de cierre de se- sin, 725, 727 pagina de inicio de se- sin, 235-237, 496- 498 pagina de resumen de cuenta, 238-240, 498-501 pages de cuentas en Ii nea, 240-242, 501-505 seguridad, 727-728 servicio Web, 728-729 definicion, $92 desplegar caché de ensamblajes, 617-618 ensamblajes sombrea- dos, 618-619 servicios Wed, 554 ejecucién de, 50-51 global asax, archivo, 593.595 controladores de even- 10, 599-601 ejemplo, 597-598 HitpApplication, clase, 595-597 ubicacion, 595 Hola (primera pigina ASP.NET) bloque de declaracién de cédigo, 36 bloque proveedar de cGdigo, 37:39 directivas de pagina, 39 estado visual, 40-42 formulario Web, 33-35 listado de eddigo, 32- 33, 52.58 listado0201 aspx, fuen- te,34-35 HitpApplication, objeto, 1242125 PlatanoMovil, ejemplo. Vea PlatanoMovil, apli- cacién reinicio, 880 tiempo de ejecucién, 49 lado a lado, 50-51 ensamblajes, 50 MSIL (Lenguaje Inter- medio de Microsoft), 49 procesos, 49-50 Append, modo (FileMode), 443 AppendChild, método, 382 ApplyDefaultSort, propiedad (DataView), 929 ApplyStyle, método, 897 ‘, parametro (web.config), 605-607 Arbol de control, seccién (rastreo en funcién de ta pagina), 673 Arboles de datos, 361 de documentos, 361 archivos, 427-428 brie File, objeto, 442-443 FileStream, objeto, 444 almacenamiento aislado, 451-452 reacién, 452-453 Jectura desde, 454-457 bicaciones implicitas, 453-458 bormado de, 450 copiado de, 450 creacion, 450 de recursos carga, 648-650 compilaci6n, 654 creacién, 647-648 ‘objetos de negocios, 654 pégina ASP.NET de muestra, 646-647 de simbolos, 681 definicién, 431 DSN (Nombre de Origen de Datos) de ma, 331-333 escritura de, 449-450, cextensiones de -asex, 165 asm, 548-549 aspx, 20 cambio de, 45 isco, 550- regreso de, 450 iteraci6n por, 437-438 lectura de, 444-448 Peek, método, 446 Read, método, 445-447 ReadLine, método, 445 aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [946 Indice BitOr, operador, 436 LirkButton, control, caché, almacenamiento en, 909-910 130, 461-464 BoundColumn, control, ‘ausencia en el, 468 899-900 beneficios en el desem- proveedores de eédigo, 25, Browser, propiedad (cis pefio, 488 32.39 tivos méviles), 810 Cache, clase, 472-473, Boolean, tipo de dato, 59-60 , valor de ccaducidad, 482-483 Border, propiedad configuracién (web.config), comparado con el de bifer, HtmlForm, control, 891 605-608 464 HimlInputimage, control, bucles. Vea también instruc- configuracicn, 464 893 jones cudindo utilizarlos, 486 HtrlTable, control, 895 Do, 74-25 de datos, 464 BorderColor, propiedad, 897 For, 75-16, 98, 353 ‘Add, méiodo, 476-477 DropDownList, control, For..Each, 26 Cache, clase, 471-473 907 infinitos, 2672 CacheltemPriorty, HimITable, control, 895 resultado de, 77 valor, 477-478 ListBox, control, 910 salir de, 77 CacheltemPriorty- BorderStyle, propiedad, 897 While, 73-75 Decay, valor, 477-478 DropDownList, control, bifer, almacenamiento en, ejemplo, 472-473 907 103-107, 464 ExpireCache, méiodo, ListBox, control, 910 BufferResponse, propiedad 474 BorderWidth, propiedad, (WebMethod), 552 HandleRemove, méto- $97 ButtonType, propiedad do, 477-878 DropDownList, control, ButtonColumn, control, Insert, método, 478 907 900 limpieza, 474 ListBox, control, 910 EditCommandColumn, Remove, método, 474 borrado de control, 907 de ensamblajes, 513, 593, archivos, 450 Byte, tipo de dato, 59 617-619 articulos de carrito de com- de salida, 464 ras, 778-779 ausencia en el, 468 directorios, 450 controles de usuario, registros de bases de datos, c 469-471 263 con cadenas de consul- botones EE 10, 467-469 Button, control, 150, 900 Seinietaras de: cectsol, ejemplo, 465-467 ButtonColumn, control, is: fragmentado, 469-471 900 fianciones, 97 OutputCache, directiva, de radio oe 465 HtmlinputRadio, con- Esetacticyocs 101-102 ubicaciones, 465 trol, 893 smétodics, 101. debe, no debe, 487 RadioButton, control, membros oathticos, 102 definicién, 462 150, 910 Propiedades, 100 ‘dependencies del, RadioButtonList, con- Spemtores 2672. 479-481 trol, 150, 911 recursos en Ifnea, 128 ‘encabezados de, HTTP, HimlButton, control, 890 tips de datos, 97 488 ‘HtmlInputButton, control, vasiables . eventos, 137 21 conversion explicita de evita, 483 ImageButton, control, tipos, 99 HuupCachePolicy, clase, ‘0 declaracién, 96-97 48 aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. 950 Indice DLLs (Bibliotecas de ‘Vincutes Dindmicos), 526 ejemplo, 511 implementacién en pé- gina ASPNET, 516 instanciacién, 535 Usuario, objeto, 523-528 ventajas de, 511-512 ‘Compra, método, 759-760 Comprelo, método, 777 Compute, método, 926 coneatenacién de cadenas, 884-885 concurrencia, 330-331 coptimista, 330 pesimista, 330 conexién a bases de datos, BI archivo DSN (Nombre de Origen de Datos) de sis- toma, 331.333 instrucciones SQL, 337-338 ‘OleDbCommand, objeto, 333-335, 930-931 OleDbCommandBuilder, objeto, 931-932 OleDbConnection, objeto, 333, 932-933 OleDbDataAdapter, objero, 338-339, 350, 933-934 OleDbDataReader, objeto, 335-336, 935-936 OleDbError, objeto, 936 OleDbErrorCollection, ob- jet0. 936 OleDbParameter, objeto, 936-937 OleDbParameterCollection, objeto, 937-938 OleDb Transaction, objeto, 938 ConexionBanana, clase, 784 configuracién de ASP.NET, oor jerdirquica, 602 web config, archivo, 2-603 , valor de configuracién, 605-607 , valor de configuracién, 605, <, valor de configuracién, 605, 1607-608 controladores de la sec cién de, 603-604 <, valor de configuracién, 606, 608-609 ejemplo de archivo de. 604-605 estructura de, 603 -, valor de configuracién, 606 <, valor de configara- cién, 606 <, valor de configuracién, 606 , valor de configuracién, 606 , valor de configuracion, 606, 609.610 , valor de con- figuracién, 606, 610-611 personalizada, 612-617 , valor de configuracién, 606 -, valor de configuracién, 606, oll , valor de conti- ‘guracién, 606 , valor de configuracién, 606 ‘Connection, propiedad (OleDbCommand), 930 ‘Connection Timeout, propie- dad (OleDbConnection), 932 Constraint, objeto, 918 ConstraintCollection, objeto, 918-919 ConstraintName, propiedad (Constraint), 918 Constraints, propiedad (DataTable), 926 constructores, 535 consulias. Vea también. instruceiones aplicacion bancaria, 404-495 pardmetros, 394 de salida, 399 definiciéa, 395 direcci6n, 396 ejemplo, 396-398 espevificacidn de, 395.396 imiltiples, 398 PlatanoMovil, aplicacién spAgregaCamtito, 743 spAgregaChasis, 745 spAgregaColor, 745 spAgregaMotor, 745 spAgrogaRucdas, 745 spAgregaSLB, 744 spAgregaTapete, 745 SpA gregaUisvario, 743 spBorrarCarrito, 748 spCompra, 747 spConexionBanana, 749 splnicioUsuario, 743 spObtenerCarrito, 744 spObtenerCategoria, 748 spObtenerSubTotal, 745-746 spVerVehiculo, 746 consumo de los servicios Web XML, 563-567 clase Proxy creaci6n, 569-573 imtegracion, 573-574 descubrimiento, 567-569 recomendaciones, 578-580 servicio de base de datos de ejemplo, 575-578 aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [954 Indice DataSetName, propiedad (DataSet), 324, 924 DataSets, 385-389, 558 Menado de, 278-280 DataSource, propiedad, 284-286, 898 HtmlSelect, control, 894 OleDbConnection, objeto, 932 Repeater, control, 911 DataTable, objeto, 274 DataViews, 329-330 eventos, 927-928 métodos, 926-927 propiedades, 926 Select, métoo, 328-329 DataTableCollection, objeto, 928 DataTextField, propiedad, 898 ButtonColumn, control, 900 HimlSelect, control, 894 HyperLinkColumn, con- trol, 998 DataTextFormatString, pro- piedad, 898 ButtonColumn, control, 900 HyperLinkColumn, con- trol, 908 DataType, propiedad DataColumn, objeto, 919 OleDbParameter, objeto, 937 DataTypeCheck, operador, 212 DataValueField, propiedad ccontroles Web de servidor, 898 HtrmlSelect, control, 894 DataView, objeto, 329-330, 929-930 DataViewManager, prople- dad (DataView), 929 Date, tipo de dato, 59 Date/Time, tipo de dato, 254 dateDiff(), funcién, 89 DateTime, tipo de dato, 60 DateTimeFormat, propiedad (Cutturelnfo), 642 datos, acceso a, 394 ADONET. Vea ADO.NET cconsultes con pardimetros, 394 creaci6n, 395-396 de salida, 399 definicién, 395 direccién, 396 ejemplo, 396-398 miltiples, 398 procedimientos almacena- dos comparados con ins- trucciones SQL, 399-400 creacién en Access XP, 402-403 creacién en SQL Server 2000, 400-402 cuestiones de desempe- fio, 424 definicién, 399 lMamadas desde piginas ASPNNET, 404 pardmetros, 404-408 planes de ejecucién, 399 transacciones definicién, 408 ejemplo, 409-411 registros de, 424 day(), funci6n, 89 DayHeaderStyle, propiedad (Calendar), 901 DayNameFormat, propiedad (Calendar), 901 dayofweek(), funcién, 89 DayRender, evento, 902 DayStyle, propiedad (Calen- dar), 901 DbType, propiedad (OleDb- Parameter), 937 Decimal, tipo de dato, $9 declaracién controles de validacion, 203 explicita de variables, 60 funciones, 97 matrices, 65.67 variables, 60-61,96-97, 883-885 default.aspx, archivo, 163-165 DefaultValue, propiedad (DataColumn), 919 Default View, propiedad DataSet, objeto, 324 DataTable, objeto, 926 Default ViewManager, pro- piedad (DataSet), 924 DELETE, instrucci6n, 263, 337-338, 354 Delete, método, 327, 450, 923, 929 DeleteCommand, evento, 904, 906 DeleteCommand, propiedad (OleDbDataAdapter), 933 DeleteCommandName, cam- po (DataList), 905 dependencias (caché), 479-481 Depth, propiedad (OleDbDa- taReader), 935 depuracién, 657-658 CLR, depurador, 680-684 arranque, 682 asociar, 680-683 puntos de interrupeién, 683 ‘excepciones controlar, 662-669 FormatException, 666 jerarquta de, de sistema, (664-665 Janzamiento, 662, 668-669 MissingMethod, 881-882 propiedades, 667 habilitacién, 681 paginas con errores, (658-661 prueba 2 porciones de c6- igo, 670-671 aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. 958 Indice HtmlInputHidden, control, 893 ‘HtmlInputimage, control, 893 HimlSelect, control, 894 HunlTextArea, control, 896 HupApplication, clase, 596-597 LinkButton, control, 910 Load, 114-117, 881 manejo controladores de even- 10s, 82-84 controles personaliza- dos, 186-188 DataL ist, control, 293-294 formularios Web mévi- es, 799-802 global asax. archivo, 599-601 Repeater, control, 290-291 OleDbConnection, objeto, 932-933, OkDbDataAdapter, objeto, 934 Repeater, control, 911-912, ‘TextBox, control, 914 evitar el almacenamiento en caché, 483 examen de los productos (aplicacion de los platano- miéviles), 770-773 excepciones ‘controlar (Try..Catch, blo- ques) ccusndo utiizarlas, 669 ejemplo, 662-666 Finally instrucei6n, 667 orden de ejecucién, 667 siniaxis, 661 Format xception, 666 Jerarquta de, de sistema, 664-665 Ianzamiento, 662, 668-669 MissingMethodException, 881-382 propiedades. 667 Exception, clase, 664-665 Execute, método, 126 ExecuteNonQuery, método, 337, 931 ExecuteReader, método, 931 ExecuteScalar, método, 498, 931 ExisteCarrito, método, 758 Exit, instrucei6n, 77 exp(), funcién, 90 ExpireCache, método, 474 exploradores de archivos DirectoryExists, méto- do, 441 HyperLink, control, 440 interfaz de usuaric 440-441 listado de eédigo, 438-439 ListarArchivos, método, 440 Page_Load, evento, 442 URLEncode, método, 41 soporte de bajo nivel, 136 expresiones de enlace de datos, 266 evaluacion de, 280-281 regulares, 218-220 Expression, propiedad (Da- taColumn), 919 ExtendedProperties, objeto, 275 ExtendedProperties, propie- dad DataColumn, objeto, 920 DataRelation, objeto, 921 DataSet, objeto, 324, 924 DataTable, objeto, 926 cextensiones .asmx, 548-549 aspx, 20 isco, 550-551 ascx, 165 cambio de, 450 regreso de, 450 ExtractTemplateRows, pro- piedad (DataL ist), 905 F facturas.aspx, archivo, 241-242, 501-504 Fast, valor (CacheltemPrio- rityDecay), 478 fechas DateTime, tipo de dato, 60 funciones de fecha y hora, 9 FieldCount, propiedad (OleDbDataReader), 935 filas, 248, actualizacién, 263, borrado de, 263 DataRow, objeto ‘AcceptChanges, méto- do, 326 BeginEdit, método, 326 Delete, método, 327 EndEdit, método, 326 Fill, método, 327, 340, 933 GelBrrors, método, 327 RejectChanges, méto- do, 327-328 Remove, método, 327 307 RowState, propiedad, 326 HimITableRow, control, 394-896 insereién de, 262 recuperacién de, 279 TebleRow, control, 913 File, objeto, 433, 442-443, 451 File.ChangeExtension, méto- do, 450 File.Create, método, 450 File.CreateText, método, 450 File.HasExtension, método, 450 FileAccess, objeto, 451 FileAttributes, objeto, 451 FileExists, método, 435 FileInfo, objeto, 433-437, 451 aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. [962___Indice personificacién, 713 rastreo, 677-678 HandleRemove, método, 477-478 HasChanges, método, 325, 925 HasControls, método, 888 HasErrors, propiedad DataRow, objeto, 922 DataSet, objeto, 324, 924 DataTable, objeto, 926. HasVersion, método, 923 HeaderStyle, propiedad DataGrid, control, 903, DataList, control, 906 Header Template, plantilla, 287 HeaderTemplate, propiedad DataList, control, 906 Repeater, control, 911 ‘TemplateColuma, control, 913 ‘HeaderText, propiedad (Va- lidationSummary), 916 Height, propiedad, 897 HunlFarm, contol, 891 HtmITable, control, 895 HelpLink, propiedad (excep- ciones), 667 herencia, 87-89, 631 herramienta(s) disco.exe, 567-569 -generadora de recursos, 648 Importador de bibliotecas de tipos, 532-533 resgen.exe, 648 tlbimp.exe, 532-533 utilidad de caché global, 618 wwadlexe, 569-572 hex), funcién, 90 High, valor (Cacheltem- Priority), 478 hipervinculos HyperLink, control, 150, 907-908 HyperLinkColumn, con- ‘tol, 908. hojas de estilo procesador XsIT, 418-420 StyleSheet, control, 796 XSL (Lenguaje de Hojas de Estilo Extensible) hoja de estilo de mues- tra, 418-419 sitios Web, 422 Hola, aplicacién bloque de declaracién de cédi- 20, 36 proveedor de cédigo, 37.39 directivas de pagina, 29 estado visual, 40,42 formulario Web, 33-36 listado de c6digo, 32-33, 253 listado0201 aspx, fuente, 34.35 HorizontalAlign, propiedad, 898 Panel, control, 910 Table, control, 912 TableCell, control, 912 TableRow, control, 913 hour(, funcién, 89 Href, propiedad (HemiAn- chor), 890 HTML (Lenguaje de Mar- cado de Hipertexto) comentarios, 42, 44 comtroles de servidor, 135-136, 144,889 atributos, 145-147 comparados con los Web, 1562157 creacién, 145 Himlanchor, 148, 890 HimiButon, 148, 890 HumlFor, 148, 890-891 HtmiGenericControl, 148 Humilmage, 148.891 HemlinputButton, 148, 891 HtmlInpatCheckBox, ‘148, 891-892, HtmiInputControl, 892. HumllnputFile, LAS, 892 HtmlInputHidden, 148, 892 HtmlInputimage, 149, 893 HimllnputRedio, 893 HtmlInpatRadioButton, 149 HtmlinputText, 149, 893-894 HimlSelect, 149,894 HunlTable, 149, 894-896 HtmlTableCell, 149, 894-896 HimiTableRow, 149, 894-896 HtmITextArea, 149, 896 propiedades, 889 etiquetas , 37-20 atajos, 35 , 693

You might also like