0

On my home computer, i am working on a ASP.NET Website Project. Which is accompanied with a SQL Server 2012 database.

I'm trying to transfer this project over to my laptop. I have successfully restored the database on my laptop and fixed some connection errors on the ASP.NET website project (web.config file).

In my database i have integrated the aspnetdb to handle my users/roles/membership along with the other tables i have. Unfortunately, after the transferring the entire database over to my laptop it seems to have deleted my roles, but not my users. Therefore, causing a problem when a user tries to login to my asp.net website.

I have loaded the asp.net website management tool and as i expected it says there are 3 users and 0 roles. I was just going to recreate the roles, as my database isent that big. Strangely enough, the transfer only deleted the roles and not the users. However, upon clicking "create or manage roles" i get an error. Just want to mention same thing occurs when trying to create a new user, using this tool.

The Error:

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

The following message may help in diagnosing the problem: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_roles_manageallroles_aspx.BindGrid() at ASP.security_roles_manageallroles_aspx.Page_Load() 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)

I assume problem lies in me transferring the asp.net website project folder over to my laptop and the asp.net website administration tool cannot recognize the sql server instance, so i need to update this somehow to match the new sql server instance.

How can i fix my problem?

UPDATE:

I just checked my home machine database and interestingly enough, there is no data stored in the aspnet_roles table. But there are users stored in the aspnet_users table. Now why is it not storing the roles in that table? :/

I'm abit confused, if its not storing the roles in that table.. where would it be storing them?

Update 2

I just noticed the roles are getting stored in app_data folder into ASPNETDB and not the database i have connected on my sql server. I don't know how this has happend as it use to get added to my sql server. is there a way i can transfer my aspnetdb tables and data into my sql database?

I just did a test by creating a new user. The new user gets stored in my sql database i have. But it does not get stored in the aspnetdb, but the roles are getting stored in the aspnetdb but not the tables in my sql database.

Question: How can i combine these and only have it update data in my sql database?

Update 3

I fixed the problem with the roles and users getting stored in 2 diff providers, i just had to point them to a single provider.

Community
  • 1
  • 1
Kai
  • 25
  • 1
  • 3
  • 8
  • I'm profoundly surprised that it "deleted" your roles. Are you sure it's a presence/absence issue, not a permission issue (right to select data)? – GalacticCowboy Mar 08 '13 at 16:45
  • Nope, its not a permission issue. the roles have completely gone. As shown from sql management studio and website administration tool – Kai Mar 08 '13 at 17:21
  • In that case, how did you transfer the database? If you just copied the MDF over, it shouldn't have removed anything. Did you script it? – GalacticCowboy Mar 08 '13 at 17:22
  • I copied the .mdf file and .log file over to the new machine – Kai Mar 08 '13 at 17:26
  • Any idea why my web site administration tool, is not working? cause if it worked i could just recreate the roles – Kai Mar 08 '13 at 17:28
  • My "Membership Transfer" Helper would help you get one consistent database (locally) and then get that data over to the production database. – granadaCoder Mar 08 '13 at 19:28

2 Answers2

2

How are you referencing your database? Chances are you have the name of the computer in connections string (or IP address). Check to make sure this is changed as well. THis is most likely in your web.config file. If you still have your old server setup, you can actually export all the tables and records to an sql file and then upload it to the new server.

jason
  • 3,821
  • 10
  • 63
  • 120
  • ive already updated the connection in my web.config to match the new instance of the sql server. and ive alrdy got the tables and records from attaching the .mdf and .log file from my home machine. Its just the roles which are missing for some resoan – Kai Mar 08 '13 at 17:18
  • Is there another place web site administration tool needs to be updated to reference the database? besides the web.config which i have already updated as mentioned – Kai Mar 08 '13 at 17:22
  • According to the error, it's either because it cant find the db, using the path you provided, or because the db is not set up to accept a remote connection. You may not have set this server up the same way. Take a look as this: http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx – jason Mar 08 '13 at 17:26
  • i copied and pasted the .mdf file and .log file. The database should be exactly the same. I will take a look at this remote connection now and get back to you if it fixed my problem. – Kai Mar 08 '13 at 17:29
0

Here is my "Membership Transfer" Helper.

http://granadacoder.wordpress.com/2007/11/29/membershipprovider-helper-to-transfer-data/

granadaCoder
  • 26,328
  • 10
  • 113
  • 146