Thursday, January 27, 2011

Asp.Net Configuration - Open Broswer When Debug

Configuring Asp.Net To Open New Browser Window When Start Debugging.

Not too long ago I encountered a small problem that occurred to one of the developers in my team when he got a new computer.
Previous to the new PC, whenever he clicked on "Start Debugging" (also known as F5) the solution compiled and opened a new browser window with the default page.

After the new PC arrived the configurations in his Visual Studio 2010 were different. Meaning - Whenever he clicked F5, the project was compiling, but no browser windows appeared.

With a short phone call I explained the steps he needs to do, but in order for it to be clear for all of us, I decided to upload it as a brief post.

  1. Right click on the project's name.
  2. Click on "Properties".
  3. A configuration manager window will open.
  4. Click on the third tab called "Web".
  5. On that tab you will have several sections, the first the is what we're interested in.
  6. on "Start Action" section (the first one) you will see many options:
    1. Current Page - Will open the page you're at.
    2. Specific Page - Will open a specific page.
    3. Start external program - Will run a specific ".exe" file.
    4. Start URL - Will allow you to choose URL to open.
    5. Don't open a page. Wait for a request from an external application - Kinda explain itself.

Good luck, and thank to Noam from our Bulgaria office,
Elad Shalom,
CTO at

Tuesday, January 25, 2011

Configuration and Environment Variables - Visual Studio 2010

How to create configuration or Environment variables in Visual Studio 2010.

Environment variables are a great thing for when you publish your website to multiple places.
It doesn't matter if you publish it to testing / staging / production environment or if you're publishing your site to several servers which require different methods to be called / different values assigned to parameters.

Lets create a web application project (further explanations will be granted later)
  1. Open Visual Studio 2010
  2. Create New Project -> ASP.NET Web Application

As you can see, you automatically have two configuration options:
  • Debug
  • Release
Right click on the project in the Solution Explorer.
Click on Properties.
Click on Build tab.

Under that tab you have many configuration options (which will be discussed in another post).
The field we're interested in is "Conditional compilation symbols".

While on Debug mode, we will write a variable name in this field.
Example: "vDebug"
After saving, you will have an identifier for when in Debug mode.

Before testing our work, we're gonna create another Configuration.
Click on the configuration drop down list and choose Configuration Manager

 Add new Configuration - TestRelease:

Now place the variables in Release Configuration and in TestRelease Configuration.
I've placed the variables: vRelease and vTestRelease

Now for the test.
Create a similar code on your Default.aspx.cs page:

When you will run the code, you'll see that for each configuration option it will it the correct method.

Hope it helped,
Elad Shalom,
CTO at