Check for a mis-spelled or missing Configuration setting.
99.99999% of the time this error happens on this line of code, the issue is that the SqlConnecton setting in the Web.Config (or app.config) is either missing or mis-spelled.
(Actually, in my experience it's 100% of the time, but you never know. There are exceptions to darn near everything.)
From here:
Connection string in .NET 3.5 (and above) config file
Do not use appsettings in web.config. Instead use the
connectionStrings section in web.config.
<connectionStrings>
<add name="myConnectionString" connectionString="server=localhost;database=myDb;uid=myUser;password=myPass;" />
</connectionStrings>
use the ConfigurationSettings class. string connStr =
ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
So YOUR web.config should contain
<add name="RegConnectionString" connectionString="server=localhost;database=myDb;uid=myUser;password=myPass;" />
Of course, you'll need to replace the server name, database name, username, password, etc...