.NET Library Objects So far we have looked at the following objects in learning about ASP.NET: Controls Used to control the screen / interface and gather input and display output. Variables Used to control the computers RAM and allow it to store data / perform calculations. Custom Objects Used by programmers to perform specialised tasks.
14
Embed
.NET Library Objects So far we have looked at the following objects in learning about ASP.NET: Controls Used to control the screen / interface and gather.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
.NET Library ObjectsSo far we have looked at the following objects in
learning about ASP.NET:Controls
Used to control the screen / interface and gather input and display output.
VariablesUsed to control the computers RAM and allow it to
store data / perform calculations.Custom Objects
Used by programmers to perform specialised tasks.
The .NET LibraryThe .NET part of ASP.NET refers to a library of
objects that allow you the programmer to perform a huge range of tasks
System
Input-Output Provides tools for file input and output
DrawingProvides graphical drawing tools
WebProvides tools for Internet interconnectivity
DataProvides tools for accessing databases
We will look at two examples
The mail message objectUsed to create and send emails.
The SMTP client objectUsed to control a mail server.
The Mail Message ObjectIt may be found in the following part of
the .NET framework…
System.Net.Mail
To create a mail message object we would use the following line of code…
Dim myMessage As New System.Net.Mail.MailMessage(From, to, subject,body)
So let’s say we wanted to create the following email…
We would use the following line of code…Dim myMessage As New
Dim Server As New System.Net.Mail.SmtpClient("mail.cse.dmu.ac.uk")
Server.Send(myMessage)
Working ExampleTo see all of this working we shall look at the
code for the resend password page “resend.aspx”
What is an Object Again?“An object is a way of representing
computer technology in such a way so that we may send it instructions and
data.”
Creating an email and controlling a mail server are quite complex tasks, however “wrapping up” the complexity in objects means that we can perform this whole process in three lines of code.
Questions1. Correct the following code...
Questions2. Write down as many uses you can think of on the web
for an email object 3. The following is the declaration for another .NET
library object: Dim MyFile As New
System.IO.StreamReader("myfile.txt") This object is used to read data from a file stored on the
hard disk, in this case “myfile.txt”
QuestionsThink about what methods and properties this
object might use to manipulate the file so that we can read the data.
Write a list of possible methods and properties. Where might we find information on the