Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 18th, 2009, 09:38 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default Moving AspNetDB on thte sql server

Hi there

i use vs2008, Sql 2005.

i created an application that uses login, as you all know when u use Asp-Net configuration tool in VS it creates the asp-net db, every thing works so far but when i remove the db from app_data folder and attach it in the sql is not reading it, instead it creates a new aspnetdb in the app_data,
how can i change the provider so it will point to the sql and not to the app_data folder.

thanks
__________________
bx
  #2 (permalink)  
Old March 18th, 2009, 12:10 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Add a connection string that points to the attached database, and change the Membership provider to use the new connection string.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #3 (permalink)  
Old March 18th, 2009, 01:16 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

I did add the connection string that points to the attached database but i don't know how to change the Membership provider, is that done in the web config?


Code:
<connectionStrings>
<addname="ConnectionString"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF
;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<connectionStrings>
<addname="NEWConnectionString"connectionString="Data Source=MAIN\SQLEXPRESS;Initial Catalog=ASPNETDB;
UserId=22222222; Password=2222222"
providerName="System.Data.SqlClient" />
 
</connectionStrings>
i comment out the first conn run the application it works, then i delete the app_data folder in the root run the application it says user not in db i run the asp configuration tool it says 0 users 0 roles.


can you give me an example of how to change the provider.

thanks
__________________
bx
  #4 (permalink)  
Old March 18th, 2009, 01:30 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Code:
 
<membership defaultProvider="myMembershipProvider" userIsOnlineTimeWindow="15">
   <providers>
      <add name="myMembershipProvider" 
         connectionStringName="NEWConnectionString" 
         applicationName="/" 
         enablePasswordRetrieval="true" 
         enablePasswordReset="true" 
         requiresQuestionAndAnswer="true" 
         requiresUniqueEmail="true" 
         passwordFormat="Encrypted" 
         maxInvalidPasswordAttempts="5" 
         passwordAttemptWindow="10" 
         minRequiredPasswordLength="6" 
         minRequiredNonalphanumericCharacters="0" 
         type="System.Web.Security.SqlMembershipProvider, 
            System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
</membership>
Of course, change the vlaues above to match whatever you want for your provider.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #5 (permalink)  
Old March 18th, 2009, 04:32 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

Hi Lee thanks 4 the code ,

i did try it and i got a little problem to access the database,

this login has user Id and Password,
i got this: Cannot open database "ASPNETDB2" requested by the login. The login failed. Login failed for user 'test'.

with the same login i can access sql management studio and have full permit ion for the ASPNETDB2 database,




i tried this
<
addname="ConnectionString"connectionString="Data Source=STUDIO\SQLEXPRESS;Initial Catalog=ASPNETDB2;Integrated Security=True"
providerName="System.Data.SqlClient" />
Cannot open database "ASPNETDB2" requested by the login. The login failed. Login failed for user 'studio\name

how can i sort this?


vs added this in the webconfig
&#xD;&#xA;
Code:
type="System.Web.Security.SqlMembershipProvider, &#xD;&#xA; System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
__________________
bx

Last edited by bex; March 18th, 2009 at 04:40 PM..
  #6 (permalink)  
Old March 18th, 2009, 04:56 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You need to check which users are configured in those databases, and what permissions they have. You also need to make sure the ASP.NET worker process has appropriate permissions as well.

Just because you can log into management studio with a given set of credentials doesn't mean you have access to any given schema in that database.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #7 (permalink)  
Old March 19th, 2009, 04:23 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

thanks Lee

done i also found this on the web
http://209.85.229.132/search?q=cache...&hl=en&ct=clnk

very helpful
__________________
bx
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues moving to SQL 2005 Server iPagan BOOK: Accessible XHTML and CSS Web Sites: Problem Design Solution 1 January 17th, 2007 01:35 PM
change default aspnetdb to SQL server 2000 alexdcosta ASP.NET 2.0 Basics 3 July 14th, 2006 07:50 AM
Error after moving to new SQL server jackchua BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 29th, 2005 07:47 PM
Moving to SQL Server siptah Access VBA 4 January 27th, 2005 07:28 PM



All times are GMT -4. The time now is 03:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.