ASP.NET
  Home arrow ASP.NET arrow Page 2 - Database Storage with the ASP.NET Web Matr...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Database Storage with the ASP.NET Web Matrix: Unsubscribe Page
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2005-09-28

    Table of Contents:
  • Database Storage with the ASP.NET Web Matrix: Unsubscribe Page
  • Setting up the Page
  • Calling the Function
  • Setting up a Web Directory Structure

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Database Storage with the ASP.NET Web Matrix: Unsubscribe Page - Setting up the Page


    (Page 2 of 4 )

    Use the Properties pane in the bottom-right of the application to set the text of the first label control to Username: and the ID of the textbox to txtUsername. Set the ID of the label following the textbox to lblUsernameError, change the color to red and clear the Text property. This control will display an error if the username entered does not appear in the database.  Next, set the ID and Text properties of the button to btnSubmit and Submit respectively.  The final label will be used to display a message when the action is successful, so change the Forecolour property to Green and the ID to lblSuccess.  Remove the Text property.  The page should look a little like this:

    You will notice that we are not asking the user for their password, only their username.  The reason for this is that we are also going to implement an authentication system that uses a session cookie to determine whether a user has already logged in to the site.  If a user is not logged in, we will not let them access the unsubscribe page, and will instead redirect them to the login page that was created in the last article.  The username field is still needed in this case in order to specify the string used in the database query. This is not the only way to do it; we could for example use the session cookie to store the username and read from this instead. 

    The security aspects will be discussed later. For now, switch to the Code view of the Web Matrix, and we can build the logic of the page.  The toolbox will automatically change to the code wizards. Drag the DELETE Data Method onto the page to open the DELETE Data Code Wizard.  Make sure that the database we’ve been working with so far is highlighted on the first page and click Next.   On the second page of the wizard, click the Where button to open the Where clause builder dialog box and just click Ok to accept the default.  A preview of the Where clause and data operation will be shown:

     

    Click the Next button twice and in the final screen of the wizard, enter a name for the function like removeUser, before clicking the Finish button.   This will insert the code needed to remove entries from the database.  All you need now is a way of calling the function you have just created.

    More ASP.NET Articles
    More By Dan Wellman


       · Welcome to the third article in the built-in code wizard series. I hope you find it...
     

    ASP.NET ARTICLES

    - Developing a Mini ASP.NET AJAX Server Centri...
    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT