VB.NET – You must call the “WebSecurity.InitializeDatabaseConnection” method before you call any other method of the “WebSecurity” class.

Problem description:

If you are getting the error while running your MVC4 application in VB.NET

You must call the “WebSecurity.InitializeDatabaseConnection” method before you call any other method of the “WebSecurity” class.

Solution

Add the following line in the GLOBAL.ASX

Capture

 

Ensure that you are using the correct connection string and other information as per your own application as  shown in the highlighted line above.