Tools Used:
Visual Studio 2008 Professional Edition
SQL Server Management Studio
Recently I was developing an ASP.NET site which worked fine on my computer, but when I went to deploy it to Network Solutions, it did not work, and their Support was not very helpful. They told me that membership could not be used. They also told me that asp.net, while supported, could not be used on the server since it is shared hosting environment. Further they told me that they could not create an “Application” like I would using IIS also because it is a shared hosting environment. They also do not have an option (in windows) for VPS that would allow full control. All the stuff they told me is basically not true or only partially true.
First off in order to get your asp.net site up and running (without membership) all you have to do is copy your aspx files to the root of the htdocs folder that they supply for you. This in itself is an application directory and because of this you can run ASP.NET pages.
Second, you can use membership by going to their admin pages, creating a database, exporting your data and schema from your current membership database, and then running a script in query analyzer. Here’s how you do this:
1. To start off you should have a site with membership that allows you to login successfully from your local computer. There are plenty of tutorials online that will help you out with this but it’s beyond the scope of this post.
2. Now we create the sql database on Network Solutions. Go to Manage Account>>My Hosting Packages>>Click on Web Hosting Toolkit>>Go down to the bottom of the page and click Database Manager >>Click Microsoft SQL Server (Note: if nothing pops up and you get “sessionId=0”, logout using the link on the top right hand side of the page.)
3. Click Add to add a new DB . Then enter your information for the new database. Just make a note of what you entered here:
4. Now that we have a DB, lets connect to it using SQL Server Management Studio. Network Solutions gives you the address to which to connect to after you create the database. When you are in database manager , select your newly created database and then click edit to view it. Open SQL Server Management Studio and enter the ip address, your username and password to connect.
5. Now that you are connected, minimize SQL Management Studio, and then open up your website in Visual Studio. We will now we will create the .SQL script to recreate the schema and data on the network solutions database we created above.
6. In Server Explorer, Right Click on aspnetdb.mdf and click “Publish To Provider”, then follow the wizard. This will create a sql script replicating the aspnetdb.mdf database. here’s what my screen looked like.
7. Now that you have the sql script created, open it using your favorite text editor, and then copy all of it’s contents.
8. Go back to SQL Management Studio, Find your database name under databases and (you can see all network solutions databases hosted on that shared server), single click it and then click “New Query”. This will open up a sql window.
9. Paste all the code that you copied in step 7, and execute the script. This should recreate all your user information, roles, security, etc. I did not have any errors when doing this so I can’t really help you out if it doesn’t work.
10. Next modify your web.config file to include a new connection string to point to this new database. Here’s the string that I used in my web.config file.
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=IPAddress;Initial Catalog=URDBName;User Id=URUsername;Password=***********;" providerName="System.Data.SqlClient" />
</connectionStrings>
11. Next ftp all of your files up to Network Solutions server using the Manage Account>>FTP/ContentPublishing provided by them. I use filezilla, it’s easier. I uploaded them to the root of the htdocs folder, and voila everything worked.
Another note, Network Solutions support was telling me that If I have an access database (which I do), I need create a new folder called “db” under the HTDocs folder and adjust my code to point to this folder. They said this is due to permissions. This worked flawlessly.
Another note: If you use smtp in your asp.net, create your email address in network solutions Manage Account, and then add the following information to your web.config file:
<system.net>
<mailSettings>
<smtp from="myemailaddress@mydomain.com">
<network
host="localhost"
port="25"
userName="myemailaddress@mydomain.com"
password="*********" />
</smtp>
</mailSettings>
</system.net>
I would also like to give credit to this site for information on the Visual Studio schema export.