Last post Oct 06, 2011 03:24 PM by ajayshankar
Apr 06, 2006 05:54 AM|bjartn|LINK
Im creating a website in VS.Net 2005. Now I need to create the the provider data in my sql database (membership, profile and so on). I use SQL Express and in my application I connect to the database using the string
Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;
Now I need to use the aspnet_regsql against this database but I can't figure out the syntax. I have tried specifying the connectionstring using the -C attribute but that did not work. Then I tried
to attach the database to the server using SQL Server Management Studio Express so I could give it a name. But then I got a error "Cannot access the specifed path or file on the server" when I tried to attach the file. I have set the security permissions for
the folder to "Everyone". I think there are some security persmissions in the SQL Server I must set, but I cant figure it out.
I also tried to get the sql from aspnet_regsql but the resulting sql would not run i VS 2005.
Apr 07, 2006 02:16 AM|ScottGu|LINK
Here is a blog post that walks through how to set this up:
Hope this helps,
Apr 07, 2006 03:31 AM|bjartn|LINK
No, that post did not help at all. Im still trying to create the profile stuff in SQL Express. I have a database.mdf file in my website, and I need to get the profile stuff into this file. I have tried to connect to it using aspnet_regsql and the above connection
string, but then I got a message saying I could not connect using "AttachDbFileName", but perhaps my syntax was wrong. I used the following syntax:
aspnet_reqsql -C <ConnectionString> -A all
I have also tried to attach the database.mdf to SQL Express server using SQL Server management express, but I could not due to some security settings in the SQL Server. These I could not figure out. I did not get access to subfolders of "c:/documents and
settings" where my databasefile reside.
Apr 07, 2006 08:31 AM|bjartn|LINK
I finally solved it.. I moved the Database.mdf to a folder I could access using SQL Server Management Studio Express. (Never figured out why I could not access it when it was in My Documents). Then I attached it to SQLExpress. Finally I had to change the
server in the connection string to .\SQLEXPRESS. Using (local) did not work.
But Im not completely happy.. I would like to attach the Database.mdf when It is inside the "My documents" folder. Does anybody know how to fix this?
Nov 23, 2009 02:49 PM|pravinsable|LINK
I did following,
1. detached DB from VSStudio 2008.
2. Attached in SQL server Management studio .\sqlexpress.
3. Run aspnet_regsql and point to .\sqlexpress
4. Detached from SQL Manangement studio.
5. Attach in VSStudio 2008.
hope this helps.
Oct 06, 2011 03:24 PM|ajayshankar|LINK
Configure Membership Provider:
Follow the link
Alternatively Go to D:\WINNT\Microsoft.NET\Framework\v2.0.50727
Double Click on aspnet_regsql.exe
Type Server Name: MYSERVER\SQLExpress
Select Existing Db: MyDatabase
Click Finish to complete.
Open Website in VS2010
Make Changes in web.config:
connectionString="server=MyServer\SQLExpress;database=MyDatabase;Integrated Security=True;User ID=;Password=;"
<forms loginUrl="Login.aspx" protection="Validation" timeout="300"/>
Using Visual Studio 2010 Go to “Website” Tab
Click on “ASP.NET Configuration”
Click on Security and make necessary changes as per your requirement