Having run the setup routine, you've got a running application under the URL http://localhost/bid. At this stage, you've got two options:
Creating a New ApplicationIn Visual Studio .NET, open the File | New | Project dialog, and ensure that you have Visual Basic Projects selected as your Project Type. Then, click on ASP.NET Web Application as your Template, and enter http://localhost/MyBid in the Location box. We've had to pick a new name here, because the downloaded application uses the name Bid. When you click OK, Visual Studio .NET will create the project, and after that our project is ready to be coded. All we have to do now is write the code!
Preloading CodeSince we aren't actually going to code everything in this application from scratch, we need to copy some of the code from the downloaded sample. First, you need to create a directory in which to store the components. In the Solution Explorer, right-click on MyBid, choose Add from the context menu, and then select New Folder:
As a result of this operation, the new folder is created directly in the Solution Explorer. Just make sure that you change its name to Components. Next, we need to import the component files from the existing application. Select the Components directory, right mouse click and select Add again, but this time pick Add Existing Item. From the next dialog, navigate to the directory where you installed the sample, and select all four files from the Components directory there. Click the Open button, and these files will be copied into our new project. We've mentioned two of these files before - they contain the DAL components that provide the interface between our application and the database. The file with the .resx suffix is a resource file used by VS.NET, while the last one is Tools.vb, which contains the following:
Imports System.Web Public Class Tools Public Shared Function IsLoggedIn() As Boolean Dim ctx As HttpContext = HttpContext.Current If ctx.Request.Cookies("email") Is Nothing OrElse _ ctx.Request.Cookies("email").Value = "" Then Return False Else Return True End If End Function End Class This class just provides a central function to see whether a user is logged in or not. It accesses the current HTTP context - you don't need to worry especially about this, but it's required if you need to access the HTTP objects from within a component. From the context, we access the Request object, and from there the Cookies collection, and the cookie called email. This cookie contains the e-mail address of a logged-in user. If it's empty, the user isn't logged in.
Setting the ConfigurationNow that the components are installed, we need to set the configuration details. For this application, this simply consists of the information required to connect to the database, which we can store in the web.config file. Just add the following between the <configuration> and <system.web> elements, save the file, and close it:
<appSettings> <add key="ConnectionString" value="server=(local)\NetSDK;database=bids;Trusted_Connection=true" /> </appSettings> |