Jigsaw I neglected to point out that the code I posted for this previously was created in VS 2005 running on XP Professional. I'm going to update the code here and do a quick walkthrough of the steps necessary to get this working in Visual Studio 2008 running on Vista. You can find the download links at the end of this article.

Although I don't recommend moving projects from one version of VS to another willy-nilly (it takes very little time to get it up and running from scratch), if you are having problems moving a project between VS versions, you might want to check the version number at the top of the solution file; for VS 2005 you would find something like Version 9.00. When moving a VS 2005 project to VS 2008, you might try changing the 9 to a 10.

I plan on following up some more on this Guest Book application and showing how to develop an administrative back end for it. Right now ,the moderator functionality is built in, in that the 'live' field is not set by default. So, if you want your comment to appear, you will have to change this field value to 'true' manually in the database. The Guestbook table design is shown below.

Guestbook Table

The App_Code folder refused to play nice in the VS 2008 Web project, so I renamed the folder "Layers". Other than that, the code is the same. I've only been using Vista for a few weeks so I'll defer judgement until after the full SP1 release. For developers, I would recommend turning off the User Account Control (UAC) to get rid of those demented pop-ups. This is still a version 2.0 application, so be sure to select this option if creating your project from scratch in VS. Sometimes I will build my own project incrementally as I study other people's code that I have downloaded, just as a learning exercise :-)

VS 2008 Solution Explorer

One of the first things you will notice when moving to this environment is the completely new IIS 7 interface. It's 100% different and I'm finding it a joy to work with. In order to get the application running, you will first have to check some IIS 7 settings. ASP.NET is more integrated than ever before with IIS; no more dependency on command line line utilities like aspnet_regiis.exe – so do not run it to install ASP.NET!

IIS 7 Settings

In IIS, select the Application Pools node and set the Managed Pipeline for the DefaultAppPool to “Classic” in the Application Pools view. You will also need to create a virtual directory. You can do this (or pretty much anything else) from within the new IIS console, but I still prefer to perform this task from within the IDE. Right-click on the project node in solution explorer and select properties. On the Web tab of the properties manager, opt to create a virtual directory. Now, right-click on Default Web Site node in IIS 7 and opt to add a virtual directory. Navigate to the Guestbook folder and select it. Also, don't forget to set Default.aspx as the default page in IIS. In your browser, navigate to http://localhost/guestbook to bring up the home page.

VS 2008 Project Settings

If you start getting security errors, try adding appropriate permissions to the folder in question. If you get the following error:

HTTP 401.2 - Unauthorized: Logon failed due to server configuration
Internet Information Services


...in IIS 7, navigate to and highlight the Guestbook node. In the Category view to the right, double-click on the Authentication icon under Security. Right-click the Windows Authentication entry and opt to enable Windows Authentication. (KB 253667)

The database is very simple; one table and two stored procedures. Create the Guestbook database manually in SQL Server Management Studio (SSMS) and run the three scripts in your query window. Set up your permissions as shown below and you should be good to go.

Database Permissions

GuestBook-VS2005.zip (74.70 kb)

Guest_Book_DB.zip (3.13 kb)

kick it on DotNetKicks.com   PHP, ASP, .NET, JSP Resources, Reviews



ASP.NET 2.0 Guest Book Application

by agrace 4. February 2008 12:45

I recently had to create a Guest Book application for our local Tourism website. Googling a decent code sample didn't yield much so I created it from scratch. I'm making the code available at the bottom of this post. In an effort to keep things simple, I am leaving out the back-end administration since it basically uses the same database table. It also means that I do not have to walk through the membership sytem at this time. If I get requests, I may create another post on the admin part and update the code sample accordingly.

Add Comment

This is a Web Application project written in C#. There is a data access layer and a business layer. This may appear redundant for such a simple example as this but it does make for good coding habits! Ideally, one might also create a base page class and inherit from that, thus avoid unnecessary re-factorings later on. The App-Code folder is used to hold the business and data classes. Classes placed here are dynamically compiled which means we don't have to compile them separately.

Guest Book Message

If you place the source files for your classes in the App_Code folder, you must also add a reference to the System.Design assembly in the compilation section of the Web.config file. This reference requires the fully qualified assembly name of the System.Design assembly. You can get the information required for the fully qualified name by running the Global Assembly Cache Tool (Gacutil.exe) that ships with the Windows Software Development Kit (SDK), using the following syntax:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0>gacutil /l System.Design

I still make use of the SqlHelper class which came with the original "Data Access Application Block". Although this has been superceded by the Enterprise Library, I think it's much more appropriate for smaller projects. You can find out more here. When trying to incorporate the SqlHelper class into the project, I received the following error:

error CS0103: The name 'SqlHelper' does not exist in the current context

After you exhaust all that Google has to offer, you can try what I did and hack the project file by changing:

<content Include="App_Code\Data\SqlHelper.cs" />
to
<compile Include="App_Code\Data\SqlHelper.cs" />

Happy Days :-) 

Guest Book

Note that in the real-world you would use a CAPTCHA control. For simplicity I left it out here, but I originally used Peter Kellner's Ultimate CAPTCHA Control. It's easy to use and Peter was on hand to offer email assistance!

Feel free to download the code and use it any way you will!

GuestBook.zip (74.71 kb)

Guest_Book_DB.zip (3.13 kb)

kick it on DotNetKicks.com



NetCoder.net Domain Name for Sale

by agrace 28. January 2008 17:06

Domain Name Sale I've been holding on to this domain name for some time. I've never been in the business of buying and selling domain names. However, on a rare quiet day, I would often take a pad of paper and start brainstorming domain names around some theme or other. Open up a Godaddy search and start entering your ideas.

There is probably a whole science around not only the topic of what makes a good domain name, but of the best way to find one. The five/six letter - three vowel rule seems to work pretty well; think Yahoo, Amazon, Google and you get the idea. Short and sweet is good and the process of brainstorming a good name and finding that is is available is often reward enough.

The domain name is NetCoder.net and you can judge the price for yourself by looking at what some similar names have been going for:

Coderz.net --> $131,000
Mycoder.com --> $10,000
Allcoder.com --> $5,000
Javacoders.net --> $4,000

Now, I know what you're thinking... this guy must be mad! Well, I'm not and the figures speak for themselves... How about Britneyskids.com for a cool $995,000?

Joking aside, if you are interested in using the NetCoder.net domain name then you can snag it at a reasonable price at sedo.com. Make an offer and I might just accept it! Alternatively, if you would like to trade a pre-CBS stratocaster, then just pop me an email :-)

kick it on DotNetKicks.com

Tags: ,

General | Web