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.
Related
I made an ASP.NET web site using visual studio 2012. I registered a free domain and now I need to upload the project using for example FileZilla. Can you tell me which files exctly should I upload and do I need to set a starting page in my project or I need a Default.aspx page in it. I also have an MSSQL database. Any suggestions how to upload it?
If you can publish your code using this - right click on project , select publish, choose filesystem , and then save published code to target file system and then copy that directory to required domain using FileZilla. Also you can directly copy solution project , but it is recommended to host published code.
You can set startup page using web.config - Set Default Page in Asp.net
Regarding DB thing - you need to make sure, required domain has MSSQL, if that has, then copy required DB and attach to DB server, extract connection string ( DB server address, DB name , credential) and update that in web.config of hosted website.
I have an ASP.NET application where my client has moved from Microsoft Server 2008 R2 to Microsoft Server 2012. My application saves and removes files from a local folder that we give permissions on. This works fine, I can add and remove uploaded files with ease.
The problem is, that any of the files that were uploaded from the old Server and copied over to the new server, they get an Access Denied when IIS tries to remove it. Now, like I said I can upload and remove new files without any problems. It is the old files that were uploaded to the old server and transferred over to the new server that will give the error.
Can anyone point me in the right direction as to how we can setup the permissions on these files so they can be accessed correctly on the new server?
Thanks,
Cory
Most likely the files where copied with old permissions. Try following on the new server:
In Windows Explorer Right-mouse click on the folder that holds the files and go to Properties, Security Tab
There click Advanced and Change Permissions
There check the "Replace All child Object Permissions" checkbox and click Apply
This should give all the old files the same permissions as new files.
I have one web site and I want to upload it on server and i also want to upload the ms sql database with that web pages. Please tell me how to upload it on web server....
This is a rather generic question because there could be a lot of different problems and differences, but generally, you would take a backup of your server first. Here is some general information on that:
http://msdn.microsoft.com/en-us/library/ms187510.aspx
Then log into your hosting provider, create a database using their tools, and restore your database backup to that new hosted database.
Next you would change where your database config in your files is pointing to the new database, then use an ftp client like Filezilla to ftp into your web server. The hosting provider should be able to give you the username and password. Upload the web pages / files to the public directory (usually /public or /htdocs or something along those lines).
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?
I have used the |DataDirectory| value in a connection string in web.config. It works fine on my local machine.
However it fails when the site is uploaded. The uploaded version of my site is a sub-directory / sub-application of another site. The |datadirectory| value does not reference my App_Data folder, but a folder on the hosting computer.
Is there a way around this? I want to avoid having 2 different web.config files.
Did you check that SQL Express is supported at your host? If not ask their support team. It could also be that you need to attach your .mdf file, after uploading it to the server, to a full blown SQL Server. Again ask your hosting company. Also you should receive from them the correct connectionstring. Also find out more about Connection strings.
Grz, Kris.