TEMPESTINI.NET

Observations in Software Development

Posts Tagged ‘ASP.NET’

GetUpperBound

Posted by Rick Tempestini on March 12, 2008

The GetUpperBound method of an array actually takes a single parameter in .NET. Unfortunately, Microsoft’s documentation on MSDN does not provide a clear explanation of the purpose and usage of this parameter (in my opinion).

First, the GetUpperBound method of an array will return an integer with the number corresponding to the highest number “element” that can be placed into a array. For example, Label1 would display the number ’4′ after the following snippet of code because the array was created to hold five (5) values (remember, arrays in .NET are zero-based)

GetUpperBoundSingle2

In the code above, however, a zero (0) was used when calling the GetUpperBound method. Since the array was declared as a single-dimensional array, there was only one dimension to get the upper bound value from. Therefore, a zero (0) was passed in to represent the first (and only) dimension of this array. Note: dimensions of the array are even zero-based and that is why a one (1) was not passed in.

On a two-dimensional array, this parameter can now take a zero or a one based upon which dimension you want to return a value for as seen in the following example:

GetUpperBoundMulti

In the code above, a two-dimensional array is created with three (3) as the first dimension and four (4) as the second dimension. Again, since the dimensions of an array are zero-based, the call to GetUpperBound(0) will represent the first dimension and the call to GetUpperBound(1) will represent the second dimension.

Posted in Other | Tagged: , | Leave a Comment »

Permanent vs. Temporary Cookies

Posted by Rick Tempestini on August 18, 2007

Cookies, by default, when created using the following code sample, expire when the browser closes:

code-sample-cookie-no-expiration.jpg

If, however, the Expires property is set to a date and time in the future of the current date and time, a persistent cookie file will be written to the local client hard drive. For Internet Explorer, cookies are placed in the c:\Documents and Settings\[user_name]\Cookies directory.

Therefore, the code sample below will write a permanent cookie to the clients hard drive because the Expire property was set to a time in the future.

code-sample-cookie-with-expiration.jpg

Now, looking into my local cookies directory I see my new cookie file:

file-explorer-with-new-cookie.jpg

If I open the cookie, I can now see the name of the cookie “TestCookie” and the name-value pair that I stored in the cookie: setting1-test.

test-cookie.jpg

Posted in Other | Tagged: , , | 4 Comments »

Lab 19 – Terraservice

Posted by Rick Tempestini on July 22, 2007

You will create a simple web application that will call a web service located on the Internet. The Terraservice web service is a publicly accessible web service that can be used by any SOAP-compatible web service.

Lab19
Default.aspx
Default.aspx.vb

Posted in Labs | Tagged: , , , | Leave a Comment »

Lab 18 – Web Services

Posted by Rick Tempestini on July 22, 2007

You will create a Visual Studio solution that contains two projects: a web site project and a web service project. The web site project will reference the web service project and make a call to the web service at runtime. In addition, you will use the IIS manager to configure an IIS virtual directory for the web service.

Lab18
Lab18.sln
Default.aspx
Default.aspx.vb

Posted in Labs | Tagged: , , | Leave a Comment »

Lab 17 – Membership

Posted by Rick Tempestini on July 22, 2007

You will recreate the application from Lab 16. This time, however, you will create the application with the ASP.NET membership web controls. This application will use a SQL Server Express database to store the user accounts. Also, the ASP.NET membership controls will automatically use this database for registration and login.

Lab17
Default.aspx
Default.aspx.vb
Login.aspx
Login.aspx.vb
Register.aspx
Register.aspx.vb
web.config

Posted in Labs | Tagged: , , | 1 Comment »

Lab 16 – Security Fundamentals

Posted by Rick Tempestini on July 22, 2007

You will create an application that will be restricted to only logged in users. This application will have a registration page that will be used to create a single user account in a local XML file. A login page will also be created to verify a typed in user name and password prior to letting the user into the site.

Lab16
Default.aspx
Default.aspx.vb
Login.aspx
Login.aspx.vb
Register.aspx
Register.aspx.vb
web.config

Posted in Labs | Tagged: , , | 1 Comment »

Lab 15 – XML

Posted by Rick Tempestini on July 22, 2007

You will write code to create a local XML file using the XmlDocument object. You will then write additional code to read the XML file from your local c: drive and then search the XML file for a specific XML element.

Lab15
Default.aspx
Default.aspx.vb

Posted in Labs | Tagged: , , | Leave a Comment »

Lab 14 – Files and Streams

Posted by Rick Tempestini on July 22, 2007

You will create a simple web page that will browse files and directories on your local machine.

Lab14
Default.aspx
Default.aspx.vb

Posted in Labs | Tagged: , | 1 Comment »

Lab 13 – Data Controls

Posted by Rick Tempestini on July 22, 2007

Your will add a page to the Lab12 project. This page will display the entire authors table from the pubs database using the GridView control. You will then apply formatting, paging, sorting, and selections to the grid.

Lab13
Default.aspx
GridView.aspx

Posted in Labs | Tagged: , , | Leave a Comment »

Lab 12 – Data Binding

Posted by Rick Tempestini on July 22, 2007

You will create a simple web application that filters a list of authors based upon the available states listed in the database.

Lab12
Default.aspx

Posted in Labs | Tagged: , , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.