Print Page | Close Window

Can't access NorthWindIB in ASPAuthentication example for ASP security

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1624
Printed Date: 17-Apr-2025 at 11:31pm


Topic: Can't access NorthWindIB in ASPAuthentication example for ASP security
Posted By: BruceKu
Subject: Can't access NorthWindIB in ASPAuthentication example for ASP security
Date Posted: 22-Jan-2010 at 2:18pm
I am in general having problems getting your samples to find the NorthWindIB database.
 
I used your Database Installer tool but that hasn't helped.
 
This is your security example that requires login and includes registration.
 
To solve datbase connection problems in this case I put both the aspnetdb.mdf and NorthWindIB.mdf in the App_Data directory.
 
Then I modified the web.config as follows: ( I list only moded parts- find BRUCELAPTOP etc)
 

<edmKey name="Default" connection="metadata=res://*/Code.ServerModelNorthwindIB.csdl|res://*/Code.ServerModelNorthwindIB.ssdl|res://*/Code.ServerModelNorthwindIB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=BRUCELAPTOP\SQLEXPRESS;Initial Catalog=NorthwindIB;Integrated Security=True;MultipleActiveResultSets=True&quot;" containerName="AspAuthentication.Code.ServerModelNorthwindIBContext">

and

<add name="ServerModelNorthwindIBContext" connectionString="metadata=res://*/Code.ServerModelNorthwindIB.csdl|res://*/Code.ServerModelNorthwindIB.ssdl|res://*/Code.ServerModelNorthwindIB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=BRUCELAPTOP\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NorthwindIB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

 
I then opened the NorthWindIB data base using server explorer.
 
Then I connected for update the EF model to the same database.
 
I then went into domain model and regenerated it.
 
I can logon successfully to manager using login window.
 
When I press Fetch button I get the message
 
Cannot open database "NorthwindIB" requested by the login. The login failed.
Login failed for user 'IRDM\bruce'.
 

<!-- Forms authentication is used here. -->

<authentication mode="Forms" />

I am not sure what to do next.
 
Any ideas? (IRDM is my network domain in active directory)
Bruce



Replies:
Posted By: kimj
Date Posted: 23-Jan-2010 at 6:12pm
DevForce actually looks at only the EdmKeys for connection information, ignoring the connectionStrings section of your config file.  To get DevForce to open the NorthwindIB database in the Data directory you'll need to make a few more changes to the EdmKey's connection string to make it correct for SQLExpress (DevForce samples, and the installation, assume a non-Express version of SQL Server).  It should look like this:
 
edmKey name="Default" connection="metadata=res://*/Code.ServerModelNorthwindIB.csdl|res://*/Code.ServerModelNorthwindIB.ssdl|res://*/Code.ServerModelNorthwindIB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=BRUCELAPTOP\SQLEXPRESS;;AttachDbFilename=|DataDirectory|\NorthwindIB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;MultipleActiveResultSets=True&quot;" containerName="AspAuthentication.Code.ServerModelNorthwindIBContext">


Posted By: BruceKu
Date Posted: 25-Jan-2010 at 1:31pm
Thank you!
 
That did the trick.
 
I appreciate the explanation of the structure. I should find it easier with the rest of your examples.
 
Bruce



Print Page | Close Window