How to use aspnetdb database with an asp.net website - asp.net

I have created a website using asp.net 3.5.
And now I have added member support to it using Membership API and aspnetdb database.
And I have done all testing on my local machine.
Now, what issue needs to be considered with respect to aspnetdb while uploading this site to the server. ie; how this database will be available on the server side ?
Note : This is my first ever website.

I was just looking for an answer to this myself.
I've found the following that might help you:
http://www.studiocoast.com.au/knowledgebase/article-6-aspnet-using-sql-server-instead-of-aspnetdbmdf.aspx
"When developing applications in
ASP.NET 2.0, the default option for
roles and users is to use a local SQL
database in the App_Data directory.
This works fine locally, but will
bring up an error when uploaded to a
production server. To fix this the
ASP.NET membership information needs
to be stored in a dedicated SQL Server
database."
"ASP.NET includes a program called
Aspnet_regsql.exe which you can run
locally to configure your database.
More information on the program can be
found here:
http://msdn2.microsoft.com/en-us/library/ms229862.aspx"

Look in your C:\Windows\Microsoft.NET\Framework\v2.0.50727\ folder for the file InstallMembership.sql.
Thats the SQL script to create the database you need.

Related

Upload Data from Local Database to Live Database in ASP.Net using SQL 2008

I am working on a web application which have two parts.
1) One is the online web site at online server.
2) The second is running on local machines/computers.
The structure of database is same on both live and on local. Now a user can make changes on the local database and then publish them on to the live server.
How can I update data from local database to online database? Which is the best technique to do this?
Use Any of the Version Controller tool like TFS, It would help in check in your changes

ASP.NET Members Section - Cannot create and connect to Database

Visual Studio 2010
MSSQL 2005
Windows Vista
I am creating an ASP.NET website using webforms, I want to create a members section using Web Site Administration Tool. I am following this youtube tutorial (http://www.youtube.com/watch?v=vxxFhGF-Z7E) but I am stuck at 2:58 mins into vid.
After I have created users and roles the vid says ASP.NET should automatically create a Database with tables in the APP_Data section in the Solution explorer in ASP.NET. BUT.... mine doesnt create this database. And when I go into the "Provider" tab in Web Site Administration Tool and test the connection I get an error:
Could not establish 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 command-line utility to create and configure the database, and then return to this tool to set the provider.
I have looked into lots of solutions online for this but cannot find a solution. Would anyone know what I am doing wrong?
What you need to do is to run the aspnet_regsql you can find that under C:\Windows\Microsoft.NET\Framework\v4.0.30319
if you are using .net4
after running the wizard you should see some tables have been added to your database these are your membership tables
after running this you may need to check your connection string out and ensure that it is correct
if these are all correct
when running the membership you should be able to add users
Thanks Inkey

No access to Database File

Last week I created a ASP.NET Web Application project on my machine. It was connecting to a SQL server database file for testing. The database was created in the server explorer part of visual studio and it created a database file with all of the information within it. I was using windows authentication to connect to the database.
Recently my computer has been migrated onto a new netowrk within my company. Now I no longer have access to the database file. The error I am getting is Login failed for user "DOMAIN/USER". I guess this is because the Domain has changed and my computer and the database server are in different domains. However I do not have access to the old domain to add a new login or user with priveladges to access the database.
How can i get arround this?
You cannot get around this, unless an admin is willing to give you a copy of the files from the old drive.
So, you must re-create your database.
Fortunately, if you took proper precautions, this will be easy.
Option 1: If your database is under source control, simply checkout the latest good version of the database.
Option 2: Load the latest backup of the database.

Which database to use for C# ASP.NET website?

I am developing an online internal web portal (like users write tests, provide document links to study, completing a study roadmap, admin user to view ststistics, etc). It caters some 150 users. I have planned to use ASP .NET with c# in Visual Studio 2008 on windows xp. I am implementing using Forms and NOT MVC since I feel at home with forms.
I do not want to use windows authentication since each user will have many attributes related to him and so it will be easy using a database. Security is not an issue since it is being used internally only.
I have only a fair knowledge about ASP and C# and VS 2008.
Now my questions:
Can I use MS SQL server database that is built in in VS 2008?( I cannot ask for external databases)
Can I export the website totally along with the databases to IIS server running in some other computer? How?
Do I need to export databases separately or provide a database creation script like PHP?
(I have more questions. Will update once I start off).
(This is my first .net web app. so can i know where i can find login scripts, pagination, examples, and pretty much all the stuff)
edit: which to use? New website or New Webapplication?
You can pretty much use any database, but it seems from your requirements that you want to look closer towards something like SQLExpress, SQL Server Compact Edition or SQLLite.
Can I export the website totally along
with the databases to IIS server
running in some other computer? How?
Your database will be shipped along with your application if you use one of the database options that I have specified above.
Do I need to export databases
separately or provide a database
creation script like PHP?
See my comment above, the database will exist when you deploy your website to IIS. It's a physical file that will be in your APP_DATA folder.
You can use:
MySQL. The reason: It has no space or memory limit!
SQL Server or SQL CE. These are both alike. They just differ in slite functions, and also the storage!
The SQL CE allows you to have 4GB. But the SQL Server lets you have 10GB.
So it depends on your work!
Also, I wanted to point out one error in a post, that the SQL CE is present in App_Data, Correct! But the SQL Server is placed somewhere like:
C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\here_will_it_be
And yes, you can migrate it to wherever you want to place it. I mean if you want to upload it to a hosting server, you can upload it using Web Deploy! Or what ever service. When downloading you will have to repeat same process!
I hope you are doing good with your first web app! :)

Publishing ASP.NET site - No login database?

I have a very simple app on my local machine that uses the ASP.NET membership provider. This works fine on my local machine.
I have published the app to our web server, and I need to know the specifics of setting up the application for asp.net membership to work.
I have a basic understanding that it uses an MDF file and somehow connects to a SQL database (SQLEXPRESS I assume on my local machine) which holds the user/role information.
I keep getting an error that it cannot connect to a SQL database when running the published application on the web server.
I wish to use a SQL server on a different machine (SQL69) than my web server (WEB69)
I have created a new connection string, but how do I tell ASP.NET to use it instead of the "LocalSqlServer" connection string that is created by default?
Can someone explain what is required to me?
Thanks for any help you can offer.
Use the ASP.NET SQL Server Registration Tool without any parameters to set up the SQL Server membership on your local machine. This will also update your config file:
http://msdn.microsoft.com/en-us/library/ms229862%28VS.80%29.aspx
You need to set up SQL Server DB membership on your local machine first. After you have this working, you can simply script the entire DB for your production environment. For this, you can use the Database Publishing Wizard in VS.
You can view a sample config file here:
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx

Resources