From Visual Studio.net 2003 to 2010

I shall start the journey by using Visual Studio.net 2003 before looking at migrating to VS.net 2005, Vs.net 2008 and Vs.net 2010.

My environment is Windows Professional XP installed on a XP Virtual Machine on a Dell Inspiron 14R powered by Windows 7-64 bits.

Microsoft SQL Express 2008/R2 serves as the database server

Friday, February 10, 2012

Creating a web application using VS.net 2003

When using Visual Studio 2003 you first need to understand some of the terms and concepts involved.

Visual Studio 2003 primarily works using “Solutions” and each and every “Solution” can have one or more “Projects”. A “Solution” is basically a collection of “Projects” which work together in a unified logical fashion to fulfil some type of task or objective.

A “Project” can be for example a web project or some other type of project such as a web service or class that has some inbuilt functionality, but normally within the “Solution” each of the “Projects” will have some kind of common purpose.

For our purposes here we will have one “Solution” which will contain one “Project”. To create a new web application in Visual Studio 2003 complete the following:

1. Open Visual Studio 2003 by double clicking on the icon on your desktop.

2. By default Visual Studio will present you with the “Start Page” which will display a list of previous projects along with hyperlink buttons to either open an existing project or create a new project. If you have an existing project you can simply select it from the list of available projects on the start page. As we do not, we will create a new project by clicking on “New Project” at the bottom of the “Start Page” to open the “New Project” dialog box. If you don’t see the “Start Page” when you open Visual Studio you can open the “New Project” dialog box by selecting “File” then “New” and “Project” from the File Menu. This can be seen in Figure 6.
Visual Studio Project

Figure 6
3. You will notice that the “New Project” dialog box is very similar in layout to the “New File” dialog box of Web Matrix.

4. Under “Project Types” on the left side select “Visual Basic Project” and then under “Templates” on the right hand side select “ASP.Net Web Application”.

5. You will then need to provide a name for the “Web Application” by amending the name “WebApplication1” in the Location box. For my purposes I have replaced this with “rras”. Note also that in the Location box you can select a web server on which you wish to create this web application. This can be any web server to which you have access and appropriate user rights.

6. Once you are happy with the information that you have entered click on OK and Visual Studio will create your Web Application for you. Note you may be prompted for appropriate Username and Password details for the web server.

Once the project has been created you should see the Solution Explorer open at the side of Visual Studio and a new web form created ready for use. Note that the Solution Explorer can be docked so this can be located any where within the working environment and it may be dragged to the location which best suits your working practises. Within the Solution Explorer you will see listed your first Project and within that a number of newly created files useful for your web application.

Visual Studio 2003 has created a web application for you on the web server and also created a new folder within your “Solutions and Projects” area to store this new solution/project. If you wish to know where the “Solutions and Projects” are stored you can find out by opening the Visual Studio options by selecting “Tools” and then “Options” from the File menu. Open the “Environment” folder by selecting this on the left hand side and then view the Project locations under settings on the right hand side. You may choose to move this to a preferred location.

If you look at the base of WebForm1 which is open in the workspace, you are presented with two options.
· Design - a WYSWYG view of your web page
· HTML - a view of the HTML code within the page

Note also that if you do change to the HTML view by clicking on HTML at the base of the page some of the code has been prepared for you.

Change back to Design View, right click on the web page and then select Properties from the list of options and you will be presented with the “Document Properties” dialog box. There are a number of settings here but for now select the “Page Layout” property and change it from “Grid Layout” to “Flow Layout”. Select “OK” and Visual Studio will change the page mode to “Flow Layout”.

We won’t go into this here but “Flow Layout” is the normal layout used by most web developers when working with HTML (this has been changed in the coming release of Visual Studio 2005 where “Flow Layout” will be the default option).

Now type some text on the web page and then press return on your keyboard. To view this page within a web browser you can select “File” and then “View in Browser” from the file menu. Visual Studio will first save your open documents, and then compile any code which has been written before running the web page in your web browser.

Conclusion

In the first case we used the built in tools and wizards from the IIS Management Console to manually create a sub web within the Default Web Site. The IIS Management Console has a range of tools for both creation of web sites and managing them on an ongoing basis. A basic understanding of the options will be of use as at some stage it will certainly be necessary to resort to these tools to fix issues that may arise.

Finally, we used Visual Studio to create a new Solution which contained a single Project (our web site). Visual Studio created this for us along with the necessary files within a sub web of the Default Web Site of IIS. Visual Studio also created our first web page which could be viewed using a web browser across the web server.


More at :
http://www.codefixer.com/asp-net/tutorials/creating-a-web-application-using-visual-studio.asp

No comments:

Post a Comment