Using aspnet_regsql to use a local project database

Instead of the default ASPNETDB.MDF, I want to incorporate the Membership tables into an existing local database within my project.

When asked for the Server and Database, the default server gives me a "Failed to query a list of database names from the SQL Server." error. When I set the Server to: .\SQLEXPRESS, my database doesn't appear to be in the list, however manually typing in the database name (without the .MDF extension) seems ok.

When I run the ASP.NET configuration, I get an error "There is a problem with your selected data store... Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'"...

I've changed the web.config to override the machine.config to ensure that the RoleManager was enabled and both could use a single provider setting by naming them MyProvider: 

  <connectionStrings>
    <add name="myDB" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\My Documents\Visual Studio 2008\WebSites\...\App_Data\myDB.mdf;Integrated Security=True;User Instance=True" />
  </connectionStrings>
  <system.web>
<membership defaultProvider="MyProvider">

<providers>

<clear/>

<add name="MyProvider"

type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="myDB"

enablePasswordRetrieval="false"

enablePasswordReset="true"

requiresQuestionAndAnswer="false"

applicationName="/"

requiresUniqueEmail="false"

passwordFormat="Hashed"

maxInvalidPasswordAttempts="5"

minRequiredPasswordLength="8"

minRequiredNonalphanumericCharacters="0"

passwordAttemptWindow="10"

passwordStrengthRegularExpression=""/>

</providers>

</membership>

<roleManager enabled="true" defaultProvider="MyProvider">

<providers>

<clear/>

<add name="MyProvider"

type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

connectionstringname="myDB"

applicationName="/" />

</providers>

</roleManager>

 

Incase you were wondering, I could use the ASPNETDB.MDF that got automatically created without any problems. Oh, accessing the database via my ASPX pages is also fine with the declared connectionstring. I'm using SQLExpress (the one shipped with VS.NET 2008) and not using any configuration manager.

 

Any help would be greatly appreciated.

Thanks.

0
pizzaboy
3/27/2009 7:45:32 PM
asp.net.security 27051 articles. 1 followers. Follow

4 Replies
1128 Views

Similar Articles

[PageSpeed] 16

 There is a little known feature that will let you create all of these tables using code in your project.

Perhaps that will automatically use your connection string and put it in you mdf file?

See suggestion 3 for setting up the database tables:

0
rtpHarry
3/28/2009 10:46:24 AM

 Hi,

I'm not sure about VS2005. If you are using VS2008, you can execute the script same as SQL Management Studio. In VS2008 IDE, Navigate to DATA -> T-SQL EDITOR -> NEW QUERY CONNECTION. This will open a query window. In which you can execute the SQL statements against your MDF files.

Hope this will helps.

Happy Programming.

Pravesh


Don't forget to click "Mark as Answer" on the post that helped you.
0
Entry
3/28/2009 12:06:51 PM

Thanks for your reply.

The example shown on the eggheadcafe site uses an alternative way to achieve exactly what aspnet_regsql was trying to do.

I think the problem I'm having is that I'm not sure what to fill in as the parameters as opposed to requiring an alternative way to do it. The error itself is caused because aspnet_regsql hasn't actually made any changes to my database (ie, no stored procedures or additional tables typically in the membership database tables have been added).

I noticed that the connectionstring I'm using, uses "AttachDbFilename" to connect to the database via a windows path rather than a specific database name, does that mean the database itself is not physically attached to the server? If not, then how would I do this, or how could I confirm this?

Also, the server I specify is "./SQLEXPRESS", is that correct?

 

Cheers.

0
pizzaboy
3/28/2009 5:32:07 PM

My guess was correct. Databases created via the VS.NET (or Web Developer) IDE is not physically attached to a database server.

For those of you wishing to consolidate the membership tables to an existing database should check out this: http://aspnet.4guysfromrolla.com/articles/040506-1.aspx.

Cheers.

0
pizzaboy
3/30/2009 7:28:54 AM
Reply:

Similar Artilces:

Hi...Please send me some project names on Database management using .net (On other domains also like security systems))
 Hai all.....I am doing projects on .net .....I am unable to find the projects......So I am requesting u all to send some .net project names..........I have done some projects on the Domain like Database management systems (college,Hospital, Airline info, webshopp)...........Now what I want is Some other Domains like security like that and some project names............ Please send me project names ...............

How to use net use?
Please can any one tell me how to use the dos command net use properly? I have read the help but can't seem to get it to work. Keep getting sytax error message. Thanks in advance. "Beowulf" <who-knows@no-one.com> wrote in message news:9krutk$puu$1@news.grc.com... > Please can any one tell me how to use the dos command net use properly? > > I have read the help but can't seem to get it to work. Keep getting sytax > error message. what are you trying to do? There are about 50 options to "net use" that do a ton of different thin...

Using Using
I have just completed reading a chapter in my book on performance. The books says to speed up performance on your web site you should use the using statement when opening connections. My question is how do you catch errors if you are using this as apposed to a try catch block.thanksBryan  Why would you use it as an alternative to a try/catch statement. Couldn't you just do something like  public void UsingSomeMethod() { try { SomeMethod(); } catch(SomeException e) { /// do something useful }}public void SomeMethod() { using (Something) { ...

When to use ( and when to use ((?
I'm just not getting it. When do you use ( in a statement, when do you need to use ((, and is the space after either or both mandatory? For example, I coded this statement: if (( $_ eq $bad_guys_ip )) { more_stuff_here }; Why the two (( in an if? And why does it seem to not work when I miss the space after the ((? Thanx! Mark me as... /Corn-fused|Dense/ > I'm just not getting it. >=20 > When do you use ( in a statement, when do you need to use ((, and is > the space after either or both mandatory? >=20 > For example, I coded this sta...

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

When loading gmail must always "reload" once unless using the secure loading site. When using the secure loading site loading takes four times as long. So I don't use the secure loading site, I just
Name: Dwight Metcalfe Email: dwmet1atgmaildotco Product: Firefox Summary: When loading gmail must always "reload" once unless using the secure loading site. When using the secure loading site loading takes four times as long. So I don't use the secure loading site, I just "reload" the other site once automatically just to save time. Hmmmmmmmm. Comments: Only been doing that about a month. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 From URL: http://hendrix.mozilla.org/ Note to reade...

what is the USE of Ultralite Project and when we are using it
what is the USE of Ultralite Project and when we are using it ? In online Book this is given But i am not getting it Exectly what he want to say please any one can explane it what is use of it in our project and how we can get benifit of this and where we have to use it : When you add SQL statements to a reference database, you assign them to an UltraLite project. By grouping them this way, you can develop multiple applications using the same reference database. When the UltraLite generator runs against a reference database to generate the database source code files, it takes a...

When to use a project and when to use a website
Silly question probably...I'm  a bit confused, when starting out with a website,  as to when to  use File/New/Project and File/New/Website.....And what the difference is between the two ...like I can do File/New/Project and ***  Web Application.. which makes a website (?)Can anyone throw a little light on this?All the examples I've seen when learning have been using File/New/Website...I realise this is a bit fundamental.. but in my defence can I say i haven't had the luxury of being sent on an asp.net course...   This all depends on how you like to manage your web ...

How to transfer a GUID created using vb.net into a SQL database using a stored procedure
I am able to create a guid using: Public Function GetGUID() As String ' Returns a new GUID Return System.Guid.NewGuid.ToString End Function however when I try to add this to a parameter using the following: Me.cmdSpAddOptions.Parameters("@QuoteDetailID").Value = GetGUID() I get an error, I have also tried this: Dim uidQuoteDetail As String = GetGUID() Dim myuid = New System.Guid(uidQuoteDetail) Me.cmdSpAddOptions.Parameters("@QuoteDetailID").Value = myuid but get the error "Object must implement IConvertible" A...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

How to use the arguments to use() in the package being used
Howdy,=20 The subject says it all believe it or not :) What I'm trying to figure out is how to pass an argument=20 (pragma I believe is the proper term) to use() and do=20 sonethign in the package based on it. I've looked at CGI.pm source but can't seem to track it down.=20 (Similar idea as to CGIs -oldstyle_urls -newstyel_urls) http://search.cpan.org/~lds/CGI.pm-3.04/CGI.pm#PRAGMAS What I'd like to do is something like this: # for old time's sake we'll just use our favorite module use Foo::Monkey qw(:Foo :Bar -doamazingthings); #then in Foo::Monkey...

Any way in IIS 6.0 to secure a directory using a database with logins without using Forms Authentication and Mapping?
I need to protect all files in a directory on a web server. My users have a desktop application they use to connect to the server and look for updates. I had implemented Forms authentication for the directory I'm protecting and included wildcard mapping in IIS. This works very well for when someone tries to access the updates via a web browser. But, the desktop application crashes out because when it accesses that directory, the RedirectURL from the forms authentication won't work. The application doesn't know to open a web browser and ask for authentication.  I may...

how to use the aspnet_regsql.exe utility wizard to use an exisitng database to set membership, roles etc. on a shared server?
Hi,i've been attempting to follow the tutorial below so i could use the same database for membership, rules etc.http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx i'm currently using shared sql server hosting, which i don't have the correct permissions / master login credentials to complete the steps outlined in this tutorial.are there any work-around or alternative steps i can take to complete what i'm trying to achieve? what would i need to actually be able to perform such tasks? (a dedicated server?) thanks in advance  You should be able to create your own database ...

Using jQuery
What are the advantages of using ScriptReference to include a jQuery source in my .NET pages as opposed to using the regular <script src='jquery.js'></script> method? Thanks.Ryan One advantage of the ScriptManager is that you can use application relative paths (e.g. ~/scripts/jquery.js).On a related note, if you're writing something that will be public facing, you might consider using Google's free CDN hosted version of jQuery. Encosia - ASP.NET, AJAX, and more.Latest article: How I handle JSON dates returned by ASP.NET AJAX  Thanks for the reply. I act...

Web resources about - Using aspnet_regsql to use a local project database - asp.net.security

OSS on Azure
OSS on Azure

CorFlags Conversion Tool (CorFlags.exe)
Developer Network MSDN subscriptions Get tools Sign in Home Technologies Cloud Mobile Web Business Data Gaming Dev centers Connect Tech Advisors ...

J.D. Meier's Blog
J.D. Meier's Blog. Software Engineering, Project Management, and Effectiveness. Patterns and Practices at Microsoft.

connection string for SQL Server Express from asp.net 2.0
... 2005 Express was the Web Site Administration Tool (WSAT) having a problem connecting to said SQL Server Express instance even after aspnet_regsql ...

Visual web developer 2005 &SQL 2005 in Vista trouble-shooting - Web Development learning dairy
... a connection to the database. If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql ...

Initializing Membership Error
... Membership database objects: To create the Membership database objects in SQL Server Database, run C:\WINDOWS\Microsoft.NET\Framework\ \aspnet_regsql.exe ...

OssOnAzure - Forums
Azure and Aspnet_regsql.exe [closed] Monday, June 25, 2012, 10:50:00 AM Possible Duplicate: Migrating ASP.NET Membership Database to SQL Azure ...

ASP.NET SQL Server Registration Tool (Aspnet_regsql.exe)
The ASP.NET SQL Server registration tool (Aspnet_regsql.exe) is used to create a Microsoft SQL Server database that is used by the SQL Server ...

Software Publisher Certificate Test Tool (Cert2spc.exe)
Developer Network MSDN subscriptions Get tools Sign in Home Technologies Cloud Mobile Web Business Data Gaming Dev centers Connect Tech Advisors ...

ASP.NET SQL Server Registration Tool (Aspnet_regsql.exe)
... Microsoft SQL Server database for use by the SQL Server providers in ASP.NET, or to add or remove options from an existing database. The Aspnet_regsql.exe ...

Resources last updated: 12/3/2015 5:45:38 AM