Assignment 2 -Create a Form
Objectives
To create a form that can accept user input and store it in a database.
Assignment
You will start with the application that you created in Assignment 1
You will need to create a DefaultLoggedIn.aspx. This will be the page the user sees when they are logged in. Currently we do not use this, but you will be adding it later.
We will now create a form called EditUserProfile.aspx – This will be a form where you will allow the user to enter profile information.
The profile information that will be entered for the user are;
Full Name
Address
City
State
Phone
Email (note that the Membership class built into .NET also stores the email address)
If you have the ability to design a database and store this data in it – then you are welcome to use that ability. For those who do not have advanced database knowledge – I have created a single table database that you will be able to use through the entire class.
Your input form must take the input from user text boxes, validate it, convert it into the correct format, and store it in the database. The XML will be stored in the field DataText in the database. Design information for your database will be found here Default Design for Single Table Database – the DataTypeText will be Course Definition.
NOTE: You may use my default example here as the object that you store – OR – you may create and save objects that you create, this will allow you to work on any projects you may have personally as part of the class.
Information
If you decide to use the XmlPropertyObject to do this here is some help on using it for this assignment: Getting Started – Using the XmlPropertyObject for COP4834
This form will look something like this (note that I filled in the email automatically from the login information – search on C# Membership Get Email to get info on how to do this;
Estimated Completion Time
This will take about 5-10 hours to go through the video. I also recommend highly spending some extra time learning the code and how it all works.
Supporting Lectures
Topic – Creating a Single Table Database Object Storage – This covers the creation of the XmlPropertyObject which will allow you to store all objects you create in a single table in the database.
Questions and Answers
Q: I am lost, what do I do?
A: Because the students in this class are at all levels of programming I have made video’s to help all the students through getting started. There is also a series of beginners videos that even the experienced users might find useful at Topic – Basic Programming Concepts . I also start the class by jumping directly into the deep end to allow all students to determine whether they think they can handle the materials – this allows us to have time to administratively withdraw you from the class if you are in way over your head.
Q: I keep getting an error when accessing the Register, About, Contact links pertaining to System.Security.SecurityException. I have read different articles and blogs about this, and tried different fixes, in one of them I added to the Web.config the SecurtyPolicy tag and set the trustlevel equal to Full, but it has not made a difference.When I run the Application in VS runs perfectly.
A: This is actually a multi-step solution. Here is what is going on – You must connect the application to a database. To do this you will need to have the connection string mapped to a database accessible from your web host. In Azure you create this database and you can get that connection string from the manage page in Azure. In GoDaddy you also can create a database, and there is an option to get the connection string too. In both cases you will need to insert the password into the connection string.
Once it is uploaded and points at a database (via connection string) the Membership classes (that create accounts) will automatically create the Membership table structure in the database – IF the user and password combination allows you to create tables. Some times the table structure is incorrect and Membership will still try to create the structure on top of an old structure. To fix this drop all the tables and just let Membership recreate them when you run the application. This should help you out.
Bottom line though – YOU MUST create a database somewhere in your host environment and map the connection strings to it on publishing.
External Resources
For students with absolutely no experience or abilities of working with Web Forms – there is a little tutorial available at http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/introduction-and-overview that will step you through everything.
Grading Criteria
A working form that allows the user to save data – and return to edit the data will earn you full credit on this assignment.