New ASP.NET project gives a great webapp template in Visual Studio 2010

(This post is part of Visual Studio 2010 series)

When you create a new ASP.NET web application in Visual Studio 2010, you are getting a project which has a good set of features built into it for you to get started quickly. In previous versions of Visual Studio, when you create a new ASP.Net project, you just get one .aspx page with a web.config file.

New-ASP.NET-WebAppTemplate

 

(Visual Studio 2010’s solution explorer showing the contents of a just created Web Application project)

Visual Studio 2010’s new project template has the following..

 

  • Master page – with menu, login view control, etc., has good div based layout with nicely used css styles. Along with two files based on master page(Default.aspx & About.aspx).
  • Stylesheet - with styles for most elements your web pages will be designed with, that you can customize as you wish
  • Forms authentication enabled – provides you with .aspx pages which implements forms authentication, like, login, register new user and change password, with necessary configurations in web.config
  • Web.config file with Debug and Release versions, including sample Web.config transformations that you most probably need
  • Web.config readily configured for ASP.NET Membership, Roles & Profiles
  • jQuery library .js files included with three versions of .js files – one with Visual Studio intellisense support, a normal one and a minified one-which is used for production.

 

This new project template would help beginners and people who are yet to get good overview on how a typical ASP.NET web site would be written.

Bookmark / Share

A tip when working with QueryStrings..

We still use QueryStrings for many reasons even though we have other methods to deal with HTTP requests to web applications. And when working with QueryStrings, I hate to type Request.QueryString(“blah”), Request.QueryString(“blahblah”), Request.QueryString(“blahblahblah”), etc., again and again when I need to. This is more tiring if there are more number of QueryString items to deal with.

If you note, Request.QueryString is actually a NameValueCollection. So in suitable situations I would love to use a NameValueCollection object with a short name instead of Request.QueryString(“blah”) ;) as shown below. This saves time and provides a little better coding experience.

NameValueCollection q = Request.QueryString;

Response.Write("name" + q["name"]);
Response.Write("address1" + q["address1"]);
Response.Write("address2" + q["address2"]);
Response.Write("city" + q["city"]);
Response.Write("country" + q["country"]);
Bookmark / Share