0% found this document useful (0 votes)
50 views18 pages

ASP.NET Web Application Assignments

Uploaded by

K. S Saiyed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views18 pages

ASP.NET Web Application Assignments

Uploaded by

K. S Saiyed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Assignment 3:-

/*-------------------------------------------------
Name:-Saiyed Ahmad Kamruddin
Roll_No:-27 Class:-TYBCA
Sem:-5
Sub:-ASP.NET

Q.1)Create Web Service to Find Simple interest.


-------------------------------------------------*/
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated(
)> _
Public Class WebService
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function sint(ByVal p As Double, ByVal r As Double,
ByVal n As Double)
Dim s1 As Double
s1 = (p * r * n) / 100
Return s1
End Function

End Class
/*-------------------------------------------------
Name:-Saiyed Ahmad Kamruddin
Roll_No:-27
Class:-TYBCA
Sem:-5
Sub:-ASP.NET

Q.2)Create User Control That Consist User Name &


Password Functonality.
-------------------------------------------------*/
Imports System.Data.OleDb

Partial Class WebUserControl


Inherits System.Web.UI.UserControl
Protected Sub Button1_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim str As String
str = "select * from LOGIN"
Dim con As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\
MY\tybca33\asp.net\login\db1.mdb")
con.Open()

Dim cmd As New OleDbCommand(str, con)


Dim dr As OleDbDataReader
dr = cmd.ExecuteReader

Dim F As Integer
F = 0
While dr.Read
If TextBox1.Text = dr.GetString(0) And TextBox2.Text
= dr.GetString(1) Then
F = 1
Exit While
Else
F = 0
End If
End While
If F = 1 Then

Response.Write("valid user")
Response.Redirect("default2.aspx")
Else
Response.Write("Invalid user")
End If
End Sub
End Class
/*-------------------------------------------------
Name:-Saiyed Ahmad Kamruddin
Roll_No:-27
Class:-TYBCA
Sem:-5
Sub:-ASP.NET

Q.3)Create Web Appliction to Make Use of Session &


Query String.
-------------------------------------------------*/

Partial Class Default2


Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e


As System.EventArgs) Handles Button1.Click
Response.Redirect("default3.aspx?Name=" + TextBox1.Text +
"&E-mail=" + TextBox2.Text + "&Phone=" + TextBox3.Text + "")
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load
Session("Name") = "Minesh"
Session("E-mail") = "[email protected]"
Session("Phone") = "9867458632"

End Sub
End Class

Partial Class Default3


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load
Dim s1 As String = Request.QueryString("Name").ToString()
Dim s2 As String = Request.QueryString("E-
mail").ToString()
Dim s3 As String =
Request.QueryString("Phone").ToString()

Response.Write(Session("Name").ToString() & "<br>")


Response.Write(Session("E-mail").ToString() & "<br>")
Response.Write(Session("Phone").ToString())

End Sub
End Class
/*-------------------------------------------------
Name:-Saiyed Ahmad Kamruddin
Roll_No:-27
Class:-TYBCA
Sem:-5
Sub:-ASP.NET

Q.4)Create Web Appliction to Demonstrate Use of


Master Page.
-------------------------------------------------*/
<%@ Page Language="VB" Masterpagefile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="Default3.aspx.vb"
Inherits="Default3" title="untitlespage"%>
<asp:Content ID ="content1"
ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<strong><span style="font-size: 16pt">
<br />
<br />
www.My site.com<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This Site is very use
full for Download
<br />
&nbsp; &nbsp; 1.Appliction<br />
&nbsp; &nbsp; 2.Game<br />
&nbsp; &nbsp; 3.Mobile<br />
&nbsp; &nbsp; 4.Etc<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; In This Site Download
free,trial,demo &amp; buy
all Types of Applicton,Game,Mobile releted to your pc ,
Mobile &amp; Oher.<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; So This Site is Very
Populer.</span></strong>
&nbsp;<br />
<br />
<br />
<br />
</asp:Content>
/*-------------------------------------------------
Name:-Saiyed Ahmad Kamruddin
Roll_No:-27
Class:-TYBCA
Sem:-5
Sub:-ASP.NET

Q.5)Create Web Appliction To Make Use Of Theme


& Skine.
-------------------------------------------------*/

<asp:label backcolor="skyblue" runat="server"/>


<asp:calendar runat="server" BorderStyle="double"
BorderColor="Blue" BorderWidth="4" BackColor="pink" Font-
Size=".8em" Font-Names="verdana">
<todaydaystyle backcolor="yellow" borderwidth="1"
bordercolor="Magenta" forecolor="limegreen"/>
</asp:calendar>
/*-------------------------------------------------
Name:-Saiyed Ahmad Kamruddin
Roll_No:-27
Class:-TYBCA
Sem:-5
Sub:-ASP.NET

Q.6)Create web Appiction To Update & Delete Data


In Data Gridview.
-------------------------------------------------*/

Imports system.data.oledb
Partial Class Default2
Inherits System.Web.UI.Page
Dim con As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\
ASP.NET\stud.mdb")
Dim com As New OleDbCommand("select * from stud", con)
Dim ds As New Data.DataSet
Dim da As New OleDbDataAdapter(com)
Protected Sub Button1_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim com As New OleDbCommand
con.Open()
com.Connection = con
Dim s1 As String = InputBox("enter name")
com.CommandText = "delete from stud where S_Name='" + s1
+ "'"
com.ExecuteNonQuery()
con.Close()
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e


As System.EventArgs) Handles Button2.Click
Dim s1 As String = InputBox("enter Name you want to
update")
Dim s3 As String = InputBox("enter new Name")
Dim s4 As String = InputBox("enter new Class")
Dim s5 As String = InputBox("enter new Phone_no")
con.Open()
com.Connection = con
com.CommandText = "update stud set S_Name='" + s3 +
"',Class='" + s4 + "',Phone_no='" + s5 + "' where S_Name='" + s1
+ "'"
com.ExecuteNonQuery()
con.Close()
End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e


As System.EventArgs) Handles Button3.Click
con.Open()
ds.Clear()
da.Fill(ds)
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
con.Close()
End Sub
End Class
/*-------------------------------------------------
Name:-Saiyed Ahmad Kamruddin
Roll_No:-27
Class:-TYBCA
Sem:-5
Sub:-ASP.NET

Q.7)Create Web Appliction to Make Use Of Cookies.


-------------------------------------------------*/
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim newcookies As HttpCookie = New HttpCookie("Books")
newcookies.Values.Add("Name", TextBox1.Text)
newcookies.Values.Add("Fav_Book", TextBox2.Text)

newcookies.Expires = #12/31/2011#
Response.Cookies.Add(newcookies)
Label3.Text = "cookie created"
End Sub
End Class

You might also like