Is there an easy way to set up ASP.NET Membership tables in a custom Database? - asp.net-mvc-2

ASP.NET Membership is just great as there are a ton of functionality right there to be used, and we don't need to change nothing at all.
We can even create our own Provider based on Membership database, and that give us infinite possibilities, like as I don't like the Question/Answer I just use an email that is sent with a reset link.
But this is all done with SQLEXPRESS .mdf file and I wanted to use my own Database for this so I can use SQL Server Enterprise as we have in the Office and not the Express Edition.
How can I easily use the ASP.NET Membership tables in my own Database?
I rememebered some years ago that we needed to use aspnet_reg (something) to create the correct tables, but I can't find that info anymore.
I also tried to use other Membership Providers, namely Altairis.Web.Security from CodePlex and saw the Chris Pels Video on creating a new Membership Provider
On Altairis solution, the Model is not complete and lack several points such as Several Applications as it's made to be used with only one, and Chris Pels contains to much Store Procedures that I need to create by hand.
I'm for given Chris code a go but I just wanted to know if there would be available something easier.
All this is to be integrated in ASP.NET MVC 2 Web Application.
Thanks

You have 3 options:
Do it by running aspnet_regsql.exe: Just open "Start Menu>All Programs>Microsoft Visual Studio 2010>Visual Studio Tools>Visual Studio Command Prompt(2010)" and then type aspnet_regsql. A wizard appears and let you select your desired database.
Do it via API: Use System.Web.Management.SqlServices class and its Install and Uninstall methods. This will programmatically install/uninstall database artifacts.
Do it manually: Go to C:\Windows\Microsoft.NET\Framework\v4.0.30319 or something like. You will find 9 .sql files that begins with Install and 9 .sql files that begins with uninstall. You can run them manually in your database to create needed tables/store procedures/etc. But consider changing database name in sql scripts. Default db name is aspnetdb.

It's aspnet_regsql
Under the following path:
C:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql

You need to open up the Visual Studio Command Prompt, navigate to C:\WINDOWS\Microsoft.NET\Framework\\aspnet_regsql.exe . Some example are located in the MSDN documentation.
Example: aspnet_regsql.exe -E -S localhost -A mr - installs the database elements for membership and role management on the local computer running SQL Server using Windows authentication.

Related

MySQL workbench: multiple windows

MySQL workbench is a fantastic tool. However, I'm having a hard time figuring out how to create multiple windows. For example, in Sequel Pro (or TablePlus or really any other SQL client) I can have multiple windows:
Yes I know there are 'tabs' but those aren't quite the same thing. Is there a way to have multiple windows using MySQL Workbench?
It seems like from a few other threads this would need to be done manually via:
$ open -n -a MySQLWorkbench.app
MySQL Workbench is originally designed to be a single instance app only. On Windows this has been extended to allow multiple instances (there's a setting in the preferences) and you found a way to do this on macOS. However this bears some risks, because all instances share the same config and cache files and can write simultaneously to them, which is prone to file corruption. Also, any changes done to the configuration or connections end up in the same file, so the last change may override previously made changes in another instance.

New SQLAzure databases are not visable in the portal nor via the powershell cmdlets

Last week I created 8 databases on a V12 SqlAzure server via powershell and ARM templates, it worked fine. We started to use these databases in SQL Management studio and have set up users and tables etc. There is some data in them and we can select and update as expected. In short they work!
But today I wanted to apply some resource locks to the databases using the azure powershell cmdlet New-AzureRmResourceLock but I'm finding that the command Get-AzureRmResource | Where-Object {$_.ResourceType -eq "Microsoft.Sql/servers/databases"} does not return the databases I'm looking for!
Also I now look in the portal https://portal.azure.com and I see the SQL Servers listed, and when i enter the blade for my sql server I see the databases. But if I click on a DB I'm lead to a not found resource. Also when using the SQL Databases blade I don't see any of the databases listed.
As an aside if I log on to the classic portal https://manage.windowsazure.com I can see the sql server and see all the databases, and click on them and configure them.
I don't really want to have to recreate all these databases as we have started to set them up with schemas, users and data but do need to be able to use the cmdlets to change them especially to add resource locks to them.
Has anyone see this before? and what could i try to bring them back so i can use powershell to configure them again.
I was in touch with Microsoft support last week and they had a look. this is the resolution.
From: Microsoft support Email
I suspect that our case issue derives from stale subscription cache.
In summary, subscription cache can become stale when changes made
within a subscription occur over time. In an effort to mitigate our
case issue, I have refreshed the subscription cache from the backend.
After they had a look it was sorted out that day, both the portal and more importantly the command line are fixed.
Thanks All
Please provide your subscription id, server name and missing database names and I will have this investigated. Apologies for the inconvenience. You can send details to me at bill dot gibson at microsoft . com.

SQL Service Broker creating objects in SQL Server Database Project in VS 2012

So I've started a SQL Server database project inside VS 2012. I have done this for other databases already but not related to Service Broker.
For testing I had already created db, queues, etc through a T-SQL script including Message Types which was in an XML format. i.e.
[//blah.com/Items/RequestItem]
When I try to do something like this in the DB Project it's not allowing me too due to special chars.
Anyone done this? Gotten around it?
Is there a way to simply put my already created T-SQL file in the database project and have it use it?
See my comment above. I was able to import the script by Right clicking on the database Project.

Entity Framework for Sql Server Compact - setting .sdf file access permissions

I am trying to write a desktop app which uses Entity Framework for sql server compact (6.0). It is using click-once deployment.
ideally, all windows users would have full access to the database file, and for this reason it is set up in:
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + #"\BlowTrial"
I am using the .net 4.0 framework, and was thinking of using the File.SetAccessControl method within the constructor for my DbConfiguration class. I have no experience with programatically setting file access permissions, and it seems like a potential minefield.
I was wondering if there might be better (or at least other) way to set access permissions to all users (and particularly if there are settings available which set the access permissions when entity framework for sql server compact creates the database file).
Thanks for your expertise.
You cannot have a shared database with Click-once, in order to set the access control list you need admin rights (ie you need to run an installer). You can also set access rights via the xcacls command line tool. Keep in mind that the SQLCE database can only be shared between users on the same machine anyway.

SMO missing dll on a clients

I've created an app that connects remotely to SQL Server 2008. SQL connections work and all traditional oCommand.ExecuteNonQuery(), work great!
But my SMO class using server.ConnectionContext.ExecuteNonQuery(scriptfile);
ERROR: missing batch parsing.dll .
I can't install these independent utils on a client machines, and then take them all off when done:
as suggested by: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=228de03f-3b5a-428a-923f-58a033d316e1
Since my bulk-inserts are large memory hogs containing complete tables, I wrote the tables to a temptable.sql files and used SQLCMD Util and later switch too SMO and I have the same problem. Neither of these can be leveraged on the client's PCs . Any suggestion? thanks :-)
Well, two things:
if you want to use SMO in your apps, you need to make sure the SMO components are installed on the client machines. You can grab the SMO binaries from Microsoft and you can ship and install them with your app - but that's the only way you'll get those onto the client's computer legally
if you can't do that, how about checking out the SqlBulkCopy class. This is designed specifically for bulk inserting large volumes of data, it's part of ADO.NET 2.0 - no extra installs. There's a whole section in the MSDN library on SQL Server Bulk Operations - check it out!