deploying from sql server express to datacenter - asp.net

I'm taking the database that I created with SQL server express and putting it on a server in a datacenter. There are 2 database files in AppData folder: the aspnetdb.mdf file and the file I created for my site MySite.mdf. I'm using the ASP login control and that works with the ASPNETDB.mdf file and it's working. If I log in without the correct username/pwd, it'll display a bad login message.
However, as soon as I login and the site goes to make a request to MySite.mdf, I get an error "Invalid object name 'dbo.Users'." which is the name of the first table the site looks into after the login.
I've attached the MySite.mdf file to the server and copied the connection string the hosting company is generating into the web.config file and left the rest as is.
Could it be that I can't attach a sql express file?
Please let me know if you've run into this issue or if you have any suggestions.
Thanks.

Based on your description and the following assumptions:
your authentication still works
you haven't mentioned attaching your aspnet.mdf
you have separate databases for security and datastore
you're probably still testing locally
I'd guess that your application is still pointing at your local aspnet database - that's why authentication still works. Typically in a shared host, you'll have to install/insert the asp.net security database items to your main database. See This MSDN page for instructions on setting up the asp.net database objects.
You need to establish whether or not you've actually attached your database or not. Is there an online "database manager" you can access? Or can you connect to your database from SSMS or your dev environment and run a simple query?

Related

Unable to create user for a restored database in SQL Server 2012

I started a few developments in a developed ASP.NET web site. I restored the Db successfully to the SQL Server 2012, and once I created a new login for a user wilsondbuser. And I worked with it very well.
After 2 days, when I visit to the SQL Server again, there was no that created user in the Security tab of relevant Db. But the user was in the SQl Server Security tab. And also no any table displayed.
So, I deleted that user, only exist in the Security tab of relevant Db. Then I tried to create the same user in SQL Server. Then it displayed following error.
Please help me to again work with that restored database.
Try below steps solved the problem:
Copy database files to another location
Delete main files
Restart SQL Service.
In management studio the database will be shown with "Recovery Pending" in front of its name, delete it.
Attach your database with copied files of the first step.
Create the user you want.

Can not access SQL Server database information

I am new to SQL Server databases. I used a SQL Server database in my website (I add it to my project by add new Item and now it is located in a App_Data folder). I can show the needed information of it in a gridview on my localhost but when I upload it on the web hosting server, I can not access it.
What is wrong with it? You can see it here: http://www.kaj.somee.com/SL.aspx
I'm using asp.net 2010 and vb.net
There is the error. See your excerpt (per comment). Do you really have your app_data folder in path
AttachDbFilename=C:\Users\Javad\Desktop\Sharj\App_Data\ShDB.‌​mdf
Does this path really exist in your hosting machine. I believe NO and in that case Change that path accordingly.

ASP.NET "Cannot write to DB File" when logging in

please help me fix this.
I am setting up a ASP.NET website using a .mdb (Access) database file. I don't want to use SQL Server because I have to pay more for the hosting.
I followed this guide to get the .mdb file working in Visual Studio: http://imar.spaanjaars.com/404/using-the-microsoft-access-providers-to-replace-the-built-in-sql-server-providers
It all works fine when I run it on my local machine from VS 2008.
I have uploaded my website to my new web hosting and when I try to log in (using the ASP.NET login control) I am getting the message "Cannot write to DB File". It is not a proper error, but just a single line of text.
I have spoken to the web hosting company and they claim that all of the permissions are set up correctly.
I have been fiddling with web.config and so far no success.
Any ideas? Cheers.
Did the Web Hosting company tell you what permissions have been set? You need Modify permissions on the folder that contains the Access database. I say "you", I mean the user account that your application runs under - most likely the App Pool that your site runs in.

ASP.NET web application: 404 error in the remote server when a common database connection string is used

I'm working with a project in c# asp.net..
When i created individual connection strings for accessing the database, the program runs properly in the local and remote servers..
But when i wrote the connection string commonly in a class and accessing those connection using an object, it works properly in the local server but while running in the remote server it shows a "404 error"..
Please help..
Are you create database in your server ?? and are you deploy all pages in your server ???
check below links
http://support.microsoft.com/kb/315122
It sounds more like a remote server problem in general than anything specific in your code. Are there other ASP.NET pages or sites already running on the remote server successfully? If not, it may be related to the way you've deployed the site than your code - are you sure IIS is set up to serve the ASP.NET site correctly?
I'd start by creating a "test.aspx" page with no dynamic content and try accessing that, and then work forward from there.

ERROR when creating User on an ASP.NET MVC2 Project on a server

I have uploaded the ASP.NET MVC2 created from MS Template to Remote server. It works except when I want to register a new user; after validation I got this error message:
Sorry, an error occurred while
processing your request.
What should I do ?
I would suspect that the database location is not writeable but as Remus said to know for sure you'll need to get the error/exception back from the server somehow.
You need to allow write access to the ~/App_Data directory to the account your application is configured to run under IIS. When you try to register a user for the first time the application need to create the .mdb database file. Also if you are not using SQL Express and have a SQL Server installed don't forget to modify the connection string in your web.config to match the properties of your real server.

Resources