VS2013 ASP.Net application error “VirtualPath was outside the current application root”

If you have Visual Studio 2013 ASP.Net project set up under IIS, when you open the web application in your browser you may get the error message “VirtualPath was outside the current application root”.

This error only happens while Visual Studio 2013 is open. To resolve this issue, you need to deselect “Enable Browser Link” option inside Visual Studio.

VS2013

Advertisements

Create ASP.Net Membership tables and objects in MS SQL Database

If you wish to use ASP.Net Membership for your project, you’ll need to setup related tables and database objects. These are set up using aspnet_reqsql utility. To run the utility, go to the .Net framework folder for the version that you are using, and run aspnet_regsql.exe. You can also use this utility to remove ASP.Net Membership objects from the database.

64 bit Windows example:

C:\Windows\Microsoft.Net\Framework64\v4.0.30319\aspnet_regsql.exe

32 bit Windows example:

C:\Windows\Microsoft.Net\Framework\v4.0.30319\aspnet_regsql.exe

Once aspnet_regsql starts, select wether to install or remove ASP.Net Membership from the database, and follow the wizard.

VirtualBox bridged networking not working on OS X Mavericks

If you tried running a VirtualBox VM that uses bridged networking after uprgrading your Mac to OS X Mavericks, you would get an error “Failed to open/create the internal network ‘HostInterfaceNetworking-en0’.

VirtualBox bridged network error in OS X Mavericks

To resolve the issue, download and install the latest version of VirtualBox, which at the time of writing this article is 4.3.0. As reported by some other VirtualBox users, if you already running version 4.3.0 and still see the same error, reinstall VirtualBox.

You can download VirtualBox here.

How to increase disk size in VirtualBox

If you need to increase disk size of a virtual machine setup in VirtualBox, you can use VBoxManage command line tool to do this.

VBoxManage modifyhd HardDisk.vdi --resize 51200

Command above would resize the disk to 50GB – resize parameter is in megabytes.

After resizing, you’ll need to boot into the host OS and either resize the primary partition or create a new partition in order to be able to use newly added disk space.

TSQL function to split comma delimited string and return it as a table

Here is a handy TSQL function that will take comma delimited string, split it, and return values as a table.

CREATE FUNCTION [dbo].[fnSplitStringToInt]
(
	@input varchar(MAX)
)
RETURNS @return TABLE ([ID] int)
AS
BEGIN

	DECLARE @ID int
	DECLARE @position int
	
	--Check if there is only one element
	IF (CHARINDEX(',', @input) = 0 AND LEN(@input) > 0)
	BEGIN
		INSERT INTO @return
		SELECT @input
		
		RETURN
	END

	WHILE CHARINDEX(',', @input) > 0
	BEGIN
		SELECT @position  = CHARINDEX(',', @input)  
		SELECT @ID = SUBSTRING(@input, 1, @position - 1)

		INSERT INTO @return
		SELECT @ID

		SELECT @input = SUBSTRING(@input, @position + 1, LEN(@input) - @position)
	END
	
	-- Last element
	IF (CHARINDEX(',', @input) = 0 AND LEN(@input) > 0)
	BEGIN
		INSERT INTO @return
		SELECT @input
		
		RETURN
	END

	RETURN
END