connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=DataDirectoryaspnetdb.mdf;User Instance=true"
connectionString="data source=.\YOURSQL2005;Initial Catalog=aspnetdb;Integrated Security=SSPI"
Responding to this on the asp.net MS newsgroup to someone who was having issues with this with their web hosting company (who it appears already had their default membership database configured in machine.config):
"If the error you receive is still the one about an already attached DB of the same name, how have you modified the web.config file? It needs to have a
<connectionstrings></connectionstrings> section and in that section you need the following tags (in order):
<add name="LocalSqlServer" connectionstring="data source=YourServerandInstance;Integrated Security=SSPI;AttachDBFilename=DataDirectoryYourAppDB.mdf;User Instance=true" providername="System.Data.SqlClient">
Obviously, you'll need to modify the server/instance and mdf values. The key is that ASPNET uses the "LocalSqlServer" connection string to do its authorization, etc.-- "
MVP buddy Rick Strahl has a created a really interesting control to save other controls' state. This enables you to declare what properties you specifically want, which represents improvement over ViewState and even ControlState. Several developers who looked at Rick's original work, including yours truly, suggested improvements and Rick has incorporated these. I've already backported this to ASP.NET 1.1 and plan to do some more testing on it. I added a Cache option in addition to the HiddenField and SessionVariable Storage options as some testing I did earlier indicated that using Cache to store ViewState-related stuff was the most performant. One thing I really respect about Strahl is that he isn't afraid to put out unfinished ideas and take good feedback from others, and then work these improvements in (along with other good stuff he's discovered in the process). That's the mark of a professional developer!