Monday, July 6, 2009

ASP.net 2.0 memberships issue

I was trying to install and run the memberships and roles DB from asp.net 2.0 and had the following error show up repeatedly

An error was encountered. Please return to the previous page and try again.

The following message may help in diagnosing the problem: An error occurred during the execution of the SQL file 'InstallCommon.sql'. The SQL error number is 5110 and the SqlException message is: The file "S:\APP_DATA\ASPNETDB_TMP.MDF" is on a network path that is not supported for database files. CREATE DATABASE failed. Some file names listed could not be created. Check related errors. Creating the ASPNETDB_1735c56c9fbe43928ee626f81923d937 database... at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_users_adduser_aspx.PopulateCheckboxes() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles\Security\Users\addUser.aspx:line 28 at ASP.security_users_adduser_aspx.Page_Load() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles\Security\Users\addUser.aspx:line 22 at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

So, after hours of research and tonnes of googling, here is what resolved my issues

My web.config has following setup now


If you do this the SqlRoleProvider will be lost and cannot connect to the database. If you did this you have to supply a cutom role provider thru your web.config like this one,
< enabled="true" defaultprovider="CustomizedRoleProvider">
<>
< add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="AnotherLocalServer" / >
< /providers >
< /roleManager >