Sunteți pe pagina 1din 30

USACWD6P1: Practicals of USACWD601

Roll No.:1058

Contents
1. Fundamentals of ASP.NET such as using HTML/Web Controls, Autopostback, Application events,
configuration files................................................................................................................. 2
a. Web Controls [22nd November, 2016]................................................................................... 2
b. Configuration files and application events [22nd November, 2016]...............................................3
c. Use of Autopostback [22nd November, 2016].........................................................................7
2. State management, Validation & Rich controls.........................................................................10
a. Master Page and AdRotator control [29th November, 2016]......................................................10
b. State Management: Session [5th December, 2016]..................................................................14
c. Validations [5th December, 2016]....................................................................................... 16
3. ADO.NET in ASP.NET with Data Binding, Interacting with XML documents..................................20
a. Database connectivity using SqlDataReader [5th December, 2016]..............................................20
b. Use of GridView [26th December, 2016]............................................................................. 21
c. Interacting with XML documents [26th December, 2016]..........................................................24
a. Creating and consuming web services [26th December, 2016]....................................................26
b. Use of AJAX controls [2nd January, 2017]..........................................................................27
c. Data caching [7th January, 2017]........................................................................................ 28

Page 1 of 30

USACWD6P1: Practicals of USACWD601

Roll No.:1058

1. Fundamentals of ASP.NET such as using HTML/Web Controls, Autopostback, Application


events, configuration files
a. Web Controls [22nd November, 2016]
A software company wants to conduct placements for graduates in Mumbai or Pune. Design a web
form to input student details such as name using textbox, course name such as BSc Comp
Sci/IT/Phy/Maths using radio button, Marks in SSC,HSC, FY & SY along with Year of Passing using
text boxes & Location such as Mumbai/Pune using DropDownList. The student is shortlisted only if
he/she has min 60% in SSC & HSC, FY & SY average should be min 55% & there should not be any
gap in education. When student clicks on Register button, the data is submitted to ASP.NET page
which informs the student whether he/she qualifies and place of interview in Mumbai or Pune as
given by the student.
Source Code:
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnRegister_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnRegister.Click
Dim fysyaverage = ((CInt(txtFYMarks.Text) + CInt(txtSYMarks.Text)) / 2)
If txtHSCPass.Text - txtSSCPass.Text <> 2 Or txtFYPass.Text - txtHSCPass.Text <> 1 Or
txtSYpass.Text - txtFYPass.Text <> 1 Then
lblM.Text = "You are not Qualified"
ElseIf txtSSCMarks.Text < 60 Or txtHSCMarks.Text < 60 Then
lblM.Text = "You are not Qualified"
ElseIf fysyaverage < 55 Then
lblM.Text = "You are not Qualified"
Else
lblM.Text = "Congratulations. You are qualified for interview.<BR> place of interview is" &
ddlLocation.Text
End If
End Sub
End Class
Output:

Page 2 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
nd
b. Configuration files and application events [22 November, 2016]
A bank wants to keep an enquiry page for inquiring about home loan. The rates of these loans are
stored in configuration file and the rates are different for various span of years (5/10/15). The user
types the loan amount and selects the number of years for repayment of loan (5/10/15) from
DropDownList. In return, the user gets information of the rate of loan, monthly installment for the
specified number of years and total number of enquiries since the server started.
Source Code:
web.config
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions"
type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting"
type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler"
type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices"
type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization"
type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService"
type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService"
type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService"
type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings>
<add key="5" value="5.6"/>
<add key="10" value="6.5"/>
<add key="15" value="10"/>
</appSettings>
<connectionStrings/>
Page 3 of 30

USACWD6P1: Practicals of USACWD601


<system.web>
<!-Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Roll No.:1058

Visual Basic options:


Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Generic"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Linq"/>
<add namespace="System.Xml.Linq"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>

Page 4 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
<add tagPrefix="asp" namespace="System.Web.UI.WebControls"
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<!-The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!-The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
Page 5 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
<!-The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx"
preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*"
path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode"
verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions"
publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0"
newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design"
publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0"
newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Global.asax
Imports System.Web.SessionState
Page 6 of 30

USACWD6P1: Practicals of USACWD601


Public Class Global_asax
Inherits System.Web.HttpApplication
Dim cnt As Integer = 0
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
cnt = cnt + 1
Response.Write("<H1>Visitor number:" & cnt & "</H1>")
End Sub

Roll No.:1058

Default.aspx.vb
Imports System.Web.Configuration
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnOk_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnOk.Click
Dim amt As Integer
Dim yrs As String
Dim rate As Double
Dim installment As Double
amt = CInt(txtAmt.Text)
yrs = ddlYear.SelectedItem.Text
rate = CDbl(WebConfigurationManager.AppSettings(yrs))
installment = Math.Round((amt / (yrs * 12)) * rate)
lblmsg.Text = "Interest rate=" & rate & "<br> Monthly Installment=Rs." & installment
End Sub
End Class
Output:

c. Use of Autopostback [22nd November, 2016]


Design ticket enquiry form for a theater. Select location (Mumbai/Pune) using radio button. When
user clicks a location, it fills a DropDownList with names of theaters in that city. When user selects
the name of the theatre, the list of films currently shown and their show timings should be displayed
in table [Use Autopostback].
Source Code:
Partial Public Class _Default
Page 7 of 30

USACWD6P1: Practicals of USACWD601


Inherits System.Web.UI.Page

Roll No.:1058

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
If Me.IsPostBack = False Then
Table1.BorderWidth = Unit.Pixel(1)
Table1.BorderStyle = BorderStyle.Inset
ddlName.Items.Add("Select A theater")
End If
End Sub
Protected Sub rdoMumbai_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
Handles rdoMumbai.CheckedChanged
ddlName.Items.Clear()
ddlName.Items.Add("select A theater")
ddlName.Items.Add("CityGem")
ddlName.Items.Add("CityStar")
End Sub
Protected Sub rdoPune_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
Handles rdoPune.CheckedChanged
ddlName.Items.Clear()
ddlName.Items.Add("select A theater")
ddlName.Items.Add("CityGold")
End Sub
Public Function getcell(ByVal text As String) As TableCell
Dim cell As New TableCell
cell.Text = text
cell.BorderWidth = Unit.Pixel(1)
cell.BorderStyle = BorderStyle.Inset
Return cell
End Function
Protected Sub ddlName_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Handles ddlName.SelectedIndexChanged
Table1.Controls.Clear()
If ddlName.Text = "CityGem" Then
Dim row1, row2 As New TableRow()
Table1.Controls.Add(row1)
row1.Controls.Add(getcell("show timing"))
row1.Controls.Add(getcell("12pm"))
row1.Controls.Add(getcell("3pm"))
row1.Controls.Add(getcell("6pm"))
row1.Controls.Add(getcell("9pm"))
Table1.Controls.Add(row2)
row2.Controls.Add(getcell("Movie name"))
row2.Controls.Add(getcell("Ice Age"))
row2.Controls.Add(getcell("finding Dory"))
row2.Controls.Add(getcell("kites"))
row2.Controls.Add(getcell("kites"))
Page 8 of 30

USACWD6P1: Practicals of USACWD601


ElseIf ddlName.Text = "CityStar" Then
Dim row1, row2 As New TableRow()
Table1.Controls.Add(row1)
row1.Controls.Add(getcell("show timing"))
row1.Controls.Add(getcell("12pm"))
row1.Controls.Add(getcell("3pm"))
row1.Controls.Add(getcell("6pm"))
row1.Controls.Add(getcell("9pm"))
Table1.Controls.Add(row2)
row2.Controls.Add(getcell("Movie name"))
row2.Controls.Add(getcell("Raanbhool"))
row2.Controls.Add(getcell("Anandi anand"))
row2.Controls.Add(getcell("vihir"))
row2.Controls.Add(getcell("kites"))
Else
Dim row1, row2, row3 As New TableRow()
Table1.Controls.Add(row1)
row1.Controls.Add(getcell("show timing"))
row1.Controls.Add(getcell("12pm"))
row1.Controls.Add(getcell("3pm"))
row1.Controls.Add(getcell("6pm"))
row1.Controls.Add(getcell("9pm"))
Table1.Controls.Add(row2)
row2.Controls.Add(getcell("Screen"))
row2.Controls.Add(getcell("Avatar"))
row2.Controls.Add(getcell("Shrakh"))
row2.Controls.Add(getcell("vihir"))
row2.Controls.Add(getcell("kites"))
Table1.Controls.Add(row3)
row3.Controls.Add(getcell("Screen2"))
row3.Controls.Add(getcell("Kites"))
row3.Controls.Add(getcell("Kites"))
row3.Controls.Add(getcell("kites"))
row3.Controls.Add(getcell("kites"))
End If
End Sub
End Class
Output:

Page 9 of 30

Roll No.:1058

USACWD6P1: Practicals of USACWD601

Roll No.:1058

2. State management, Validation & Rich controls


a. Master Page and AdRotator control [29th November, 2016]
Create a Master Page for the Website Coffee Shop. Also add a content page to display details of
different types of coffees. Create a CSS file for formatting. Show advertisements of any 3 popular
products.
Source Code:
Stylesheet:
body
{
font-family:Arial,Sans-Serif;
background-color:#e9e9e9;
}
#wrapper
{
width:1080px;
background-color:White;
margin:0 auto;
padding:10px;
border:5px solid #dedede;
}
#banner
{
background-image:url('../Images/banner.jpg');
background-repeat:no-repeat;
height:200px;
border:3px solid #e3e3e3;
}
#content_area
{
float:left;
width:750px;
margin:20px 0 20px 0;
padding:10px;
}
#sliderbar
{
float:right;
width:250px;
height:400px;
margin:20px 10px 20px 10px;
padding:10px;
border:2px solid #e3e3e3;
}
#footer
{
clear:both;
width:auto;
height:40px;
padding:10px;
Page 10 of 30

USACWD6P1: Practicals of USACWD601


border:3px solid #e3e3e3;
text-align:center;
color:#fff;
background-image:url('../Images/bar_bacground.png');
}
.imgLeft
{
float:left;
width:240px;
height:150px;
margin:0px 10px 10px 0;
padding:10px;
}
.imgRigth
{
float:right;
width:200px;
height:250px;
margin:0px 0 10px 10px;
padding:10px;
}
XMLFILE.XML
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~/App_Themes/Images/1.png</ImageUrl>
<NavigateUrl></NavigateUrl>
<AlternateText>Contact</AlternateText>
<Impressions>20</Impressions>
</Ad>
<Ad>
<ImageUrl>~/App_Themes/Images/2.jpg</ImageUrl>
<NavigateUrl></NavigateUrl>
<AlternateText>Contact</AlternateText>
<Impressions>20</Impressions>
</Ad>
<Ad>
<ImageUrl>~/App_Themes/Images/3.jpg</ImageUrl>
<NavigateUrl></NavigateUrl>
<AlternateText>Contact</AlternateText>
<Impressions>20</Impressions>
</Ad>
<Ad>
<ImageUrl>~/App_Themes/Images/4.jpg</ImageUrl>
<NavigateUrl></NavigateUrl>
<AlternateText>Contact</AlternateText>
<Impressions>20</Impressions>
</Ad>
<Ad>
<ImageUrl>~/App_Themes/Images/5.png</ImageUrl>
<NavigateUrl></NavigateUrl>
Page 11 of 30

Roll No.:1058

USACWD6P1: Practicals of USACWD601


<AlternateText>Contact</AlternateText>
<Impressions>20</Impressions>
</Ad>
</Advertisements>

Roll No.:1058

Slide1.master(aspxcode)
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site1.master.vb"
Inherits="Pract2Q1.Site1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="wrapper">
<div id="banner">
<img alt="banner" src="App_Themes/Images/banner.jpg"
style="width: 806px; height: 155px" /></div>
<div id="navigation">
<asp:LinkButton ID="lbtnHot" runat="server" PostBackUrl="~/WebForm1.aspx">Hot
Coffee</asp:LinkButton>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:LinkButton ID="lbtnCold" runat="server" PostBackUrl="~/WebForm2.aspx">Cold
Coffee</asp:LinkButton>
</div>
<div id="content_area">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="sidebar">
<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/App_Data/XMLFile1.xml" Height="100px" Width="500px" />
</div>
<div id="footer">
<p>All Rights reserved</p>
</div>
</div>
</form>
</body>
</html>
WebForm1.aspx
Page 12 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master"
CodeBehind="WebForm1.aspx.vb" Inherits="Pract2Q1.WebForm1"
title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.style1
{
color: #FF9999;
}
.style2
{
color: #FFCC99;
}
.style3
{
color: #3333CC;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p class="style3" style="background-color: #00FFFF">
Hot Coffee</p>
<p class="style1">
CAPPUCCINO</p>
<p class="style2">
A belly of Italian espresso smoothened with steamed and foamed milk.</p>
<p>
<img alt="ccd-tropical-iceberg"
src="App_Themes/Images/ccd-tropical-iceberg.jpg"
style="width: 140px; height: 123px" /></p>
<p>
&nbsp;</p>
<p>
CAFE AMERICANO</p>
<p>
A double shot of espresso with hot water, served with milk on the
side..&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<img alt="green-apple-tea-ni" src="App_Themes/Images/green-apple-tea-ni.png"
style="width: 207px; height: 182px" />
</p>
</asp:Content>
WebForm2.aspx
<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master"
CodeBehind="WebForm2.aspx.vb" Inherits="Pract2Q1.WebForm2"
title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
Page 13 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
.style2
{
color: #3399FF;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p class="style2" style="background-color: #FF00FF">
Cold Coffee&nbsp;</p>
</asp:Content>
Output:

b. State Management: Session [5th December, 2016]


A news channel wants to conduct a survey of some famous personalities of the year. The user
initially inputs his/her name, birth date, age and email. First page allows user to select Best
Sportsperson, 2nd page asks Best Writer and the third Best Minister. At the end, it shows a thank
you message with users name and shows all the choices made by him/her.
Source Code:
Page 14 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
Defulat.aspx
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnDNext.Click
Session.Add("Name", txtName.Text)
Response.Redirect("Sports.aspx")
End Sub
End Class
Sports.aspx
Public Partial Class Sports
Inherits System.Web.UI.Page
Protected Sub btnSNext_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnSNext.Click
Session.Add("Sports", ddlsport.Text)
Response.Redirect("Writer.aspx")
End Sub
End Class
Writer.aspx
Public Partial Class Writer
Inherits System.Web.UI.Page
Protected Sub btnWNext_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnWNext.Click
Session.Add("Writer", ddlWriter.Text)
Response.Redirect("BestMinister.aspx")
End Sub
Minister.aspx
Public Partial Class BestMinister
Inherits System.Web.UI.Page
Protected Sub btnfinish_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnfinish.Click
Session.Add("Minister", ddlMinister.Text)
Response.Redirect("Result.aspx")
End Sub
End Class
Result.aspx
Public Partial Class Result
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
Response.Write("<H1>Thank you for voting.</H1>Your selection is as follows:<br>")
Response.Write("<B>Name:</B>" & HttpContext.Current.Session("Name") & "<br>")
Response.Write("<B>Best Sportsman:</B>" & HttpContext.Current.Session("sports") &
"<br>")
Response.Write("<B>Best Writer:</B>" & HttpContext.Current.Session("Writer") & "<br>")
Response.Write("<B>Best Minister:</B>" & HttpContext.Current.Session("Minister") &
"<br>")
End Sub
Page 15 of 30

USACWD6P1: Practicals of USACWD601


End Class

Roll No.:1058

Output:

c. Validations [5th December, 2016]


College wants to do election for Best Student award 2016-17. Design a web form which allows
selecting candidate name from DropDownList. Voter has to insert his/her name, password, confirm
password, age and email. Use following validation in application:
a) Name should not be blank.
b) Password and Confirm password should be same.
c) Age should between 18 to 21.
d) Email should be in proper format.
Source Code:
Default:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb"
Inherits="Pract2Q3._Default" %>
Page 16 of 30

USACWD6P1: Practicals of USACWD601


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Roll No.:1058

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
color: #FF6600;
font-size: x-large;
background-color: #FFFFFF;
}
.style3
{
font-size: xx-large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<p style="font-family: 'times New Roman', Times, serif; font-size: medium">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="style2">Best Student Award 2016-2017</span></p>
<p class="style3">
Vote For Your Favourite Candidate:</p>
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
ShowMessageBox="True" />
<p>
</p>
<table class="style1">
<tr>
<td>
Candidate Name:</td>
<td>
<asp:DropDownList ID="ddlCName" runat="server" Width="79px">
<asp:ListItem>Mama</asp:ListItem>
<asp:ListItem>Ishu</asp:ListItem>
<asp:ListItem>Sagar</asp:ListItem>
</asp:DropDownList>
</td>
<td>
&nbsp;</td>
</tr>
Page 17 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
<tr>
<td>
Voter Name:</td>
<td>
<asp:TextBox ID="txtVname" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtVname" ErrorMessage="Enter Voter
name">(*)</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Password:</td>
<td>
<asp:TextBox ID="txtPass" runat="server" TextMode="Password"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
Confirm Password:</td>
<td>
<asp:TextBox ID="txtCpass" runat="server" TextMode="Password"></asp:TextBox>
</td>
<td>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ErrorMessage="Password Does Not Match" ControlToCompare="txtPass"
ControlToValidate="txtCpass">(*)</asp:CompareValidator>
</td>
</tr>
<tr>
<td>
Age:</td>
<td>
<asp:TextBox ID="txtAge" runat="server"></asp:TextBox>
(Between 18 to 21 Years</td>
<td>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="Age Should Between 18 to 21" ControlToValidate="txtAge"
MaximumValue="21" MinimumValue="18" Type="Integer">(*)</asp:RangeValidator>
</td>
</tr>
<tr>
<td>
Email:</td>
<td>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
(E.g abc@gmail.com)</td>
<td>
Page 18 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ErrorMessage="Invalid Email Id" ControlToValidate="txtEmail"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+
([-.]\w+)*">(*)</asp:RegularExpressionValidator>
</td>
</tr>
</table>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="btnVote" runat="server" Text="Vote" />
</p>
<asp:Label ID="lblmsg" runat="server"></asp:Label>
</form>
</body>
</html>
Output:

Page 19 of 30

USACWD6P1: Practicals of USACWD601

Roll No.:1058

3. ADO.NET in ASP.NET with Data Binding, Interacting with XML documents


a. Database connectivity using SqlDataReader [5th December, 2016]
Assuming that there are 2 tables Customer(AccNo, AccName, Password, CurrBal) &
Transactions(TransId, AccNo, Date, Amt, TransType, Client) where TransType can be Debit or
Credit. User should input AccNo and password. For successful login, it should show welcome
message with the users name, current balance and transactions in table.
Source Code:
Default.aspx
Imports System.Data.SqlClient
Partial Public Class _Default
Inherits System.Web.UI.Page
Dim str As String = "Data Source=.\SQLEXPRESS; Initial Catalog=TYCS_1058;Integrated
Security=TRUE"
Dim cn As New SqlConnection(Str)
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnLogin.Click
Try
cn.Open()
Dim cmd As New SqlCommand
cmd.Connection = cn
cmd.CommandText = "Select * from CUSTOMER where ACCNO=" &
CInt(txtaccount.Text) & " And password='" & txtpass.Text & "'"
Dim reader As SqlDataReader
reader = cmd.ExecuteReader
If reader.Read = True Then
cn.Close()
Session.Add("ACCOUNTNO", txtaccount.Text)
Response.Redirect("page2.aspx")
Else
Response.Write("Invalid UserName or Password")
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
End Class
Page2.aspx
Imports System.Data.SqlClient
Partial Public Class page2
Inherits System.Web.UI.Page
Dim str As String = "Data Source=.\SQLEXPRESS; Initial Catalog=TYCS_1058;Integrated
Security=TRUE"
Dim cn As New SqlConnection(str)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
Dim accno As Integer = HttpContext.Current.Session("ACCOUNTNO")
Page 20 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
Response.Write("Welcome " & accno)
Try
cn.Open()
Dim cmd As New SqlCommand
cmd.Connection = cn
cmd.CommandText = "select * from TRANSACTIONS where ACCNO=" & accno
GridView1.DataSource = cmd.ExecuteReader
GridView1.DataBind()
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
End Class
Output:

b. Use of GridView [26th December, 2016]


Develop a web page for a real estate firm. The user after visiting the site, selects the name of city
from combo-box. In return, the user gets information about all the flats from that city such as No. of
Rooms, Expected Price in a grid. At a time, information of only 5 flats should be visible.
Page 21 of 30

USACWD6P1: Practicals of USACWD601


Source Code:

Roll No.:1058

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb"


Inherits="Pract3Q2._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
#form1
{
height: 156px;
width: 660px;
}
.style1
{
color: #3333CC;
}
.style2
{
color: #3366FF;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="width: 667px; height: 164px">
<img alt="banner" src="App_Themes/Images/banner.jpg"
style="width: 179px; height: 145px" /><img alt="banner2"
src="App_Themes/Images/banner2.jpg" style="width: 176px; height: 145px" /><img
alt="banner3" src="App_Themes/Images/banner3.jpg"
style="width: 291px; height: 145px" /></p>
</div>
<p class="style2">
Homes for Sale Finding a home for sale has never been easier. With Homes.com,
you can search new homes, foreclosures, multi-family homes, as well as condos
and townhouses for sale. You can even search our real estate agent directory to
work with a professional Realtor and find your perfect home. </p>
<p class="style1">
&nbsp;DISCOVER YOUR PERFECT HOME
</p>
<p>
TThe most accurate and complete home &amp; apartment search on the Web
</p>
<p>
Select City:
<asp:DropDownList ID="ddlcity" runat="server" DataSourceID="SqlDataSource1City"
DataTextField="City" DataValueField="City" AutoPostBack="True">
</asp:DropDownList>
Page 22 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
<asp:SqlDataSource ID="SqlDataSource1City" runat="server"
ConnectionString="<%$ ConnectionStrings:TYCS_1058ConnectionString %>"
SelectCommand="SELECT Distinct City from FLAT"></asp:SqlDataSource>
</p>
<p>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px"
CellPadding="4" DataSourceID="SqlDataSource2CityVoice" GridLines="Horizontal">
<FooterStyle BackColor="White" ForeColor="#333333" />
<RowStyle BackColor="White" ForeColor="#333333" />
<Columns>
<asp:BoundField DataField="PropertyID" HeaderText="PropertyID"
SortExpression="PropertyID" />
<asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
<asp:BoundField DataField="Sub type" HeaderText="Sub type"
SortExpression="Sub type" />
<asp:BoundField DataField="Area" HeaderText="Area" SortExpression="Area" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="Floor" HeaderText="Floor" SortExpression="Floor" />
<asp:BoundField DataField="PropertyAge" HeaderText="PropertyAge"
SortExpression="PropertyAge" />
<asp:BoundField DataField="CarParking" HeaderText="CarParking"
SortExpression="CarParking" />
<asp:ImageField DataImageUrlField="Image" HeaderText="Image">
</asp:ImageField>
</Columns>
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2CityVoice" runat="server"
ConnectionString="<%$ ConnectionStrings:TYCS_1058ConnectionString %>"
SelectCommand="SELECT * FROM [FLAT] WHERE ([City] = @City)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlcity" Name="City"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>
</p>
</form>
</body>
</html>
Output:

Page 23 of 30

USACWD6P1: Practicals of USACWD601

Roll No.:1058

c. Interacting with XML documents [26th December, 2016]


A Cable TV provider stores the list of channels in an XML File. For each Channel, there is an
attribute Name. The Channel element consists of sub-elements such as Language(such as Hindi,
English, Marathi etc), Category(Sports, Movies, Cartoon etc). Design an ASP.NET page that displays
the list of languages and categories in 2 combo boxes. When user clicks on a button, all the channels
matching the selected criteria should be displayed.
Source Code:
Xml.
<?xml version="1.0" encoding="utf-8" ?>
<CableTV>
<Channel Name="DD News">
<Language>Hindi</Language>
<Category>News</Category>
</Channel>
<Channel Name="Star TV">
<Language>Hindi</Language>
<Category>Drama</Category>
</Channel>
<Channel Name="HBO">
<Language>English</Language>
<Category>Films</Category>
</Channel>
<Channel Name="Colors">
<Language>Hindi</Language>
<Category>Films</Category>
</Channel>
<Channel Name="SetMax">
<Language>Hindi</Language>
Page 24 of 30

USACWD6P1: Practicals of USACWD601


<Category>Films</Category>
</Channel>
<Channel Name="UTV Movies">
<Language>Hindi</Language>
<Category>Films</Category>
</Channel>
<Channel Name="CNBC">
<Language>English</Language>
<Category>News</Category>
</Channel>
</CableTV>

Roll No.:1058

Default.aspx
Imports System.Xml
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnSearch.Click
Dim cnt As Integer = 0
Dim doc As New XmlDocument
lblMsg.Text = ""
doc.Load("D:\tycs\b1\1058\asp.net\Pract3Q3\Pract3Q3\App_Data\ChannelDetails.xml")
For Each Element As XmlElement In doc.DocumentElement.ChildNodes
Dim channel As String
channel = Element.GetAttribute("Name")
If Element.ChildNodes(0).InnerText = lstlanguage.SelectedItem.Text And
Element.ChildNodes(1).InnerText = lstcategory.SelectedItem.Text Then
lblMsg.Text &= channel & ","
cnt = cnt + 1
End If
Next
If cnt = 0 Then
lblMsg.Text = "Channel is not available."
End If
doc = Nothing
End Sub
End Class
Output:

Page 25 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
4. Performance improvement using Caching, Creating and consuming web services
a. Creating and consuming web services [26th December, 2016]
Create a web service that accepts 2 parameters and gives addition of 2 integer numbers. Also create a
web page to test the web service.
Source Code:
Service.asmx.vb
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the
following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
<WebMethod()> _
Public Function Addition(ByVal a As Integer, ByVal b As Integer) As Integer
Dim c As Integer
c=a+b
Return c
End Function
<WebMethod()> _
Public Function StockExchangeData() As String
Dim nse, bse, goldrate As Double
nse = 120.33
bse = 345.23
goldrate = 30000
Return "NSE Index=" & nse & "<br> Bse Index=" & bse & "<br> GoldRate Index=" &
goldrate
End Function
End Class
Default.aspx.vb
Imports pract4Q1.localhost
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnAddition_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnAddition.Click
Dim ws As New Service1
Dim f, s, a As Integer
f = CInt(txtFirst.Text)
Page 26 of 30

USACWD6P1: Practicals of USACWD601


s = CInt(txtsecond.Text)
a = ws.Addition(f, s)
lblResult.Text = "Addition is:" & a
End Sub
End Class

Roll No.:1058

Output:

b. Use of AJAX controls [2nd January, 2017]


A channel displays online news. Latest news should be shown as scrolling marquee. It also shows
score of current days cricket match which gets updated after every 60 seconds.
Source Code:
Imports System.Data.SqlClient
Partial Public Class _Default
Inherits System.Web.UI.Page
Dim str As String = "Data Source=.\SQLEXPRESS;Initial Catalog=TYCS_1058;Integrated
Security=True"
Dim cn As New SqlConnection(Str)
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
Try
cn.Open()
Dim cmd As New SqlCommand
cmd.CommandText = "Select * from Cricket where ID=(select max(ID) from Cricket)"
Page 27 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
cmd.Connection = cn
Dim reader As SqlDataReader
reader = cmd.ExecuteReader
If reader.Read Then
lblmsg.Text = "Overs" & reader.Item("Overs") & "(" & reader.Item("Score") & "/" &
reader.Item("Wickets") & ")"
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
End Class
Output:

c. Data caching [7th January, 2017]


Develop a ASP.NET application which allows user to select favorite food item from DropDownList.
When user clicks on Display Details button, the food details will be displayed on another page.
Save the details in cache memory for next 10 seconds. Within 10 seconds if the user is requesting the
same details of same food item, the the details will be displayed from cache memory.
Source Code:
Default.aspx
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnDisplay_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnDisplay.Click
Session("FoodItem") = ddlFoodItem.SelectedItem.Text
Response.Redirect("Details.aspx")
End Sub
End Class
Details.aspx
Page 28 of 30

USACWD6P1: Practicals of USACWD601


Roll No.:1058
Partial Public Class Details
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
Dim fi As String
fi = CType(Session("FoodItem"), String)
If fi = "Irish Coffee" Then
If Cache("Irish Coffee") Is Nothing Then
lbldetails.Text = "Irish Coffee"
Image1.ImageUrl = "~\App_Themes\Images\ccd-irish-coffee.jpg"
Cache.Insert("Irish Coffee", lbldetails.Text, Nothing, DateTime.Now.AddSeconds(10),
TimeSpan.Zero)
Cache.Insert("IrishImage", Image1.ImageUrl, Nothing, DateTime.Now.AddSeconds(10),
TimeSpan.Zero)
Else
Response.Write("<B><H1>Reading from cache......</H1></B>")
lbldetails.Text = CType(Cache("Irish Coffee"), String)
Image1.ImageUrl = CType(Cache("IrishImage"), String)
End If
ElseIf fi = "Tropical Iceberg" Then
If Cache("Tropical Iceberg") Is Nothing Then
lbldetails.Text = "Tropical Iceberg"
Image1.ImageUrl = "~\App_Themes\Images\ccd-tropical-iceberg.jpg"
Cache.Insert("Tropical Iceberg", lbldetails.Text, Nothing, DateTime.Now.AddSeconds(10),
TimeSpan.Zero)
Cache.Insert("TropicalIcebergImage", Image1.ImageUrl, Nothing,
DateTime.Now.AddSeconds(10), TimeSpan.Zero)
Else
Response.Write("<B><H1>Reading from cache......</H1></B>")
lbldetails.Text = CType(Cache("Tropical Iceberg"), String)
Image1.ImageUrl = CType(Cache("TropicalIcebergImage"), String)
End If
End If
End Sub
End Class
Output:

Page 29 of 30

USACWD6P1: Practicals of USACWD601

Page 30 of 30

Roll No.:1058

S-ar putea să vă placă și